Page 1 of 1

Expanding a VDI

Posted: 15. Jul 2008, 10:18
by pek
Sorry if this has been answered before, I did not know how to look for it (I'm not even sure if the title is appropriate).

Anyway, my problem is that I assumed (without reading anything) that "Dynamically expanding image" meant that I could expand the hard disk whenever I wanted. After reading the documentation, I was far out.

So now I have a windows guest with only 4GB of disk space. Is there any way of... duplicating the image and expanding the new at the same time? Or do I have to create a new guest from the beggining?

Thank you in advance,
Panagiotis

Posted: 15. Jul 2008, 12:07
by TerryE
Panagiotis, you are currently unable to expand the capacity of a VDI once you've created it. When you can easily do is to create another larger VDI and use a utility to copy your small partition from VDI A to the larger partition on VDI B. The latest version of the Gparted tools will do this for you and you can download a liveCD ISO from the Internet. You just attach this as your CD-ROM, change would order to boot from it and do a partition copy. As I said, the latest version supports NTFS.

The standard one that I download uses 32 bit graphic depth, and so comes up in console mode. I personally don't care because I prefer the console version, but this isn't helpful for the average user. I'm doing a tutorial on VDI management which I am hoping to post in first draft today or tomorrow. If you don't mind waiting, then this will give you must what you're looking for.

Posted: 15. Jul 2008, 12:24
by pek
Thank you very much for your quick reply. I'll try working with the tools you told me (I also don't have problem using terminals) and if I can't solve it I wait for your tutorial.

In any case, I would really appreciate you posted your link once your have uploaded it, or tell me where to look for it.

Once again, thank you.

Posted: 15. Jul 2008, 13:10
by pek
Well, what do you know! It has a GUI by default.. ;)

When you said copy a partition you meant Menu -> Partition -> Copy (Ctrl+C) and then go to the secondary hdd and Menu -> Partition -> Paste ? And after that? I resize it to fit all the 10 GB of the image I created? The small image A has a little less than 4GB, there is an extra unpartitioned space (I think for swap or bootloader, or something like that). How do I copy that too?

But I have a greater problem, when I tried applying my changes (Copy and then resize to 10GB) there where a lot cluster failures. And GParted said that it won't make any changes until they where fixed.

I have no idea what caused those failures, the guest machine works fine. So I think I'll wait for your tutorial after all ;)

P.S. I hope you include this in a troubleshoot area ;)

Posted: 15. Jul 2008, 13:30
by TerryE
Go into a command prompt on your guest and do a chkdsk /F C: and reboot the VM. This will make sure that your NTFS is healthy. You need to have a clean partition before you try to copy it.

Posted: 16. Jul 2008, 10:05
by pek
Well, chkdsk /F C: indeed did the trick with the failures, so I carried on with these steps:
Create a 10GB hard disk image
Mount the 10GB image as a primary slave
Copy master disk partition
Paste to slave disk partition
Resize the pasted partition to fill all the 10GB
Exit
Releases mounted 10GB
Attach to a new guest
Run guest
??? -> Only a command prompt with the cursor on the top left appears and nothing is loading. I'm guessing that the boot loader is messed up.

Any further suggestions?
You have been very helpful, thank you.

Posted: 16. Jul 2008, 16:45
by TerryE
If you've fixed the NTFS and done a successful copy, then the issue is to do with the MBR. There are some useful discussions on the Gparted Forum. The first 440 bytes of this is a small bootstrap which in the case of Windows OSs understand enough about NTFS to locate and load the NTLDR from the root partition. The NTLDR then takes over and does the initial boot sequence eventually loading NTOSKRNL.EXE and HAL.DLL from the Windows System directory. These two comprise the NT kernel and they complete the load of Windows.

Gparted doesn't set up that bootstrap. The easiest way to set it up is to mount your WinXP media DVD (instead of GParted) and boot off this. The fixmbr command will restore the MBR. Once you've done this you should be able to boot off your system.