Page 1 of 1

After modifyhd --resize, fdisk -l still shows old disk size

Posted: 10. Aug 2012, 12:39
by Lillo
I'm running CentOS 6.1 as guest on a Mac Snow Leopard host, using Virtual Box 4.1.18. Since I recently ran out of disk space in my guest, I decided to grow its disk, using

Code: Select all

vboxmanage modifyhd centos6.1.vdi --resize 102400
In fact, Virtual Box' GUI confirms that disk size has indeed doubled from 50 GB to 100 GB.

However, when I log in to CentOS and run fdisk -l as root, I still get

Code: Select all

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006702c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      256000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              32        6528    52171776   8e  Linux LVM
Note that /dev/sda's, my only disk's, size is still reported as 53.7 GB. Indeed, booting my VM into Parted Magic and using its Partition Editor I do not have any unallocated space available for creating new partitions.

From extensively searching the internet I got the impression that fdisk -l as well as gparted -l should show me the new available disk space immediately after resizing my vdi file. Isn't that correct? What did I do wrong?

Regards,
Olaf

Re: After modifyhd --resize, fdisk -l still shows old disk s

Posted: 10. Aug 2012, 13:42
by mpack
I refer the honorable gentleperson to previous discussions of the same problem, and urge particular attention to any mention of "gparted".

Re: After modifyhd --resize, fdisk -l still shows old disk s

Posted: 10. Aug 2012, 14:02
by Lillo
mpack wrote:I refer the honorable gentleperson to previous discussions of the same problem, and urge particular attention to any mention of "gparted".
Thank you, mpack, but I searched these forums and could not find anything of relevance to my current problem. Well, I take this as encouragement to try again.

Re: After modifyhd --resize, fdisk -l still shows old disk s

Posted: 10. Aug 2012, 16:11
by mpack
Also note that changing size using that method does not work if you use snapshots. Again, this can be found by searching, e.g. http://www.google.com/search?hl=en&as_q ... as_rights=

Re: After modifyhd --resize, fdisk -l still shows old disk s

Posted: 10. Aug 2012, 16:25
by Lillo
mpack wrote:Also note that changing size using that method does not work if you use snapshots. Again, this can be found by searching, e.g.
Yes, searching the forums for "gparted" led me to this as a possible explanation. I'm in the process of finding out if this fixes my problem. Thank you, mpack.

If this is a known deficiency, though, I cannot help but wonder why

Code: Select all

vboxmanage modifyhd foo.vdi --resize 100000
does not say so. Wouldn't it be preferable to have vboxmanage check whether the VM to be resized uses unmerged snapshots and bail out if so instead of sending users on a wild goose chase?

Re: After modifyhd --resize, fdisk -l still shows old disk s

Posted: 11. Aug 2012, 11:03
by mpack
Lillo wrote:I cannot help but wonder why [ the manual ] does not say so.
Perhaps an oversight, or perhaps the devs are too close to the subject and didn't realize that it wouldn't be obvious to everyone that resizing just the base VDI (foo.vdi) would not resize the entire snapshot chain.

Re: After modifyhd --resize, fdisk -l still shows old disk s

Posted: 11. Aug 2012, 16:12
by Martin
Lillo wrote:Wouldn't it be preferable to have vboxmanage check whether the VM to be resized uses unmerged snapshots and bail out if so instead of sending users on a wild goose chase?
Another reason is that you don't resize "the VM" but just a virtual harddisk. VBoxManage modifyhd just touches a plain vdi file which doesn't have information about existing snapshots.