resizing hdd with Gparted problem

Discussions related to using VirtualBox on Windows hosts.
Post Reply
PaoloA
Posts: 3
Joined: 8. Jan 2016, 11:33

resizing hdd with Gparted problem

Post by PaoloA »

Hello Everybody,
I have been trying to increase the size of my hdd for a while without success.
I have win 10 host and the guest is a Fedora 21 (with a dynamically allocatable 40 Gb hdd).

In order to resize I do:

VBoxmanage modifyhd fedora21.vdi --resize 80000

At this point on the manager the hdd results in about 80 Gb (good!)

I need to change the size of the partition, for this I use Gparted (running in virtualbox),
click on the "Resize/Move" option and apply it.

Notice: it takes about 1 sec to perfrom the resizing (isn't it too quick? my cpu is i7 2600).

When I relaunch the virtual machine and write: "df -h" the system tells me that the
hdd is still 40 Gb (with about 4 Gb free).

I thought I followed the instructions nicely, what might have gone wrong?
thank you very much,
Paolo
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: resizing hdd with Gparted problem

Post by mpack »

Sounds like you are using snapshots. You need to delete them all before the resize, alternatively you have to resize each snapshot VDI separately, preferably in sequence (you already did the base).

And no, resizing a partition in a few seconds is not too quick. If there's no copying to do then it's just an adjustment to a few guest OS data structures.
Biite
Posts: 13
Joined: 22. Nov 2014, 22:01
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10

Re: resizing hdd with Gparted problem

Post by Biite »

PaoloA wrote: When I relaunch the virtual machine and write: "df -h" the system tells me that the
hdd is still 40 Gb (with about 4 Gb free).
'df -h' shows your filesystems. If you resize a HDD and use GParted you only resize the partitions on it. If GParted recognizes your filesystem/volume manager it will probably resize it too.
My guess it that in this case your filesystem/volume manager is not recognized and only the partition is resized. E.g. if you use LVM only the LVM partition is resized, you have to use LVM tools to resize your PV's, VG's and LV's, and after that your filesystem.
PaoloA
Posts: 3
Joined: 8. Jan 2016, 11:33

Re: resizing hdd with Gparted problem

Post by PaoloA »

Thank you guys for the advices.
btw I have no snapshots.

Just to add some info: virtualbox is on a ssd (C), while the .vdi file is on a hdd (D).

@Biite
I suppose you are going in the right direction since the filesystem of the partition is lvm2,
however the procedure you are suggesting is not clear to me.

Could you please give me some more info about resizing " PV's, VG's and LV's, and after that your filesystem",
thanks!
Paolo
Biite
Posts: 13
Joined: 22. Nov 2014, 22:01
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10

Re: resizing hdd with Gparted problem

Post by Biite »

Just google for 'fedora 21 lvm resize' andere there's some guides tot be found.
It all really depends on your LVM configuration what steps to take
PaoloA
Posts: 3
Joined: 8. Jan 2016, 11:33

Re: resizing hdd with Gparted problem

Post by PaoloA »

Thank you! I solved the problem, I post here what I did:

increased size with: VBoxManage modifyhd Fedora21.vdi --resize 80000
Used Gparted (which did not work until I unchecked EFI, CLOCK and APIC option in System) to resize the partition to 80 Gb

pvresize /dev/sda2 (my hdd is sda2)
lvextend /dev/<volume-group>/<LV-name> -L +<size>G (where here instead of /dev/<volume-group>/<LV-name> I inserted what appears when doing df -h regarding the partition to be resized)
resize2fs /dev/<volume-group>/<LV-name>

bye
Paolo
Post Reply