How to replace MBR (or Partition Table) of a vmdk file?

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
Post Reply
PHP
Posts: 2
Joined: 6. Oct 2014, 09:23

How to replace MBR (or Partition Table) of a vmdk file?

Post by PHP »

Hi,
I am using VB on a linux host and have a DOS guest. I used User Manual instructions to create a vmdk file for one of my physical partitions by following command:

Code: Select all

VBoxManage internalcommands createrawvmdk -filename /media/user/DOS/sda8-rel.vmdk -rawdisk /dev/sda -partitions 8 -relative
Whole physical disk size is about 300GB, but the partition 8 (sda8) size is 1GB and is formatted as FAT16.
I could easyly add the created vmdk file (sda8-rel.vmdk) to my virtual machine as IDE Primary Slave disk. But when I start my guest OS (DOS) it is not detected as 1GB disk and there is no D: drive:

Code: Select all

C:\>d:
Invalid drive specification
If I run fdisk it detects that there is another disk drive but it does not detect the 1GB FAT16 partition. Here is what fdisk shows about second disk:

Code: Select all

Current fixed disk drive: 2
Partition    Status    Type        Volume Label    Mbytes   System     Usage
    1           A     Non-DOS                        487                  6%
    2                 Non-DOS                       2983   1             100%
    3                  Non-DOS                       781   5              97%
    4                  Ext DOS                       496   6              62%
Total disk space is 8033 MBytes (1 MByte = 1048576 bytes)
It seems that MBR (or Partition Table) for disk 2 of guest machine is same as MBR (or Partition Table) of main physical disk (sda1 is 487MB, sda2 is 93.1GB, sda3 is 7815MB, sda is an extended partition of about 196.8GB that contains sda5, sda6, sda7, ...)

So it seems that if I could replace MBR (or Partition Table) for my vmdk file, the problem will be solved! Is it possible and how?
Post Reply