扩容逻辑卷&&缩小逻辑卷&&删除逻辑卷

扩容逻辑卷

  1. umount /test
  2. lvextend -L 290M /dev/storage/vo
  3. e2fsck -f /dev/storage/vo
  4. resize2fs /dev/storage/vo or xfs_growfs /dev/storage/vo
  5. mount /dev/storage/vo /test

缩小逻辑卷

  1. umount /test
  2. e2fsck -f /dev/storage/vo
  3. resize2fs /dev/storage/vo 120M
  4. lvreduce -L 120M /dev/storage/vo
  5. mount /dev/storage/vo /test

删除逻辑卷
6. umount /test and remove it from /etc/fstab
7. lvremove /dev/storage/vo
8. vgremove vg_name
9. pvremove

linux系统中完整删除逻辑卷、卷组、物理劵

删除逻辑卷前备份数据
逻辑卷删除顺序为逻辑卷、卷组、物理劵,不可颠倒

1、查看系统中当前的逻辑卷

[root@PC1linuxprobe /]# lvscan
ACTIVE ‘/dev/rhel/swap’ [2.00 GiB] inherit
ACTIVE ‘/dev/rhel/root’ [17.51 GiB] inherit
ACTIVE ‘/dev/vg1/lv1’ [100.00 MiB] inherit
ACTIVE ‘/dev/vg1/lv2’ [300.00 MiB] inherit

2、查看逻辑卷挂载情况
复制代码

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 18G 2.9G 15G 17% /
devtmpfs 985M 0 985M 0% /dev
tmpfs 994M 140K 994M 1% /dev/shm
tmpfs 994M 8.8M 986M 1% /run
tmpfs 994M 0 994M 0% /sys/fs/cgroup
/dev/sda1 497M 119M 379M 24% /boot
/dev/sr0 3.5G 3.5G 0 100% /run/media/root/RHEL-7.0 Server.x86_64
/dev/mapper/vg1-lv2 283M 2.1M 262M 1% /lvmounttest

复制代码

3、卸载逻辑卷

umount /lvmounttest

4、删除逻辑卷
复制代码

[root@PC1linuxprobe /]# lvscan
ACTIVE ‘/dev/rhel/swap’ [2.00 GiB] inherit
ACTIVE ‘/dev/rhel/root’ [17.51 GiB] inherit
ACTIVE ‘/dev/vg1/lv1’ [100.00 MiB] inherit
ACTIVE ‘/dev/vg1/lv2’ [300.00 MiB] inherit
[root@PC1linuxprobe /]# lvremove /dev/vg1/lv1
Do you really want to remove active logical volume lv1? [y/n]: y
Logical volume “lv1” successfully removed
[root@PC1linuxprobe /]# lvremove /dev/vg1/lv2
Do you really want to remove active logical volume lv2? [y/n]: y
Logical volume “lv2” successfully removed
[root@PC1linuxprobe /]# lvscan
ACTIVE ‘/dev/rhel/swap’ [2.00 GiB] inherit
ACTIVE ‘/dev/rhel/root’ [17.51 GiB] inherit

复制代码

5、删除卷组
复制代码

[root@PC1linuxprobe /]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “rhel” using metadata type lvm2
Found volume group “vg1” using metadata type lvm2
[root@PC1linuxprobe /]# vgremove vg1
Volume group “vg1” successfully removed
[root@PC1linuxprobe /]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “rhel” using metadata type lvm2

复制代码

6、删除物理劵
复制代码

[root@PC1linuxprobe /]# pvscan
PV /dev/sda2 VG rhel lvm2 [19.51 GiB / 0 free]
PV /dev/sdb lvm2 [20.00 GiB]
PV /dev/sdc lvm2 [20.00 GiB]
PV /dev/sdd lvm2 [20.00 GiB]
Total: 4 [79.51 GiB] / in use: 1 [19.51 GiB] / in no VG: 3 [60.00 GiB]
[root@PC1linuxprobe /]# pvremove /dev/sdb /dev/sdc /dev/sdd
Labels on physical volume “/dev/sdb” successfully wiped
Labels on physical volume “/dev/sdc” successfully wiped
Labels on physical volume “/dev/sdd” successfully wiped
[root@PC1linuxprobe /]# pvscan
PV /dev/sda2 VG rhel lvm2 [19.51 GiB / 0 free]
Total: 1 [19.51 GiB] / in use: 1 [19.51 GiB] / in no VG: 0 [0 ]

复制代码

总结,完整删除逻辑卷步骤:

卸载,示例:umount /mountpoint
删除逻辑卷,示例:lvremove /dev/vgname/lvname
删除卷组,示例:vgremove vgname
删除物理劵,示例:pvremove /dev/disk*

注:

逻辑卷部署顺序:物理劵→卷组→逻辑卷
逻辑卷删除顺序:逻辑卷→卷组→物理劵
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值