Changes
VMware
,Created page with ''''VMware''' is a proprietary virtualization brand. Their popularity is probably due to their early start in the field of virtualization and cross-platform host capabilities. [[V…'
'''VMware''' is a proprietary virtualization brand. Their popularity is probably due to their early start in the field of virtualization and cross-platform host capabilities. [[VirtualBox]] and [[QEMU]] are [[free software]] alternatives to VMware.
=Cracking Open VMDK Images with DD=
While VirtualBox and QEMU should support VMDK images, they may not, in which case it's back to the basics. The <code>dd</code> utility can be used to crack open a <code>-flat.vmdk</code> file.
==Offset and Length Information==
To get the offset and length of each partition, run the <code>file</code> command it.
<pre>
$ file Red\ Hat\ Enterprise\ Linux\ 4-flat.vmdk Red Hat Enterprise Linux 4-flat.vmdk: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0xac03f, GRUB version 0.94; partition 1: ID=0x83, active, starthead 1, startsector 63, 5526297 sectors; partition 2: ID=0x82, starthead 0, startsector 5526360, 530145 sectors; partition 3: ID=0x83, starthead 0, startsector 6056505, 224910 sectors, code offset 0x48
</pre>
If you're dealing with Linux partitions, look for IDs of 0x83. 0x82 is Linux swap. Partition one generally begins at offset 63, but in this example, you can see a second partition at offset 6056505. The sector sizes are in multiples of 512 bytes.
==Dumping the Partitions==
The key components of the <code>dd</code> command are the <code>skip</code> and <code>count</code> settings. They are, respectively, the offset and length of the data to copy, copied from the information given by the <code>file</code> command.
The following will dump the root partition.
<pre>
$ dd if=Red\ Hat\ Enterprise\ Linux\ 4-flat.vmdk of=~/centosroot.img skip=63 count=5526297
</pre>
The other partition in this example was the <code>/home</code> partition. Since it was at the end of the file, the <code>count</code> variable was left unspecified. The partition was extracted with the following line.
<pre>
$ dd if=Red\ Hat\ Enterprise\ Linux\ 4-flat.vmdk of=~/centoshome.img skip=6056505 bs=512
</pre>
==Mounting the Partitions==
Mounting images on Linux is relatively straightforward.
<pre>
# mount -o loop /home/user/centosroot.img /mnt/mymountpoint
# mount -o loop /home/user/centoshome.img /mnt/mymountpoint/home
</pre>
You may need specify the filesystem type, i.e. <code>-t ext3</code>. Also, if you're having trouble mounting, it might be possible that you got the parameters wrong or potentially just got a bad copy. Try again to see if that's the case.
=Cracking Open VMDK Images with DD=
While VirtualBox and QEMU should support VMDK images, they may not, in which case it's back to the basics. The <code>dd</code> utility can be used to crack open a <code>-flat.vmdk</code> file.
==Offset and Length Information==
To get the offset and length of each partition, run the <code>file</code> command it.
<pre>
$ file Red\ Hat\ Enterprise\ Linux\ 4-flat.vmdk Red Hat Enterprise Linux 4-flat.vmdk: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0xac03f, GRUB version 0.94; partition 1: ID=0x83, active, starthead 1, startsector 63, 5526297 sectors; partition 2: ID=0x82, starthead 0, startsector 5526360, 530145 sectors; partition 3: ID=0x83, starthead 0, startsector 6056505, 224910 sectors, code offset 0x48
</pre>
If you're dealing with Linux partitions, look for IDs of 0x83. 0x82 is Linux swap. Partition one generally begins at offset 63, but in this example, you can see a second partition at offset 6056505. The sector sizes are in multiples of 512 bytes.
==Dumping the Partitions==
The key components of the <code>dd</code> command are the <code>skip</code> and <code>count</code> settings. They are, respectively, the offset and length of the data to copy, copied from the information given by the <code>file</code> command.
The following will dump the root partition.
<pre>
$ dd if=Red\ Hat\ Enterprise\ Linux\ 4-flat.vmdk of=~/centosroot.img skip=63 count=5526297
</pre>
The other partition in this example was the <code>/home</code> partition. Since it was at the end of the file, the <code>count</code> variable was left unspecified. The partition was extracted with the following line.
<pre>
$ dd if=Red\ Hat\ Enterprise\ Linux\ 4-flat.vmdk of=~/centoshome.img skip=6056505 bs=512
</pre>
==Mounting the Partitions==
Mounting images on Linux is relatively straightforward.
<pre>
# mount -o loop /home/user/centosroot.img /mnt/mymountpoint
# mount -o loop /home/user/centoshome.img /mnt/mymountpoint/home
</pre>
You may need specify the filesystem type, i.e. <code>-t ext3</code>. Also, if you're having trouble mounting, it might be possible that you got the parameters wrong or potentially just got a bad copy. Try again to see if that's the case.