Fixing device references after importing a Linux guest in Oracle Virtual Box

Share

I’ve run into issues with Oracle VirtualBox Virtual Appliances not being able to boot after being imported into a new host. I have a base openSUSE 11.3 image that I use to build all my App and DB servers. This post documents some steps I now take when exporting my base VM to minimize the pain of getting my new guests up and running:

First identify how physical partitions and devices are mapped to logical device names by listing the contents of /dev/disk/by-id:
$ ls -l
ata-VBOX_HARDDISK_VB4c05ce37-15844d37 -> ../../sda ata-VBOX_HARDDISK_VB4c05ce37-15844d37-part1 -> ../../sda1 ata-VBOX_HARDDISK_VB4c05ce37-15844d37-part2 -> ../../sda2 ata-VBOX_HARDDISK_VB4c05ce37-15844d37-part3 -> ../../sda3 scsi-SATA_VBOX_HARDDISK_VB4c05ce37-15844d37 -> ../../sda scsi-SATA_VBOX_HARDDISK_VB4c05ce37-15844d37-part1 -> ../../sda1 scsi-SATA_VBOX_HARDDISK_VB4c05ce37-15844d37-part2 -> ../../sda2 scsi-SATA_VBOX_HARDDISK_VB4c05ce37-15844d37-part3 -> ../../sda3
Also note the current mount points by listing the contents of your /etc/fstab file
$ cat /etc/fstab
/dev/disk/by-id/ata-VBOX_HARDDISK_VB4c05ce37-15844d37-part1      swap /dev/disk/by-id/ata-VBOX_HARDDISK_VB4c05ce37-15844d37-part2      / /dev/disk/by-id/ata-VBOX_HARDDISK_VB4c05ce37-15844d37-part3      /home
Steps to fix disk mappings on an oracle virtual box virtual machine / appliance after you import it:
  1. Boot your SUSE virtual machine and click on escape when the startup options screen comes up:
  2. Confirm you want to exit the graphical mode if asked
  3. When the GRUB boot options screen comes up select your default boot mode and press the letter “e”to edit this entry
  4. Using the notes from the original virtual machine you exported replace the current “root” device reference with your boot partition (the one mounted at “/”)
  5. You can optionally correct any additional device references in this line
  6. Once you are done with your changes press ENTER to exit this screen and then the letter “b” to boot
  7. To permanently fix this issue you will need to replace the physical device IDs in the /etc/fstab file (ie. map /dev/sda1 instead of the physical device ID to mount point /)
  8. You also will need to permanently correct the startup entries in your /boot/grub/grub.conf file by repeating the string replacements you performed in step four.

Summary: After reading this post you should be better prepared to smoothly export and import Linux virtual machines from your Oracle Virtual Box servers by being ready to correct any disk device reference issues in fstab and grub.conf

Questions and Comments: Please use the comment form on this post to send us your questions and comments, we look forward to hearing from you!

I’ve run into issues with Oracle VirtualBox Virtual Appliances not being able to boot after being imported into a new host. I have a base openSUSE 11.3 image that I use to build all my App and DB servers. This post documents some steps I now take when exporting my base VM to minimize the pain of getting my new guests up and running…

Tags: , , , , , , ,

Leave a Comment