How to migrate active Linux to VirtualBox

This is for discussing general topics about how to use VirtualBox.

How to migrate active Linux to VirtualBox

Postby micsame » 7. Oct 2009, 12:14

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
micsame
 
Posts: 7
Joined: 6. Oct 2009, 11:40
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux

Re: How to migrate active Linux to VirtualBox

Postby Sasquatch » 7. Oct 2009, 12:23

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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: How to migrate active Linux to VirtualBox

Postby micsame » 7. Oct 2009, 13:14

ok i will try

/Michael
micsame
 
Posts: 7
Joined: 6. Oct 2009, 11:40
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux

Re: How to migrate active Linux to VirtualBox

Postby micsame » 7. Oct 2009, 14:09

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
micsame
 
Posts: 7
Joined: 6. Oct 2009, 11:40
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux

Re: How to migrate active Linux to VirtualBox

Postby Sasquatch » 7. Oct 2009, 14:12

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?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: How to migrate active Linux to VirtualBox

Postby micsame » 7. Oct 2009, 15:00

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
micsame
 
Posts: 7
Joined: 6. Oct 2009, 11:40
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux

Re: How to migrate active Linux to VirtualBox

Postby Sasquatch » 7. Oct 2009, 15:09

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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: How to migrate active Linux to VirtualBox

Postby micsame » 8. Oct 2009, 09:42

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
Attachments
Screenshot-ns5-img - File Browser.png
Screenshot-ns5-img - File Browser.png (86.12 KiB) Viewed 8007 times
micsame
 
Posts: 7
Joined: 6. Oct 2009, 11:40
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux

Re: How to migrate active Linux to VirtualBox

Postby micsame » 8. Oct 2009, 09:49

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
micsame
 
Posts: 7
Joined: 6. Oct 2009, 11:40
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux

Re: How to migrate active Linux to VirtualBox

Postby Sasquatch » 8. Oct 2009, 10:12

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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: How to migrate active Linux to VirtualBox

Postby micsame » 8. Oct 2009, 11:35

Hi Sasquatch

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

/Michael
micsame
 
Posts: 7
Joined: 6. Oct 2009, 11:40
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Linux


Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 14 guests