How to update MBR partition table when creating VMDK from raw images

I am totally new to creating VMDK files, I would like to apologize in advance.

I am trying to create a VMDK file from raw images . The MBR file provided to me indicates that the partition table has 2 partitions as shown in the fdisk result below:

$ fdisk -l grub2.mbr.196M
Disk grub2.mbr.196M: 1024 MiB, 1073741312 bytes, 2097151 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x798ebfca

Device Boot Start End Sectors Size Id Type
grub2.mbr.196M1 * 2048 22527 20480 10M 83 Linux
grub2.mbr.196M2 22528 401407 378880 185M 83 Linux


To create my  desired VMDK file, I have 3 images:

1) grub2.mbr.196M - the MBR file shown above

2) img.boot - boot partition

3) img.data - data section


These 3 files will be dumped into a single image file:

cat $TMPDIR/grub2.mbr.196Mr $TMPDIR/img.boot $TMPDIR/img.data > $image

and then converted to VMDK later which will become a 2GB disk.


My question is: how do I modify the MBR file only so that logical partition 2 (img.data) can have 1 GB of space using only CLI? The total physical space is 2GB so assume that extending that partition is ok. 

The MBR file was provided to me as is but now I want to change the size of partition 2 because of my current project needs.

Thanks so much in advance!


0 Kudos
1 Reply

First of all - you do not need to convert your raw image to vmdk-format.

Raw images are already usable as vmdks in ESXi - you just have to provide a descriptor-file. See

To update the MBR you can boot the VM with a LinuxLiveCD and use the command "growpart"

Do you need support with a recovery problem ? - call me via skype "sanbarrow"
0 Kudos