LVM example
来源:互联网 发布:win10 ubuntu双系统 编辑:程序博客网 时间:2024/06/07 06:28
[root@MiWiFi-R3-srv ~]# lsblk[root@MiWiFi-R3-srv ~]# pvcreate /dev/sdb[root@MiWiFi-R3-srv ~]# pvdisplay[root@MiWiFi-R3-srv ~]# pvs[root@MiWiFi-R3-srv ~]# vgcreate vgtest /dev/sdb[root@MiWiFi-R3-srv ~]# vgdisplay[root@MiWiFi-R3-srv ~]# vgs[root@MiWiFi-R3-srv ~]# lvcreate -n usb0 -L 2G vgtest[root@MiWiFi-R3-srv ~]# lvdisplay[root@MiWiFi-R3-srv ~]# lvs[root@MiWiFi-R3-srv ~]# vgs[root@MiWiFi-R3-srv ~]# pvs[root@MiWiFi-R3-srv ~]# mkfs.ext4 /dev/vgtest/usb0[root@MiWiFi-R3-srv ~]# mkdir /mnt/usb0[root@MiWiFi-R3-srv ~]# mount /dev/vgtest/usb0 /mnt/usb0[root@MiWiFi-R3-srv ~]# lvextend -L +1G /dev/vgtest/usb0[root@MiWiFi-R3-srv ~]# lvreduce -L -1G /dev/vgtest/usb0
[root@MiWiFi-R3-srv ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 5G 0 part ├─sda2 8:2 0 204G 0 part │ ├─cl-swap 253:1 0 4G 0 lvm │ ├─cl-root 253:3 0 100G 0 lvm │ └─cl-home 253:4 0 100G 0 lvm ├─sda3 8:3 0 5G 0 part /boot├─sda4 8:4 0 1K 0 part └─sda5 8:5 0 104G 0 part ├─fedora-root 253:0 0 100G 0 lvm / └─fedora-swap 253:2 0 4G 0 lvm [SWAP]sdb 8:16 1 7.2G 0 disk sr0 11:0 1 1024M 0 rom [root@MiWiFi-R3-srv ~]# pvcreate /dev/sdbWARNING: dos signature detected on /dev/sdb at offset 510. Wipe it? [y/n]: y Wiping dos signature on /dev/sdb. Physical volume "/dev/sdb" successfully created.[root@MiWiFi-R3-srv ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name cl PV Size <204.01 GiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 52225 Free PE 1 Allocated PE 52224 PV UUID esdBDA-cTfV-Mt7p-3IMy-3xsa-OHIO-e92pP4 --- Physical volume --- PV Name /dev/sda5 VG Name fedora PV Size <104.01 GiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 26625 Free PE 1 Allocated PE 26624 PV UUID rMBft2-l6ei-O0NV-Bn2a-1pwS-CqVx-odppTw "/dev/sdb" is a new physical volume of "7.22 GiB" --- NEW Physical volume --- PV Name /dev/sdb VG Name PV Size 7.22 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID yedFIv-dphp-pGT1-npkd-Rbkb-5Nws-TG3jfQ [root@MiWiFi-R3-srv ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 cl lvm2 a-- 204.00g 4.00m /dev/sda5 fedora lvm2 a-- 104.00g 4.00m /dev/sdb lvm2 --- 7.22g 7.22g[root@MiWiFi-R3-srv ~]# vgcreate vgtest /dev/sdb Volume group "vgtest" successfully created[root@MiWiFi-R3-srv ~]# vgdisplay --- Volume group --- VG Name cl System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 204.00 GiB PE Size 4.00 MiB Total PE 52225 Alloc PE / Size 52224 / 204.00 GiB Free PE / Size 1 / 4.00 MiB VG UUID JTJ7es-N04M-yVTx-tQJJ-kEO6-vO83-rNz1Is --- Volume group --- VG Name vgtest System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 7.22 GiB PE Size 4.00 MiB Total PE 1849 Alloc PE / Size 0 / 0 Free PE / Size 1849 / 7.22 GiB VG UUID GSSa1l-BJUj-BaF3-E0Gb-yCSm-ZTDb-16dkuG --- Volume group --- VG Name fedora System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 104.00 GiB PE Size 4.00 MiB Total PE 26625 Alloc PE / Size 26624 / 104.00 GiB Free PE / Size 1 / 4.00 MiB VG UUID y3A3DA-wbIg-pfpU-7b1b-4mD1-TTbQ-iLhCBc [root@MiWiFi-R3-srv ~]# vgs VG #PV #LV #SN Attr VSize VFree cl 1 3 0 wz--n- 204.00g 4.00m fedora 1 2 0 wz--n- 104.00g 4.00m vgtest 1 0 0 wz--n- 7.22g 7.22g[root@MiWiFi-R3-srv ~]# lvcreate -n usb0 -L 2G vgtestWARNING: LVM2_member signature detected on /dev/vgtest/usb0 at offset 536. Wipe it? [y/n]: y Wiping LVM2_member signature on /dev/vgtest/usb0. Logical volume "usb0" created.[root@MiWiFi-R3-srv ~]# lvdisplay --- Logical volume --- LV Path /dev/cl/root LV Name root VG Name cl LV UUID yWStML-9HiS-Ye6y-t2PE-lKS0-8HTa-7qtkZ4 LV Write Access read/write LV Creation host, time MiWiFi-R3-srv, 2017-10-21 22:08:23 +0800 LV Status available # open 0 LV Size 100.00 GiB Current LE 25600 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:3 --- Logical volume --- LV Path /dev/cl/home LV Name home VG Name cl LV UUID RBNGpO-M9Ce-wsj9-CRES-ln98-gDAy-5jUFtm LV Write Access read/write LV Creation host, time MiWiFi-R3-srv, 2017-10-21 22:08:24 +0800 LV Status available # open 0 LV Size 100.00 GiB Current LE 25600 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:4 --- Logical volume --- LV Path /dev/cl/swap LV Name swap VG Name cl LV UUID b8XGII-tysT-n3g1-CN41-bYRh-PUA2-cKNvfu LV Write Access read/write LV Creation host, time MiWiFi-R3-srv, 2017-10-21 22:08:25 +0800 LV Status available # open 0 LV Size 4.00 GiB Current LE 1024 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 --- Logical volume --- LV Path /dev/vgtest/usb0 LV Name usb0 VG Name vgtest LV UUID 0wiWdF-qZat-8lgf-ugsF-kon3-ebDv-y3b4jP LV Write Access read/write LV Creation host, time MiWiFi-R3-srv, 2017-10-22 15:33:13 +0800 LV Status available # open 0 LV Size 2.00 GiB Current LE 512 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:5 --- Logical volume --- LV Path /dev/fedora/swap LV Name swap VG Name fedora LV UUID DWHLU1-10sW-NMpc-7CTO-HP2s-N97u-kaKNkX LV Write Access read/write LV Creation host, time MiWiFi-R3-srv, 2017-10-22 10:21:31 +0800 LV Status available # open 2 LV Size 4.00 GiB Current LE 1024 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2 --- Logical volume --- LV Path /dev/fedora/root LV Name root VG Name fedora LV UUID 2QQs7c-yw4L-s3jM-AEIu-5Kuu-kEEn-9FPo0O LV Write Access read/write LV Creation host, time MiWiFi-R3-srv, 2017-10-22 10:21:32 +0800 LV Status available # open 1 LV Size 100.00 GiB Current LE 25600 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@MiWiFi-R3-srv ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert home cl -wi-a----- 100.00g root cl -wi-a----- 100.00g swap cl -wi-a----- 4.00g root fedora -wi-ao---- 100.00g swap fedora -wi-ao---- 4.00g usb0 vgtest -wi-a----- 2.00g [root@MiWiFi-R3-srv ~]# vgs VG #PV #LV #SN Attr VSize VFree cl 1 3 0 wz--n- 204.00g 4.00m fedora 1 2 0 wz--n- 104.00g 4.00m vgtest 1 1 0 wz--n- 7.22g 5.22g[root@MiWiFi-R3-srv ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 cl lvm2 a-- 204.00g 4.00m /dev/sda5 fedora lvm2 a-- 104.00g 4.00m /dev/sdb vgtest lvm2 a-- 7.22g 5.22g[root@MiWiFi-R3-srv ~]# mkfs.ext4 /dev/vgtest/usb0mke2fs 1.43.5 (04-Aug-2017)Creating filesystem with 524288 4k blocks and 131072 inodesFilesystem UUID: effd7bf8-f015-4754-8542-c78f16e63133Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): doneWriting superblocks and filesystem accounting information: done [root@MiWiFi-R3-srv ~]# mkdir /mnt/usb0[root@MiWiFi-R3-srv ~]# mount /dev/vgtest/usb0 /mnt/usb0[root@MiWiFi-R3-srv ~]# lvextend -L +1G /dev/vgtest/usb0 Size of logical volume vgtest/usb0 changed from 2.00 GiB (512 extents) to 3.00 GiB (768 extents). Logical volume vgtest/usb0 successfully resized.[root@MiWiFi-R3-srv ~]# lvreduce -L -1G /dev/vgtest/usb0 WARNING: Reducing active and open logical volume to 2.00 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.)Do you really want to reduce vgtest/usb0? [y/n]: y Size of logical volume vgtest/usb0 changed from 3.00 GiB (768 extents) to 2.00 GiB (512 extents). Logical volume vgtest/usb0 successfully resized.[root@MiWiFi-R3-srv ~]# cd /mnt/usb0/[root@MiWiFi-R3-srv usb0]# lslost+found
阅读全文
0 0
- LVM example
- LVM
- lvm
- LVM
- LVM
- LVM
- LVM
- lvm
- LVM
- LVM
- LVM
- lvm
- LVM
- LVM
- lvm
- LVM
- LVM
- LVM
- 创建带头结点链表的方法
- python学习(2)--变量与表达式
- 杨辉三角
- Mybatis学习笔记-mybatis调用存储过程
- [Floyd] codevs1077
- LVM example
- 蓝桥杯嵌入式第一天——感悟与碰到的一些问题
- 第八周项目4 三元组稀疏矩阵表示
- PCA降维
- PHP命名空间(Namespace)的使用浅析
- Python源码剖析(02 Python对象初探)
- 第8周项目4-稀疏矩阵的三元组表示的实现及应用(2)
- 记录SQL查询左连接,和Where的一次坑
- MFC网络编程(二):简单TCP通信