I have been struggling with the feature of export / import appliance for a couple of days now and every time it failed and my frustration grew. The problem i had was that my guest system couldn't find its partitions after import.
Finally i found the issue, it was due to that my guest OS(openSUSE) called the partition by name ID instead of with device name, the ID was unique to the machine being exported thus changed for the new imported machine.
Below you can see how i did to get it to work.
Exporting/Importing Linux appliance in VirtualBox partition Problem
Have you tried to export and import Linux appliances without success?
Well i might have the solution for you.
This has been tested on VirtualBox 2.2.4 with openSUSE as guest configured for server usage.
To make this work you must change how the boot loader calls the partitions upon startup. It seems the common behavior these days is to call the partitions by ID and thus the problem with exporting/importing Linux appliances for now on VirtualBox.
What we are going to do is to change from using ID to Device in our Linux guest.
1. Start your system in 'init 3' mode, in openSUSE you already boot into 'init 3' when you have configured your system to act as a server during installation, on other systems i don't know how to do this but it should be easy to find in your system documentation.
2. Login with an account with administrations privileges on your Linux guest.
3. Find out what device name your partitions have and write them down properly, any mistake and the machine might not boot again.
# fdisk -l
Disk /dev/sda: ...
Device Boot Start End Blocks Id System
1 1 65 522081 82 Linux swap / Solaris
2 * 66 1566 12056782+ 83 Linux
As we can see my disk is called sda and i have 2 partitions, the needed partition numbers in my case are 1 & 2, you can directly translate the 1 & 2 to your device name under /dev/, i have sda1 & sda2 where sda1 is the swap(1) and sda2 is the boot(2) marked with a * as shown above.
4. Now we should edit the menu.lst under /boot/grub/ and change disk information. Look for 'root=...' and 'resume=...' on rows starting with 'kernel' should be more than than one of each.
# nano /boot/grub/menu.lst
For saftey edit just thoose for normal boot first and try if it works, if not you can go to safe mode and continue editing the menu.lst file again.
This is what i found:
root=/dev/disk/by-id/ata-VBOX_HARDDISK_VB49c304d2-7e24e06f-part2
resume= /dev/disk/by-id/ata-VBOX_HARDDISK_VB49c304d2-7e24e06f-part1
The 'root' is the actual boot partition that is mounted as / and 'resume' is the swap partition.
This is what i changed them to, based on the output above:
root=/dev/sda2
resume=/dev/sda1
Save your file.
Edit*
One thing i missed was that you need to do the same procedure with the /etc/fstab file, you will be able to boot without editing this but you get some errors at boot, so i recommend editing this file to and just replace following data same way as above.
From:
/dev/disk/by-id/ata-VBOX_HARDDISK_VB49c304d2-7e24e06f-part1 swap ...
/dev/disk/by-id/ata-VBOX_HARDDISK_VB49c304d2-7e24e06f-part2 / ...
To:
/dev/sda1 swap ...
/dev/sda2 / ...
*Edit
5. Reboot your virtual machine and try to boot on the menu alternative you just edited, your system should boot as normal and you should be able to use the appliance feature of VirtualBox.
Appliance Imp/Exp no partition on Linux guest - Solution
-
soulskater
- Posts: 17
- Joined: 24. Dec 2007, 23:45
-
soulskater
- Posts: 17
- Joined: 24. Dec 2007, 23:45
Re: Appliance Imp/Exp no partition on Linux guest - Solution
I have updated the information above to reflect all changes that should be done before using the appliance feature with Linux.
This will be posted on my blog to later on.
/Marcus
This will be posted on my blog to later on.
/Marcus