Existing harddisk to .vdi file

This is for discussing general topics about how to use VirtualBox.
Post Reply
cyberclaus
Posts: 5
Joined: 15. Oct 2010, 16:04
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Linux, Win7, Win XP

Existing harddisk to .vdi file

Post by cyberclaus »

Hi,

I'm useing VBox on a Mac. And I still have on older Linux computer. This I would now to turn off. But in case of .... I thought by myself: Saving the entire Linux harddisk to an .ISO-file and then convert it to an .vdi file (which is used in VBox). Can this file be processed by VBox? How can I convert it? Has anyone of you out there an information for me?

Thanks in advance

Greets
cyberclaus
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Existing harddisk to .vdi file

Post by Perryg »

ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, OSX
Location: U S of A

Re: Existing harddisk to .vdi file

Post by ChipMcK »

Wow, Perryg has quite a list!

Important item: the source is linux

So P2V tool for linux is required, such as VMware vCenter Converter Standalone, which has a version for linux, http://downloads.vmware.com/d/info/data ... dalone/4_0.

I have used the Windows version of the tool. Got it right on 2nd try. Disk2VHD (Windows only) is easier, http://technet.microsoft.com/en-us/sysi ... 56415.aspx

best
cyberclaus
Posts: 5
Joined: 15. Oct 2010, 16:04
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Linux, Win7, Win XP

Re: Existing harddisk to .vdi file

Post by cyberclaus »

Thank you for your answers.

I tried the VMWare Converter but failed. It recognized the lokal (Linux = Source) computer but not the Mac (Destination) in the net. (A general system error occured.) No idea where and what.

Isn't there another way to convert it. My problem is time - that I don't have. I will have the Linux harddisk here for a longer period of time but not the Linux computer. From next week on can I only connect the harddisk via an USB set to the Mac. I thought to manage all that on the Mac.

I appreciate all help I can get.

Thanks
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: Existing harddisk to .vdi file

Post by mpack »

Then you have to do it the slow way: use the Linux utility "dd" to copy an image of your disk to a file. Of course this image will be the same size as the original disk, so you'll need an even larger disk to store it (possible USB external, though that will slow things down by x4 or more). Once you have the image you can use "VBoxManage convertfromraw <inputfilename> <outputfilename.vdi>" - see the VBox user manual for exact syntax, but don't worry about the other options since the defaults are fine for you.

You should be warned also that the above procedure changes the UUID of the drive, which causes some Linux installations to fail to boot. You would have to modify your boot script to identify the boot disk using its new UUID (sorry about inaccurate terminology, though I know in vague terms what needs to be done, I'm not a regular Linux user).
cyberclaus
Posts: 5
Joined: 15. Oct 2010, 16:04
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Linux, Win7, Win XP

Re: Existing harddisk to .vdi file

Post by cyberclaus »

Thank you very much.

All you beskribed worked well !!!

But ....

The new virtual box refuse to boot. FATAL: No bootable medium found! System halted.

Has anyone a hint for me?


Greets
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: Existing harddisk to .vdi file

Post by mpack »

That means it didn't go as well as you hoped. Bear in mind that the VBox "convertfromraw" feature is extremely dumb: it'll basically wrap a VDI header around whatever you give it, so the fact that it seemed to succeed is no guarantee that it did anything sensible. The main thing to be sure of is that when you dd the original drive you image the entire disk, and not just the root partition. A Linux partition isn't bootable on its own.
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, OSX
Location: U S of A

Re: Existing harddisk to .vdi file

Post by ChipMcK »

I think that is a reference to GRUB partition
There are a number of threads about getting GRUB installed afterwards, some dealing with raw vmdk files; I do not recall more detail, but they are shattered across the forums

best
cyberclaus
Posts: 5
Joined: 15. Oct 2010, 16:04
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Linux, Win7, Win XP

Re: Existing harddisk to .vdi file

Post by cyberclaus »

mpack, you're absolutely right.

But to do this do I need another (bigger) harddisk. I'm gonna try and report later this or next week.

Thanks alot.
cyberclaus
Posts: 5
Joined: 15. Oct 2010, 16:04
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Linux, Win7, Win XP

Re: Existing harddisk to .vdi file

Post by cyberclaus »

Okey, here I'm back - smiling -

First I shrank the partitons and copied every partiton to a new smaller disk - each with dd. Then I tock dd over the whole disk and created one file of that. The Vbox-Tool created the vdi-file. All in 3 or 4 hours.

Lilo had some trouble and refused to boot. I booted with a dvd (kernel) and switched then to the disk. I had no luck with Lilo and so I changed to Grub. This workes fine.

My old Linux runs now in a box - the same way it did before. That's what I wanted.

Thank you all guys.
Winipulator
Posts: 25
Joined: 24. Oct 2010, 03:37
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, Windows XP, Windows 98, DOS

Re: Existing harddisk to .vdi file

Post by Winipulator »

This is an interesting thread. I've dealt with a similar issue but took a slightly different approach.

Remember the old PowerQuest software called Drive Image? I converted the DOS rescue floppies to a bootable ISO, burned it to CD, used it to copy my C: drive to PQI files onto a different partition (using maximum compression, the files were altogether much smaller than the partition being copied). Then I went back into Windows, put those PQI files inside the same ISO with an ISO editor. I then used the ISO in a VirtualBox DOS VM to load up Drive Image, and extracted the PQI files to the VirtualBox VDI. Then I created a new Windows XP VM and used the VDI created in the DOS VM with it. Its bootable on its own and ran perfectly. You can download my ISO from my blog and read more details on it. IDK if I'm allowed to post links here so I won't risk it, so just google my name to find my blog. All you need is my ISO, an ISO editor, your own Drive Image floppies, as its a commercial program and I can't provide them with the ISO.

My solution does involve a few steps. But the results are great. Hopefully one day, VirtualBox will provide native PQI support.
Post Reply