[root@localhost ~]# umount /juanzu
[root@localhost ~]# e2fsck -f /dev/storage/vo
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/storage/vo: 11/37544 files (9.1% non-contiguous), 10390/155648 blocks
[root@localhost ~]# resize2fs /dev/storage/vo 80M
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/storage/vo to 81920 (1k) blocks.
The filesystem on /dev/storage/vo is now 81920 blocks long.
[root@localhost ~]# lvreduce -L 80M /dev/storage/vo
WARNING: Reducing active logical volume to 80.00 MiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vo? [y/n]: y
Reducing logical volume vo to 80.00 MiB
Logical volume vo successfully resized
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 18G 3.3G 15G 19% /
devtmpfs 905M 0 905M 0% /dev
tmpfs 914M 0 914M 0% /dev/shm
tmpfs 914M 8.8M 905M 1% /run
tmpfs 914M 0 914M 0% /sys/fs/cgroup
/dev/sr0 3.5G 3.5G 0 100% /media/cdrom
/dev/sda1 497M 119M 379M 24% /boot
/dev/mapper/storage-vo 74M 1.6M 67M 3% /juanzu
[root@localhost ~]#
逻辑卷快照的创建
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name rhel
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 19.51 GiB
PE Size 4.00 MiB
Total PE 4994
Alloc PE / Size 4994 / 19.51 GiB
Free PE / Size 0 / 0
VG UUID T5hDds-VDIJ-YnVb-QD7a-vTqQ-fRp3-5UKHIA
--- Volume group ---
VG Name storage
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.99 GiB
PE Size 4.00 MiB
Total PE 10238
Alloc PE / Size 20 / 80.00 MiB
Free PE / Size 10218 / 39.91 GiB
VG UUID 1xoEfz-fulm-9bX6-maDW-RNDE-WBqF-NIBIDo
[root@localhost ~]# echo "happy birthday" > /juanzu/ceshi.txt
[root@localhost ~]# cat /juanzu/ceshi.txt
happy birthday
[root@localhost ~]# ls -l /juanzu
total 14
-rw-r--r--. 1 root root 15 Apr 29 23:46 ceshi.txt
drwx------. 2 root root 12288 Apr 29 23:24 lost+found
[root@localhost ~]# lvcreate -L 80M -s -n kuaizhaojuan /dev/storage/vo
Logical volume "kuaizhaojuan" created
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID 0MBcrL-ike8-LqP5-jCSF-KmlD-2lM0-02FqEu
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:28 +0800
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID yRBTII-dmZP-qbG7-KXh3-MnlI-0HRU-yzMbJR
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:29 +0800
LV Status available
# open 1
LV Size 17.51 GiB
Current LE 4482
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/storage/vo
LV Name vo
VG Name storage
LV UUID 0w6ZZa-IdwN-kmfl-d3lp-Bhuj-nNBR-UfqtFm
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2021-04-29 23:22:46 +0800
LV snapshot status source of
kuaizhaojuan [active]
LV Status available
# open 1
LV Size 80.00 MiB
Current LE 20
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/storage/kuaizhaojuan
LV Name kuaizhaojuan
VG Name storage
LV UUID 6cp5GK-vHwC-Tmnk-v2xN-znaa-reN9-i4dAVw
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2021-04-29 23:48:49 +0800
LV snapshot status active destination for vo
LV Status available
# open 0
LV Size 80.00 MiB
Current LE 20
COW-table size 80.00 MiB
COW-table LE 20
**Allocated to snapshot 0.01%**
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3
[root@localhost ~]# dd if=/dev/zero of=/juanzu/files count=1 bs=50M
1+0 records in
1+0 records out
52428800 bytes (52 MB) copied, 0.71935 s, 72.9 MB/s
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID 0MBcrL-ike8-LqP5-jCSF-KmlD-2lM0-02FqEu
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:28 +0800
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID yRBTII-dmZP-qbG7-KXh3-MnlI-0HRU-yzMbJR
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:29 +0800
LV Status available
# open 1
LV Size 17.51 GiB
Current LE 4482
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/storage/vo
LV Name vo
VG Name storage
LV UUID 0w6ZZa-IdwN-kmfl-d3lp-Bhuj-nNBR-UfqtFm
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2021-04-29 23:22:46 +0800
LV snapshot status source of
kuaizhaojuan [active]
LV Status available
# open 1
LV Size 80.00 MiB
Current LE 20
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/storage/kuaizhaojuan
LV Name kuaizhaojuan
VG Name storage
LV UUID 6cp5GK-vHwC-Tmnk-v2xN-znaa-reN9-i4dAVw
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2021-04-29 23:48:49 +0800
LV snapshot status active destination for vo
LV Status available
# open 0
LV Size 80.00 MiB
Current LE 20
COW-table size 80.00 MiB
COW-table LE 20
**Allocated to snapshot 44.75%**
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3
[root@localhost ~]# dd if=/dev/zero of=/juanzu/files count=1 bs=50M
1+0 records in
1+0 records out
52428800 bytes (52 MB) copied, 0.324717 s, 161 MB/s
[root@localhost ~]# lvdisplay | tail -n 21
LV Path /dev/storage/kuaizhaojuan
LV Name kuaizhaojuan
VG Name storage
LV UUID 6cp5GK-vHwC-Tmnk-v2xN-znaa-reN9-i4dAVw
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2021-04-29 23:48:49 +0800
LV snapshot status active destination for vo
LV Status available
# open 0
LV Size 80.00 MiB
Current LE 20
COW-table size 80.00 MiB
COW-table LE 20
**Allocated to snapshot 90.54%**
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3
[root@localhost ~]# dd if=/dev/zero of=/juanzu/files count=1 bs=50M
1+0 records in
1+0 records out
52428800 bytes (52 MB) copied, 0.120165 s, 436 MB/s
[root@localhost ~]# lvdisplay | tail -n 21
LV Path /dev/storage/kuaizhaojuan
LV Name kuaizhaojuan
VG Name storage
LV UUID 6cp5GK-vHwC-Tmnk-v2xN-znaa-reN9-i4dAVw
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2021-04-29 23:48:49 +0800
LV snapshot status active destination for vo
LV Status available
# open 0
LV Size 80.00 MiB
Current LE 20
COW-table size 80.00 MiB
COW-table LE 20
**Allocated to snapshot 90.56%**
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3
[root@localhost ~]#
[root@localhost ~]# umount /juanzu
[root@localhost ~]# lvconvert --merge /dev/storage/vo
"vo" is not a mergeable logical volume.
Unable to merge LV "vo" into its origin.
[root@localhost ~]# lvconvert --merge /dev/storage/kuaizhaojuan
Merging of volume kuaizhaojuan started.
vo: Merged: 17.6%
vo: Merged: 100.0%
Merge of snapshot into logical volume vo has finished.
Logical volume "kuaizhaojuan" successfully removed
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name rhel
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 19.51 GiB
PE Size 4.00 MiB
Total PE 4994
Alloc PE / Size 4994 / 19.51 GiB
Free PE / Size 0 / 0
VG UUID T5hDds-VDIJ-YnVb-QD7a-vTqQ-fRp3-5UKHIA
--- Volume group ---
VG Name storage
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.99 GiB
PE Size 4.00 MiB
Total PE 10238
Alloc PE / Size 20 / 80.00 MiB
Free PE / Size 10218 / 39.91 GiB
VG UUID 1xoEfz-fulm-9bX6-maDW-RNDE-WBqF-NIBIDo
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID 0MBcrL-ike8-LqP5-jCSF-KmlD-2lM0-02FqEu
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:28 +0800
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID yRBTII-dmZP-qbG7-KXh3-MnlI-0HRU-yzMbJR
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:29 +0800
LV Status available
# open 1
LV Size 17.51 GiB
Current LE 4482
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/storage/vo
LV Name vo
VG Name storage
LV UUID 0w6ZZa-IdwN-kmfl-d3lp-Bhuj-nNBR-UfqtFm
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2021-04-29 23:22:46 +0800
LV Status available
# open 0
LV Size 80.00 MiB
Current LE 20
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
[root@localhost ~]# mount -a
[root@localhost ~]# ls /juanzu
ceshi.txt lost+found
[root@localhost ~]#
删除逻辑卷
[root@localhost ~]#
[root@localhost ~]# umount /juanzu
[root@localhost ~]# vim /etc/fstab
/dev/mapper/rhel-root / xfs defaults 1 1
UUID=c3896dea-8ec6-4fb3-acce-ddbeb8317eae /boot xfs defaults 1 2
/dev/mapper/rhel-swap swap swap defaults 0 0
/dev/cdrom /media/cdrom iso9660 defaults 0 0
/dev/storage/vo /juanzu ext4 defaults 0 0
[root@localhost ~]# lvremove /dev/storage/vo
Do you really want to remove active logical volume vo? [y/n]: y
Logical volume "vo" successfully removed
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID 0MBcrL-ike8-LqP5-jCSF-KmlD-2lM0-02FqEu
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:28 +0800
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID yRBTII-dmZP-qbG7-KXh3-MnlI-0HRU-yzMbJR
LV Write Access read/write
LV Creation host, time localhost, 2021-04-23 08:49:29 +0800
LV Status available
# open 1
LV Size 17.51 GiB
Current LE 4482
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@localhost ~]# vgremove storage
Volume group "storage" successfully removed
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name rhel
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 19.51 GiB
PE Size 4.00 MiB
Total PE 4994
Alloc PE / Size 4994 / 19.51 GiB
Free PE / Size 0 / 0
VG UUID T5hDds-VDIJ-YnVb-QD7a-vTqQ-fRp3-5UKHIA
[root@localhost ~]# pvremove /dev/sdb /dev/sdc
Labels on physical volume "/dev/sdb" successfully wiped
Labels on physical volume "/dev/sdc" successfully wiped
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name rhel
PV Size 19.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4994
Free PE 0
Allocated PE 4994
PV UUID USMyaH-Ujr4-Jz42-WulW-H4ZK-D0Zt-eeZR3V
[root@localhost ~]# pvcreate /dev/sdb /dev/sdc
Physical volume "/dev/sdb" successfully created
Physical volume "/dev/sdc" successfully created
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name rhel
PV Size 19.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4994
Free PE 0
Allocated PE 4994
PV UUID USMyaH-Ujr4-Jz42-WulW-H4ZK-D0Zt-eeZR3V
"/dev/sdc" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID Qm6e2a-w21q-KScW-Bc8u-N0WW-7mEC-xaJLA8
"/dev/sdb" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID GNeJxk-YZ5q-nCfz-ZRCL-c5Yh-Gye0-vjrmOw