查看卷组
[root@localhost home]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID bA7z4a-Fk9h-6QRM-MZPO-QFNs-xLd1-hy03P0
LV Write Access read/write
LV Creation host, time localhost, 2018-02-12 08:04:39 +0800
LV Status available
# open 2
LV Size 7.81 GiB
Current LE 2000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID tDDV4y-T573-5sd1-lHQW-k4Wv-xtQm-T9f5AI
LV Write Access read/write
LV Creation host, time localhost, 2018-02-12 08:04:40 +0800
LV Status available
# open 1
LV Size <872.18 GiB
Current LE 223278
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID EEipej-RzDH-200g-DOOG-AbMe-QICp-0MnI5e
LV Write Access read/write
LV Creation host, time localhost, 2018-02-12 08:04:41 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
删除卷组:
[root@localhost ~]# umount /dev/centos/home
[root@localhost ~]# lvremove /dev/centos/home
Do you really want to remove active logical volume centos/home? [y/n]: y
Logical volume "home" successfully removed
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <930.00g 872.18g
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID bA7z4a-Fk9h-6QRM-MZPO-QFNs-xLd1-hy03P0
LV Write Access read/write
LV Creation host, time localhost, 2018-02-12 08:04:39 +0800
LV Status available
# open 2
LV Size 7.81 GiB
Current LE 2000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID EEipej-RzDH-200g-DOOG-AbMe-QICp-0MnI5e
LV Write Access read/write
LV Creation host, time localhost, 2018-02-12 08:04:41 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
查看Type类型:
[root@localhost ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/centos-root xfs 52403200 27638408 24764792 53% /
devtmpfs devtmpfs 8095112 0 8095112 0% /dev
tmpfs tmpfs 8107004 0 8107004 0% /dev/shm
tmpfs tmpfs 8107004 459984 7647020 6% /run
tmpfs tmpfs 8107004 0 8107004 0% /sys/fs/cgroup
/dev/sda1 xfs 1038336 192292 846044 19% /boot
tmpfs tmpfs 1621404 0 1621404 0% /run/user/0
扩容:
[root@localhost ~]# lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 922.18 GiB (236079 extents).
Logical volume centos/root successfully resized.
[root@localhost ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 241744896
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 923G 27G 896G 3% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 450M 7.3G 6% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda1 1014M 188M 827M 19% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/0
这个是添加硬盘
[root@localhost /]# vgextend /dev/centos00 /dev/sde1
Physical volume “/dev/sde1” successfully created.
Volume group “centos00” successfully extended