How to edit/add file in VMDK

11,829

Solution 1

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.

Solution 2

What filesystem is on the vmdk if it's ext2/ext3 then add it to a vm (in persistent mode) find the /dev device for it and mount in linux in the normal way (using mount /mountpoint /dev/[device]) make your changes and then mount /mountpoint

Share:
11,829
s g
Author by

s g

Code bot.

Updated on September 18, 2022

Comments

  • s g
    s g over 1 year

    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.

    • ewwhite
      ewwhite almost 11 years
      What changes do you need to make to it?
    • s g
      s g almost 11 years
      I just need to modify the contents of a text file
  • s g
    s g almost 11 years
    I would like to do this without any VM's involved. Ideally, I could have a script that makes a simple modification to a bunch of VMDK files.