fedora 23 lvm2格式 根目录磁盘空间不足 扩容方法
成功将根目录从20G扩容到47G,记录一下步骤:
格式是lvm2
$ df -lh
Filesystem Size Used Avail Use% Mounted on
devtmpfs 5.7G 0 5.7G 0% /dev
tmpfs 5.7G 26M 5.7G 1% /dev/shm
tmpfs 5.7G 1.5M 5.7G 1% /run
tmpfs 5.7G 0 5.7G 0% /sys/fs/cgroup
/dev/mapper/fedora-root <span style="color:#ff0000;">47</span>G 15G 30G 34% /
tmpfs 5.7G 68K 5.7G 1% /tmp
/dev/sda5 488M 236M 218M 52% /boot
tmpfs 1.2G 4.0K 1.2G 1% /run/user/971
/dev/mapper/fedora-home <span style="color:#ff0000;">197</span>G 47G 141G 25% /home
tmpfs 1.2G 16K 1.2G 1% /run/user/1000
$ vgdisplay
--- Volume group ---
VG Name fedora
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 318.77 GiB
PE Size 4.00 MiB
Total PE 81606
Alloc PE / Size 81605 / 318.77 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID XckxJ7-6CfX-zxJi-zoUq-xBOK-epVz-BQk1Ss
1. 从别的目录切一块空间出来,我这里是从/home切出来27G
umount -v /home #取消挂载,必须
e2fsck -ff /dev/mapper/fedora-home #这里是检查磁盘,5步必须都pass
resize2fs /dev/mapper/fedora-home 197G #这里的197G是指剩下的空间大小
lvreduce -L -27G /dev/mapper/fedora-home #这里的27G是指切下来的空间大小
mount -v /home #重新挂载回来
2. 把别的地方切下来的空间添加到根目录去
lvextend -L+27G /dev/mapper/fedora-root #27G加到根目录去
resize2fs /dev/mapper/fedora-root #生效