家里的笔记本,安装 fedora 的时候根分区只留了 20G,而且没有对 home 单独分区。发现空间有些紧张,扩容一下。
# 卸载一个物理分区,数据记得提前备份好
sudo umount /dev/sda7
# 将空闲的分区拓展到 vg 中 vgextend - Add physical volumes to a volume group
# 可以通过 vgs 或者 vgdisplay 拿到 vg 的 name,这里是 fedora_bogon
sudo vgextend fedora_bogon /dev/sda7
# 把所有的空闲空间放到逻辑卷 lvextend - Add space to a logical volume
sudo lvextend -l +100%FREE /dev/fedora_bogon/root
# 此时分区还没有识别到扩容的空间,需要校正一下,我的分区是 ext4 的,使用resize2fs
# The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to
# enlarge or shrink an unmounted file system located on device. If the filesystem is
# mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel
# and the file system supports on-line resizing. (Modern Linux 2.6 kernels will support on-
# line resize for file systems mounted using ext3 and ext4; ext3 file systems will require
# the use of file systems with the resize_inode feature enabled.)
sudo resize2fs /dev/fedora_bogon/root
# 有些教程里提到 xfs_growfs,这个是针对 xfs 分区的,在我这并不适用。
# !!!非常重要 sudo vim fstab 检查一下开机挂载的文件系统是否都还在,否则重启会失败。切记。
原文:https://www.cnblogs.com/highgogo/p/13111371.html