Resizing virtual disk image(VDI) with fixed size storage

Discussions related to using VirtualBox on Windows hosts.
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

Perryg wrote:Are you sure that the original file is corrupt, or missing the OS?
If you have a look again at this screen shot, you will find out that the original virtual disk is the first one((Windows) which is still fixed size storage. I have cloned it into about six other VDIs with using that command. However, I have only tried resizing 'Widnows2.vdi' from 20GB into 30GB. After resizing it, it became unallocated.
Image
The other VDIs are running well so far, but if I resizing them, they will be unallocated.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by Perryg »

Are you sure? I resize all the time and I have never had one fail. Maybe it was a fluke. Anyway it is your decision to make how you want to proceed.
Just make sure that the one you resize actually works before you do the command to resize it.

Oh and the vpcx and vhd sould just go away
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

Perryg wrote:Are you sure? I resize all the time and I have never had one fail. Maybe it was a fluke. Anyway it is your decision to make how you want to proceed.
Just make sure that the one you resize actually works before you do the command to resize it.

Oh and the vpcx and vhd sould just go away
You are quite sure that after reseizing vdi, it shouldn't be unallocated.
I am one hundred percent sure that reseizing vdi was successfully completed. However, it let virtual disk unallocated.

You want me to try reseizing another one of the other VDIs. If so, then what benefit I will get if I will end up with the same thing. Although I have still the original virtual disk file which I clone into any number of VDIs I need, and then I will resize them, but it is not worth a try.

What do you mean with that the vpcx and vhd should just go away?
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

Could anyone please at this splendid forum take some of his precious time out to really reply to me to finish this issue?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by Perryg »

What more can I tell you? I have given you a way to do this, but you question what I tell you to do. Here is a break down of the way I think you can finish this but you have to do it.

1) find the original *.vdi that you cloned and see if it will boot.

2) if it boots then you need to resize it, and see if it will boot again. If it does go to the next step.

3) now if you look you will see that the vdi indicates at the new size, but it will not reflect the new size in the guest. This is because all you have done at this point is make the virtual drive bigger.

4) this is where you use a helper program ( i use gparted ) to increase the primary partition to include the new space.

Note: I still think you should remove the cruft ( all of the stuff you have done ) to eliminate more problems or confusions, like the vhd, vpx, all the non-standared files ( Look at your own screen shots ).
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

Perryg wrote:What more can I tell you? I have given you a way to do this, but you question what I tell you to do. Here is a break down of the way I think you can finish this but you have to do it.

1) find the original *.vdi that you cloned and see if it will boot.

2) if it boots then you need to resize it, and see if it will boot again. If it does go to the next step.

3) now if you look you will see that the vdi indicates at the new size, but it will not reflect the new size in the guest. This is because all you have done at this point is make the virtual drive bigger.

4) this is where you use a helper program ( i use gparted ) to increase the primary partition to include the new space.

Note: I still think you should remove the cruft ( all of the stuff you have done ) to eliminate more problems or confusions, like the vhd, vpx, all the non-standard files ( Look at your own screen shots ).
Thanks a lot, but you don't think the VDI was unallocated after resizing it because the VDI was created while using old version ( V: 3.1. 4r57640.win).
Then, when I didn't find that 'resize' command was available in the old one, I have installed the new version (VirtualBox-4.3.6-91406-win), thne I have applied the command on the virtual hard disk created on the old one.
Then For instance,
First, I had ( V: 3.1. 4r57640.win) installed. Then, I have created a VM with a fixed size virtual hard disk(20GB). I have cloned the disk into another one to be dynamic virtual disk.
Then, when I didn't find that resizing succeeded, I have installed the new version (VirtualBox-4.3.6-91406-win), and I have resized the dynamic virtual disk.
After that, I found that VM whose dynamic disk was resized wasn't loaded, due no Windows installation found. The disk became unallocated. Thus, I guess that this is associated with working on two different version of VBox. (on the first old one, I have created VM with a fixed size Virtual disk, and I cloned it into another dynamic virtual disk )(on the the second new version, I have resized the dynamic virtual disk of VM created on the first one)

NOTE: If I had created another VM on the most recent version of VBox with a fixed size virtual disk, install a new window7, cloned fixed size virtual disk into a dynamic virsual disk to be resized later, I would have succeed.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by Perryg »

Do or do not, I have laid out a path and it is up to you if you want to take it or not.
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

Perryg wrote:Do or do not, I have laid out a path and it is up to you if you want to take it or not.

Thanks a lot,

Yes, now it worked well.

NOTE: I have followed your steps step by step:
1- I clonded the original fixed size virtual disk(windows.vdi) whose size was 20GB into another dynamic size virtual disk(windows5.vdi).(screenshot below)

Image
2- I have booted VM from Windows5.vdi, and it loaded well.

3- I have resized the Windows5.vdi created from cloning the fixed 20GB disk to be 30GB(screenshot above)

4- Then a 10GB unallocated space added to windows5.vdi.

Now, my last enquiry befor marking this thread as answred, can I let that 10GB unallocated is unshown( can I delete it). Yes, I know its size(10GB) will not be accounted from my host physical drive until I partition it.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by Perryg »

What was the point of resizing the drive if you were not going to use it?

The last step above will increase the primary partition to include the new "unallocated" portion of the drive and then you will have and be able to use 30GB instead of 20GB you have now.
Place the gparted live cd in the guests virtual cd drive and boot the guest. You will see the space at the last of the primary partition and you can "grow" it to take the space.
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

Perryg wrote:What was the point of resizing the drive if you were not going to use it?

The last step above will increase the primary partition to include the new "unallocated" portion of the drive and then you will have and be able to use 30GB instead of 20GB you have now.
Place the gparted live cd in the guests virtual cd drive and boot the guest. You will see the space at the last of the primary partition and you can "grow" it to take the space.

Thanks a lot,
Yes, I am going to use it. But I want only to know if I have partitioned that 10GB unallocated, I can let this 10GB added recently get back to the host drive if I wish.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by Perryg »

I shudder about telling you this because it probably is just going to confuse you more, but the area of the drive that you call unallocated is not taking any bytes from the host drive yet. Because it is dynamic it is unused until needed. If you need to reclaim some host drive space clean up the cruft as I have been preaching for some time. These files you created are each 20GB in size.
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

Perryg wrote:I shudder about telling you this because it probably is just going to confuse you more, but the area of the drive that you call unallocated is not taking any bytes from the host drive yet. Because it is dynamic it is unused until needed. If you need to reclaim some host drive space clean up the cruft as I have been preaching for some time. These files you created are each 20GB in size.
Thanks a lot,
Yes, I realise that the unallocated space will not be discounted from my host drive unless partitioned. Thus, I was asking if I had partitioned, wanted to reclaim that space partitioned, could I have been doing?
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

mpack, could you please reply to me about these points to finish this issue :) ?

mpack wrote:There is no problem renaming "windows1" to "windows1.vdi", except that you can't do it while it's registered in VBox - you should unregister the VDI, rename it, then add it back.
I really have tried renaming the windows1 to 'windows1.vdi' by clicking on its properties, and then putting 'vdi' in the end of file name. Thus, I got windows.VDI. However, whenever I open 'windows1.vdi' renamed, I found an error.
Failed to open the hard disk file D:\Users\Mohammad\.VirtualBox\HardDisks\windows1.all files.vdi.

Cannot register the hard disk 'D:\Users\Mohammad\.VirtualBox\HardDisks\windows1.vdi' {6b49ccfb-44f5-4a6e-bc53-32da8d6abd7e} because a hard disk 'D:\Users\Mohammad\.VirtualBox\HardDisks\windows1' with UUID {6b49ccfb-44f5-4a6e-bc53-32da8d6abd7e} already exists.

Result Code: E_INVALIDARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {fafa4e17-1ee2-4905-a10e-fe7c18bf5554}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)


.
Resizing is supported for dynamic VDI and VHD. If you give it an unsupported format it will tell you, as you've already seen. If the command includes the modifier "--format VDI" then the resulting format will be VDI. The extension you put on the end of the filename does not determine (or even truly indicate) file format. Putting the wrong extension on a file could however be confusing for you in the future.
I am sorry to say I don't agree with you about that the extensioin I put on the end of the filename doesn't determine file format. On the contrary, it does, however the "--format VDI" modifier doesn't do anything at all. I have really tried running that command many times, even I have tried running that command without putting the extension on the end of the filename. However, I have put '--format VDI' modifier. Thus, I got a output filename such what is in this screenshot below:(it is only shown if I choose file type 'all files'.

Image

Also, I have tired:
'VBoxManage clonehd <D:\Users\Mohammad\.VirtualBox\HardDisks\windows.vdi D:\Users\Mohammad\.VirtualBox\HardDisks\windows2.vdi --format VDI
i got VDI

'VBoxManage clonehd <D:\Users\Mohammad\.VirtualBox\HardDisks\windows.vdi D:\Users\Mohammad\.VirtualBox\HardDisks\windows3.VHD --format VDI --variant Standard
I got VHD:

'VBoxManage clonehd <D:\Users\Mohammad\.VirtualBox\HardDisks\windows.vdi D:\Users\Mohammad\.VirtualBox\HardDisks\windows4.Vhdx --format VDI --variant Standard

I got VHDX:

Look at the screenshot below:
Image

Finally, I see that your VM is still using the obsolete v3.x folder structure, or some nasty hybrid. You should look to correct this soon. Cloning the VM (as opposed to the VDI) is the easiest way.
I don't know what is meant with that, but I have the most recent version of VBox
Image

If you mean with structure folder C:\Program Files\Oracle\VirtualBox', I would be saying that the old one was 'C:\Program Files\sun\Oracle\VirtualBox'

However, If you mean with sturcture folder with where Virtualbox program saves its data, I would be saying that the old one is 'D:\Users\Mohammad\.VirtualBox\HardDisks, and when I have installed the new version, the same path was still until I have created a new VM, then another path was created in D:\Users\Mohammad\VirtualBox VMs\Windows 7 64Bit.

Note: I now have two different folders for virtualBox program on my host windows existing user account.
'D:\Users\Mohammad\.VirtualBox
D:\Users\Mohammad\VirtualBox VMs
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 virtual disk image(VDI) with fixed size storag

Post by mpack »

File structures used by VirtualBox have been discussed many times, and is also described in the user manual.
a cooperator
Posts: 85
Joined: 3. Feb 2014, 07:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7
Location: Hadramawt -Yemen

Re: Resizing virtual disk image(VDI) with fixed size storag

Post by a cooperator »

mpack wrote:File structures used by VirtualBox have been discussed many times, and is also described in the user manual.

Thanks a lot,

But I think that my inquiries are a little bit different. They were questioned according to your reply. In other words, I found the opposite for what you have said. So, I kindly request you to take some of your precious time out to reply to me.
Post Reply