Page 1 of 1

How to migrate active Linux to VirtualBox

Posted: 7. Oct 2009, 12:14
by micsame
Hi,

I can see that there are many guides to convert winxp(physical) to virtualbox.

But i can't see any on how to convert a running Linux to a virtualbox.

Do any of you know if there is a guide or know how to do it.

Thanks.

/Michael

Re: How to migrate active Linux to VirtualBox

Posted: 7. Oct 2009, 12:23
by Sasquatch
The method is fairly the same. It's all about getting the data from one system to another. CloneZilla can be used, but other systems work just as well. The only thing you have to do after the migration, is let Linux generate new interface names, because the name is bound by MAC address. In debian based systems for example, removing /etc/udev/rules.d/70-persistent-net.rules, and reboot, would be enough.

Re: How to migrate active Linux to VirtualBox

Posted: 7. Oct 2009, 13:14
by micsame
ok i will try

/Michael

Re: How to migrate active Linux to VirtualBox

Posted: 7. Oct 2009, 14:09
by micsame
Hi

i have converted my raw image

michael@michael:~$ VBoxManage convertdd raw.img raw.vdi
VirtualBox Command Line Management Interface Version 3.0.6
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Converting from raw image file="raw.img" to file="raw.vdi"...
Creating dynamic image with size 36830752768 bytes (35125MB)...

and added it to virtualbox and booted up and logged in, but it is mounted as readonly how to make it read/write?

/Michael

Re: How to migrate active Linux to VirtualBox

Posted: 7. Oct 2009, 14:12
by Sasquatch
What do you mean, 'mounted as read-only'? Is the file writable for your user? Does the UUID of the file system still match that noted in your fstab? Tried recovering some things using a live CD?

Re: How to migrate active Linux to VirtualBox

Posted: 7. Oct 2009, 15:00
by micsame
Thank you for youre fast replyes Sasquatch

when i booted the first time with the "new" vdi file, there was alot of errors. Finaly i logged in whith the root user and tryed to delete /etc/udev/rules.d/70-persistent-net.rules but i could not be done.

Then i booted the system and then it run fsck and it return failed (code 4) and is now in a loop whith fsck.

I have also tryed to mount it as a 2nd harddisk on another virtual system
mount -t ext3 /dev/hdb /mnt/disk
and it fails


what i did on my physical debian was.
1. dd if=/dev/hda1 of=raw.img

and copy it over to my ubuntu whith is running my VirtualBox
then i did
2. VBoxManage convertdd raw.img raw.vdi

3. imported it to VirtualBox
4. created a new vm using the raw.vdi file.

i dont know how to tjeck the UUID when i cannot get it up and running.
my q is what have i done wrong.....

/Michael

Re: How to migrate active Linux to VirtualBox

Posted: 7. Oct 2009, 15:09
by Sasquatch
Well, you did that with a running system, from the running system itself. That's never a good idea. It's best to make an image of an offline OS. That's why I suggested CloneZilla. Another thing you can do, is tar it all from a live CD, copy it to the other system for example, boot the VM with a live CD, create a partition, format it and untar the file onto the new system. Then check the UUID with blkid.

Re: How to migrate active Linux to VirtualBox

Posted: 8. Oct 2009, 09:42
by micsame
Hi

now i have make'ed a clonezilla image of my server.

What to do next. I have attached a screenshot from my image folder there is allot of files.

I'am really lost now.

Should i VBoxManage convertdd hda1.ext3-ptcl-img.gz.aa somefile.vds
but what about the file named hda-mbr???

/Michael

Re: How to migrate active Linux to VirtualBox

Posted: 8. Oct 2009, 09:49
by micsame
I will try to add clonezilla to my virtualbox and boot up and then import my image, i have no idea if it will work.....

/Michael

Re: How to migrate active Linux to VirtualBox

Posted: 8. Oct 2009, 10:12
by Sasquatch
If you have a Windows machine on your network, you can put the CloneZilla image there and access it from the VM, else you need to install and configure Samba (or other means to access your Host for the image) and restore the image to the VM using the same CloneZilla ISO. You can't simply convert that CZ image to a VDI.

Re: How to migrate active Linux to VirtualBox

Posted: 8. Oct 2009, 11:35
by micsame
Hi Sasquatch

Thank you for you're support, that did the job.

/Michael