Linux – How to edit/add file in VMDK

linuxmountvirtual-machinesvirtualizationvmware-esxi

I have a VMDK (with several partitions) file which I need to modify. It is not attached to any particular virtual machine.

I've tried using vmware-mount (from the VDDK toolset) in on Ubuntu server 12.04 which allows me to mount a particular partition from the VMDK to my local machine. I can successfully view the files and, after changing some permissions, I can write changes to the files.

The problem is that they don't persist after I unmount the vmdk (then remount it to check for the changes). Do I need to do anything before unmounting? I'm currently using vmware-mount -d to unmount after making my changes.

I haven't tried to convert the VMDK to a different format, make changes, then convert back. I'm skeptical about going that route.

Best Answer

You should try guestfs. It supports VMDK format and allows you to change/download/upload content from/to your VMDK file. You can use subcommand virt-copy-in to upload content into a disk file, use virt-edit to edit file in an offline disk image.