virtualbox on raw disk partition

I’m trying to install WinblowsXP on a virtualbox installation. I copied the following cli command and ran it which finished successfully and created xp.vmdk in /win-XP (dev/sda14).


laptop:/home/tom/Documents # ls -l /win-XP
total 336
-rwxrwxr-x 1 root users 323072 2010-01-01 15:36 xp-pt.vmdk
-rwxrwxr-x 1 root users   1091 2010-01-01 15:36 xp.vmdk
laptop:/home/tom/Documents # 


VBoxManage internalcommands createrawvmdk -filename /win-XP/xp.vmdk -rawdisk /dev/sda -partitions 14 -relative -register

Here is the partitioning info:


GNU Parted 1.9.0
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: ATA ST9500420AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1086MB  1191MB  105MB   primary   ntfs            type=07
 2      1191MB  163GB   162GB   primary   ntfs            type=07
 3      163GB   500GB   337GB   extended                  boot, lba, type=0f
 5      163GB   164GB   337MB   logical   ext3            type=83
 6      164GB   198GB   34.4GB  logical   fat32           lba, type=0c
 7      198GB   207GB   8587MB  logical   ext3            type=83
 8      207GB   239GB   32.2GB  logical   ext3            type=83
 9      239GB   292GB   53.7GB  logical   ext3            type=83
10      292GB   297GB   4294MB  logical   linux-swap(v1)  type=82
11      297GB   334GB   37.6GB  logical   ext3            type=83
12      334GB   367GB   32.2GB  logical   ext3            type=83
13      367GB   479GB   113GB   logical   ext3            type=83
14      479GB   500GB   20.8GB  logical   fat32           lba, type=0c

When I start vbox (version from SunMicro) and click on new, then use existing disk, it won’t accept the installed image. I’ve read through the vbox manual (pdf) several times but find it somewhat confusing about the proper procedure to follow and the order of commands.

I don’t want to just try experimenting with the commands where partitions are concerned. Can anyone lead me to a step-by-step process? I’ve searched several forums and Googled for more info without success.

Dell studio 1745
Linux laptop 2.6.31.5-0.1-desktop #1 SMP PREEMPT 2009-10-26 15:49:03 +0100 x86_64 x86_64 x86_64 GNU/Linux
VirtualBox 3.1.2r56127

Thanks, Tom

Is there a reason you are trying to use a raw partition rather then a formated one.

What I did is simply make a partition formated ext4 Mounted it as /vm Thats where I pointed Vbox.

Additional information:

laptop:/home/tom/Documents # lsattr -a /win-XP*
lsattr: Inappropriate ioctl for device While reading flags on /win-XP/.
--------------- /win-XP/…
lsattr: Inappropriate ioctl for device While reading flags on /win-XP/xp.vmdk
lsattr: Inappropriate ioctl for device While reading flags on /win-XP/xp-pt.vmdk
laptop:/home/tom/Documents #

Should I assume that this partition is faulty and needs to be re-partitioned?

It is formatted, as fat32. That was my interpretation of the vbox installation manual section. Is that wrong?

Okay, I re-partitioned /dev/sda14 as ext3 with mount point as /vm. When I get to the “create new virtual machine” and click on ‘use existing hard disk’, it shows no file available. If I click on create new it creates the file in my home directory, not on /vm.

Which way do I go?

My understanding of a VM disk image in a partition is that it is exactly like a native install, you give over the whole partition to the OS and let it put whatever filesystem it wants on it. Therefore you don’t format or mount it at all in the host OS, but let the guest OS use the raw blocks on it. In case of XP, it would become a NTFS partition.

You would not get a tremendous speed improvement over a disk image in a host OS file, maybe a few percent.

Most people who want to do this are people trying to reuse an existing OS install. But trying to recycle an existing install, instead of running a fresh install, usually runs foul of M$'s hardware fingerprinting, and you may call to get to get a new validation key (sorry, I forgot the exact technical term for this). If you are going to do this, you might as well experiment with an image in a host OS file first.