2021-07-04 linux学习-硬盘的高级操作(五)之LVM技术-缩小逻辑卷

缩小逻辑卷

一 同步信息

    1 查看挂载情况 df -hT|grep xiaofeng

[root@linuxprobe ~]# df -hT|grep xiaofeng
/dev/mapper/sonny-xiaofeng ext4      767M  2.5M  721M   1% /root/new_disk/lv/xiaofeng

    2 卸载逻辑卷   umount /dev/sonny/xiaofeng

[root@linuxprobe ~]# umount /dev/sonny/xiaofeng

    3 检查逻辑卷情况  e2fsck -f /dev/sonny/xiaofeng

[root@linuxprobe ~]# e2fsck -f /dev/sonny/xiaofeng
e2fsck 1.44.3 (10-July-2018)
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/sonny/xiaofeng: 11/204800 files (0.0% non-contiguous), 36617/819200 blocks

    4  同步信息,同步至300M   resize2fs /dev/sonny/xiaofeng 300M

[root@linuxprobe ~]# resize2fs /dev/sonny/xiaofeng 300M
resize2fs 1.44.3 (10-July-2018)
Resizing the filesystem on /dev/sonny/xiaofeng to 307200 (1k) blocks.
The filesystem on /dev/sonny/xiaofeng is now 307200 (1k) blocks long.

二 缩小逻辑卷,缩小至300M,此处需要按y+回车确认 lvreduce -L 300M /dev/sonny/xiaofeng

[root@linuxprobe ~]# lvreduce -L 300M /dev/sonny/xiaofeng
  WARNING: Reducing active logical volume to 300.00 MiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce sonny/xiaofeng? [y/n]: y
  Size of logical volume sonny/xiaofeng changed from 800.00 MiB (200 extents) to 300.00 MiB (75 extents).
  Logical volume sonny/xiaofeng successfully resized.

三 挂载验证

    1 挂载   mount -a

[root@linuxprobe ~]# mount -a

    2 查看挂载情况  df -hT|grep xiaofeng

[root@linuxprobe ~]# df -hT|grep xiaofeng
/dev/mapper/sonny-xiaofeng ext4      283M  2.1M  262M   1% /root/new_disk/lv/xiaofeng

    大功告成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鹅一只

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值