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

This is for discussing general topics about how to use VirtualBox.
Post Reply
Lillo
Posts: 3
Joined: 10. Aug 2012, 12:26

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

Post 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
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

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

Post by mpack »

I refer the honorable gentleperson to previous discussions of the same problem, and urge particular attention to any mention of "gparted".
Lillo
Posts: 3
Joined: 10. Aug 2012, 12:26

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

Post 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.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

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

Post 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=
Lillo
Posts: 3
Joined: 10. Aug 2012, 12:26

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

Post 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?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

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

Post 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.
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

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

Post 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.
Post Reply