HanG321 Blog

Raw Disk with VirtualBox, Win7 host, ubuntu guest

reference:

http://virtualization.sysprobs.com/access-physical-disk-virtualbox-desktop-virtualization-software
http://vbox.innotek.de/pipermail/vbox-users/2009-August/006868.html
http://ubuntuforums.org/showthread.php?t=951588
http://www.supergrubdisk.org/w/index.php5?title=Howto_Boot_Linux_only

Background:

Host: Windows 7 Ultimate 64 bit
Guest: ubunut 9.04 64 bit
VirtualBox: 3.0.8 (someone report 3.0.10 fail to access raw disk,maybe fix on .11/.12)
Harddisk: 4 virtual disks on LSI 8344ELP RAID controller

Disk /dev/sda: 42.9 GB, 42949410816 bytes
Disk /dev/sdb: 64.4 GB, 64424509440 bytes
Disk /dev/sdc: 763.7 GB, 763726135296 bytes
Disk /dev/sdd: 85.8 GB, 85899214848 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 5220 41929618+ 7 HPFS/NTFS
/dev/sdb1 1 7832 62910508+ 7 HPFS/NTFS
/dev/sdc1 2 92850 745809592+ f W95 Ext’d (LBA)
/dev/sdc5 2 84853 681573658+ 7 HPFS/NTFS
/dev/sdc6 84854 92850 64235871 7 HPFS/NTFS
/dev/sdd1 1 10013 80429391 83 Linux
/dev/sdd2 10014 10443 3453975 5 Extended
/dev/sdd5 10014 10443 3453943+ 82 Linux swap / Solaris

Create virtual disk for VirtualBox (VB)

– Manual, default at C:\Program Files\Sun\VirtualBox\doc, section 9.10 Using a raw host hard disk from a guest
– list all drive to ensure it drivename, e.g. PhysicalDrive[#|0,1,2,3]

C:\Program Files\Sun\VirtualBox>vboxmanage internalcommands listpartitions -rawd
isk \\.\PhysicalDrive0

VirtualBox Command Line Management Interface Version 3.0.8
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x07 0 /1 /1 1023/254/63 40946 63

– create rawdisk, e.g linuxhost.vmdk, winxp.vmdk…. , mkdir first if required.
(for me, I need to create all 4 drives, don’t know why, I expected only 0,3)

C:\Program Files\Sun\VirtualBox>vboxmanage internalcommands createrawvmdk -filename c:\Users\{YourUsername}\.VirtualBox\HardDisks\linux.vmdk -rawdisk \\.\PhysicalDrive3

VirtualBox Command Line Management Interface Version 3.0.8
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
RAW host disk access VMDK file c:\Users\{YourUsername}\.VirtualBox\HardDisks\linux.vmdk created successfully.

– Run VB as administrator (this make me confuse too, I am power user…yet, UAC isn’t turn off)
– Virtual Manager > add those created virutal disk files (*.vmdk)
– create a new virtual machine
System: uncheck “Enable IO APIC”
Harddisk:
Enable additional controller: SCSI (LsiLogic)

Hard Disks

SCSI Port 0:

winxp.vmdk (Normal, 40.00 GB)

SCSI Port 1:

win7.vmdk (Normal, 60.00 GB)

SCSI Port 2:

windata.vmdk (Normal, 711.28 GB)

SCSI Port 3:

linux.vmdk (Normal, 80.00 GB)

N.B. : only add winxp.vmdk & linux.vmdk, blank screen with (00:00:03.291 Guest Log: BIOS: Booting from Hard Disk…) on VB log (right click VM, show log..)

– turn on VM, with 4 drives, now got GRUB 21 error.
good, at least it got the disk now….

– download Super GRUB disk, mount it as CD-ROM
follow this link:
http://www.supergrubdisk.org/w/index.php5?title=Howto_Boot_Linux_only
unmount, reboot, RORA !

– one more thing, install linux Guest Additions, manual section 4.3
sudo sh ./VBoxLinuxAdditions-amd64.run