Linux LVM逻辑卷管理(4)

4.对stu01和stu02都扩容8G,分别使用xfs_growfs和resize2fs在线调整大小。

[root@localhost ~]# lvextend -L +8G /dev/class/stu01 Size of logical volume class/stu01 changed from 25.00 GiB (6400 extents) to 33.00 GiB (8448 extents). Logical volume class/stu01 successfully resized. [root@localhost ~]# lvextend -L +8G /dev/class/stu02 Size of logical volume class/stu02 changed from 14.99 GiB (3838 extents) to 22.99 GiB (5886 extents). Logical volume class/stu02 successfully resized. [root@localhost ~]# xfs_growfs /dev/class/stu01 meta-data=/dev/mapper/class-stu01 isize=512 agcount=4, agsize=1638400 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=6553600, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=3200, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 6553600 to 8650752 [root@localhost ~]# resize2fs /dev/class/stu02 resize2fs 1.42.9 (28-Dec-2013) Filesystem at /dev/class/stu02 is mounted on /mnt/stu02; on-line resizing required old_desc_blocks = 2, new_desc_blocks = 3 The filesystem on /dev/class/stu02 is now 6027264 blocks long. [root@localhost ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 17G 927M 17G 6% / devtmpfs devtmpfs 901M 0 901M 0% /dev tmpfs tmpfs 912M 0 912M 0% /dev/shm tmpfs tmpfs 912M 8.7M 903M 1% /run tmpfs tmpfs 912M 0 912M 0% /sys/fs/cgroup /dev/sda1 xfs 1014M 143M 872M 15% /boot /dev/mapper/class-stu01 xfs 33G 33M 33G 1% /mnt/stu01 /dev/mapper/class-stu02 ext4 23G 44M 22G 1% /mnt/stu02 tmpfs tmpfs 183M 0 183M 0% /run/user/0 收缩 LVM 逻辑卷#

关于收缩 LVM 逻辑卷,可以参考上面的命令lvreduce。这会涉及到数据安全性问题,谨慎使用。

总结#

内容不多,但是还要实际操作才能了解。就是三步走,创建物理卷,创建卷组,创建逻辑卷,然后格式化并挂载使用。扩容的话,没有挂载使用,就正常扩,然后格式化挂载,已经挂载使用了,扩容后在线调整生效。还有下一篇关于磁盘配额。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/11717.html