virtualBox: raw partition access
2008-09-27 18:22Now i’m migrating from Windows XP to Ubuntu Linux. For some time I will need both OSes to work with minimal time to switch between. As solution, I decide to setup VirtualBox on Windows, and run Ubuntu inside virtual machine. This is quite common situation, but one detail is specifical: Ubuntu is alreday set up on separate hard drive partition. So I need to run VirtualBox virtual machine from “raw” partition.
The trick was simple — all steps described in VirtualBox User Manual, see chapter 9.9.
I done such steps:
(pathtovboxprogramfolder)\VBoxManage internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
which gives:
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x07 0 /1 /1 694 /239/63 5131 63
5 0x83 695 /1 /1 1023/239/63 9856 10508463
6 0x82 1023/1 /1 1023/239/63 1026 30693663
7 0x07 1023/1 /1 1023/239/63 136611 32795343
Partitions Ubuntu VM needs access are 5 (root fs) and 6 (swap). Next command makes special .vmdk file for such partitions:
(pathtovboxprogramfolder)\VBoxManage internalcommands createrawvmdk -filename (pathtovboxdisksfolder>)\raw5and6.vmdk -rawdisk \\.\PhysicalDrive0 -partitions 5,6
And, for last, this .vmdk file could be registered with VirtualBox “Virtual Disk Manager” and used for VM.
