• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

7.2.3 缩小逻辑卷

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

相较于扩容逻辑卷,在对逻辑卷进行缩容操作时,其丢失数据的风险更大。所以在生产环境中执行相应操作时,一定要提前备份好数据。另外Linux系统规定,在对LVM逻辑卷进行缩容操作之前,要先检查文件系统的完整性(当然这也是为了保证我们的数据安全)。在执行缩容操作前记得先把文件系统卸载掉。

[root@linuxprobe ~]# umount /linuxprobe 第1步:检查文件系统的完整性。

[root@linuxprobe ~]# 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/74000 files (0.0% non-contiguous), 15507/299008 blocks 第2步:把逻辑卷vo的容量减小到120MB。

[root@linuxprobe ~]# resize2fs /dev/storage/vo 120M resize2fs 1.42.9 (28-Dec-2013) Resizing the filesystem on /dev/storage/vo to 122880 (1k) blocks. The filesystem on /dev/storage/vo is now 122880 blocks long. [root@linuxprobe ~]# lvreduce -L 120M /dev/storage/vo WARNING: Reducing active logical volume to 120.00 MiB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce vo? [y/n]: y Reducing logical volume vo to 120.00 MiB Logical volume vo successfully resized 第3步:重新挂载文件系统并查看系统状态。

[root@linuxprobe ~]# mount -a [root@linuxprobe ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/rhel-root 18G 3.0G 15G 17% / devtmpfs 985M 0 985M 0% /dev tmpfs 994M 80K 994M 1% /dev/shm tmpfs 994M 8.8M 986M 1% /run tmpfs 994M 0 994M 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 113M 1.6M 103M 2% /linuxprobe


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
7.2.4 逻辑卷快照发布时间:2022-02-03
下一篇:
7.2.2 扩容逻辑卷发布时间:2022-02-03
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap