LVM逻辑卷管理器的应用

创建逻辑卷

[root@localhost ~]# pvcreate /dev/sdb /dev/sdc
  Physical volume "/dev/sdb" successfully created
  Physical volume "/dev/sdc" successfully created
[root@localhost ~]# vgcreate storage /dev/sdb /dev/sdc
  Volume group "storage" successfully created
[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  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  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       0 / 0   
  Free  PE / Size       10238 / 39.99 GiB
  VG UUID               1xoEfz-fulm-9bX6-maDW-RNDE-WBqF-NIBIDo
   
[root@localhost ~]# lvcreate -n vo -l 25 storage
  Logical volume "vo" 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 Status              available
  # open                 0
  LV Size                100.00 MiB
  Current LE             25
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
   
[root@localhost ~]# mkfs.ext4 /dev/storage/vo 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
25688 inodes, 102400 blocks
5120 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33685504
13 block groups
8192 blocks per group, 8192 fragments per group
1976 inodes per group
Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@localhost ~]# mkdir /juanzu
[root@localhost ~]# mount /dev/storage/vo /juanzu
[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   93M  1.6M   85M   2% /juanzu
[root@localhost ~]# echo "/dev/storage/vo /juanzu ext4 defaults 0 0" >> /etc/fstab 
[root@localhost ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Fri Apr 23 00:49:29 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/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 ~]# 

[root@localhost ~]# lsblk -l
NAME       MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda          8:0    0   20G  0 disk 
sda1         8:1    0  500M  0 part /boot
sda2         8:2    0 19.5G  0 part 
rhel-root  253:0    0 17.5G  0 lvm  /
rhel-swap  253:1    0    2G  0 lvm  [SWAP]
sdb          8:16   0   20G  0 disk 
storage-vo 253:2    0  100M  0 lvm  /juanzu
sdc          8:32   0   20G  0 disk 
sr0         11:0    1  3.5G  0 rom  /media/cdrom
[root@localhost ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   20G  0 disk 
├─sda1          8:1    0  500M  0 part /boot
└─sda2          8:2    0 19.5G  0 part 
  ├─rhel-root 253:0    0 17.5G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
sdb             8:16   0   20G  0 disk 
└─storage-vo  253:2    0  100M  0 lvm  /juanzu
sdc             8:32   0   20G  0 disk 
sr0            11:0    1  3.5G  0 rom  /media/cdrom

扩容逻辑卷

[root@localhost ~]# umount /juanzu
[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
[root@localhost ~]# lvextend -L 150M /dev/storage/vo 
  Rounding size to boundary between physical extents: 152.00 MiB
  Extending logical volume vo to 152.00 MiB
  Logical volume vo successfully resized
[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/25688 files (9.1% non-contiguous), 8896/102400 blocks
[root@localhost ~]# resize2fs /dev/storage/vo 
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/storage/vo to 155648 (1k) blocks.
The filesystem on /dev/storage/vo is now 155648 blocks long.

[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  144M  1.6M  132M   2% /juanzu
[root@localhost ~]# 

缩小逻辑卷

[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
   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值