
without it, the underlying partition would end up with an MBR/GPT etc., which would only make sense to a VM).Īn empty file can be created with the following command, which in this case creates a 1MiB file to hold the 2048 sectors at the start of my virtual disk: – fsutil file createnew Raw_Sectors_1MiB 1048576 This allows a virtual disk to have its own partitioning and bootloader without messing up the contents of the main physical partition sectors (e.g. It contains flat data, in other words raw sectors, and the sectors are stored in the file. In the lines above, taken from my vmdk file, line 2 defines a read-write area of the virtual disk that is 2048 sectors in length, starting at sector zero. The virtual disk is backed by a 1MiB file (2048 sectors at physical offset 0) and a chunk of PhysicalDrive0 (125829120 sectors at physical offset 125831168), so the extent descriptions effectively concatenate the file and the physical disk sectors into a single virtual disk as seen by the VM. It has no access to any other sectors on the disk. The wmic output above shows the partitions, though gives the starting offset in bytes, so we need to divide these numbers by 512 to get the starting block offset (which gives 2048, 125831168, and 251660288 respectively).īelow is an snippet from one of my virtual disks – it’s physically primary partition 2 on the disk, exactly 60GiB in size.
#Linux view partition table of vmdk windows 7
The physical disk as seen by the Windows 7 host. There is around 100GB of unpartitioned space on this 240GB disk. I use the whole disk for VMs, so none of these partitions are actually used for host filesystems. This is defined as a list of ‘extents’ with access mode, size, type, physical device, and starting offset.īelow is the partitioning I have defined in the host. The VMDK file will define the sector layout of your virtual disk, as seen by the VM. Part or all of a disk can be used as a RAW partition in a virtual machine. Make sure that the all disk definitions backed by raw sectors are defined as ‘shareable’ in the Virtual Media Manager, otherwise you’ll find one VM can block the others from starting, because it effectively has an exclusive lock on the physical disk.

However, you can specify any sector range from a physical disk as being the source data for an extent in your virtual disks. The sector count and offset values in the VMDK therefore reflect the partition layout by default. VBoxManage uses the partitioning information when creating raw disks to determine the sectors required when creating the VMDK file using the CLI.

What we define in a virtual disk is the virtual sector list, known as ‘extents’ and, for each extent, where the real sector data resides (filesystem, raw disk sectors, or simply zeros). The knowledge that I was missing is that the partition layout of the disk is largely irrelevant. one for each VM) on the disk – it’s hard to experiment on physical disks without risking disaster. I never fully got my head around VMDK formats for RAW devices when using multiple independent partitions (e.g. For me, since I have two SSDs in my laptop, it meant I could tinker with virtual machines without risking my Windows 7 partition, while also being able to boot the VMs on real hardware if I wanted. VirtualBox allows us to use a disk device directly, rather than using a file as a virtual volume. Do not act on this article unless you are prepared to trash your disks, or if you are absolutely sure you understand what you are doing.
