我在VirtualBox中将Ubuntu 15.04作为来宾OS,并使用GParted LiveCD调整了VDI驱动器和其中的分区的大小。GParted可以正确看到新的大小(14.5 GB),但是在Ubuntu中仍然是旧的大小:
$ df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/zion--vg-root 7331536 7115864 0 100% /
none 4 0 4 0% /sys/fs/cgroup
udev 1013420 4 1013416 1% /dev
tmpfs 204912 448 204464 1% /run
none 5120 0 5120 0% /run/lock
none 1024556 0 1024556 0% /run/shm
none 102400 0 102400 0% /run/user
/dev/sda1 240972 136514 92017 60% /boot
overflow 1024 140 884 14% /tmp
编辑
输出parted -l
:
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 15.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 256MB 255MB primary ext2 boot
2 257MB 15.7GB 15.5GB extended
5 257MB 15.7GB 15.5GB logical lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/zion--vg-swap_1: 533MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 533MB 533MB linux-swap(v1)
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/zion--vg-root: 7764MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 7764MB 7764MB ext4
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0
has been opened read-only.
Error: Can't have a partition outside the disk!
正如评论中指出的那样,问题在于我的卷是LVM,而GParted不知道如何调整它的大小。解决方案是在GParted LiveCD上启动,然后运行以下命令:
# to find the name of the volume, /dev/zion-vg/root here
$ sudo lvdisplay
#to extend the volume (started at 15G, but had to bring it down to 13.9G since it had not enough size)
$ sudo lvextend -L13.9G /dev/zion-vg/root
#needed by resize2fs
$ sudo e2fsck -f /dev/zion-vg/root
#final resize
$ sudo resize2fs /dev/zion-vg/root
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句