1
LVM调整分区大小
source link: https://bajie.dev/posts/20240124-lvm_resize/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
LVM调整分区大小
2024-01-24
1 分钟阅读
系统是xfs文件格式。/root空间不够了。必须对空间进行调整,悲剧的是xfs只能增加空间,不能缩减空间,必须曲线救国了。
查看一下,缺省有两个lvm的分区
/dev/mapper/centos-root 40G
/dev/mapper/centos-home 20G
只能减小home分区,再增大root分区了。
先备份home分区,并缩小到2G:
# yum -y install xfsdump
# xfsdump -f /home.xfsdump /home
please enter label for this dump session (timeout in 300 sec)
-> home
please enter label for media in drive 0 (timeout in 300 sec)
-> home
# umount /home
# lvreduce -L 2G /dev/mapper/centos-home
Do you really want to reduce home? [y/n]: y
然后扩充root分区:
# lvextend -L +18G /dev/mapper/centos-root
# xfs_growfs /dev/mapper/centos-root
最后恢复home分区
# mkfs.xfs -f /dev/mapper/centos-home
# mount /home
# xfsrestore -f /home.xfsdump /home
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK