Skip to content

Instantly share code, notes, and snippets.

@goodjob1114
Last active January 27, 2024 10:49
Show Gist options
  • Star 41 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save goodjob1114/9ededff0de32c1119cf7 to your computer and use it in GitHub Desktop.
Save goodjob1114/9ededff0de32c1119cf7 to your computer and use it in GitHub Desktop.
how to modify .ova file on linux/Mac using terminal....export vm (OVF 1.0) from virtualbox, then modify some tag and hash value for import vm to ESXi

extract ova files from an archive

$ tar -xvf vmName.ova

modify ovf for some invalid tag

$ vi vmName.ovf

re-calculate sha1 from vmName.ovf, then modify the hash value of vmName.mf

$ sha1sum vmName.ovf
$ vi vmName.mf

package to ova which source files from [vmName.ovf, vmName-disk1.vmdk, vmName.mf]

$ tar -cvf vmName-NEW.ova vmName.ovf vmName-disk1.vmdk vmName.mf
@rlazoryshchak
Copy link

tar -cvf vmName-NEW.ova vmName.ovf vmName-disk1.vmdk vmName.mf - no comma needed

@goodjob1114
Copy link
Author

tar -cvf vmName-NEW.ova vmName.ovf vmName-disk1.vmdk vmName.mf - no comma needed

OK~ Thanks!!!

@hesstobi
Copy link

On MacOS 10.15 i had to use

tar -cvf vmName-NEW.ova --format=ustar vmName.ovf vmName-disk1.vmdk vmName.mf

to get it imported.

@ParadingLunatic
Copy link

Figured I'd put this here as well. Looks like more recent version of ESXi/vCenter require sha256.

@evanjs
Copy link

evanjs commented Jun 4, 2020

Just a note for anybody that needs as much sleep as I do...
Make sure you run the command in the same directory the ovf, mf, and vmdk files are in.

Like this: tar -cvf nixos.ova .*.{ovf,vmdk,mf}
Not like this: tar -cvf nixos.ova ../nix-build-fix-esxi-image.drv-0/ova/*.{ovf,vmdk,mf}

Otherwise, the resulting ovf will be looking for the VMDK in a non-existent directory... 😪

@soyeliel
Copy link

to save time for those using mac. As mentioned by @ParadingLunatic ovf hash needs uses sha256 on newer releases. Here is the command for Mac Catalina

$ shasum -a 256 vmName.ovf

@ministryofjay
Copy link

On MacOS 10.15 i had to use

tar -cvf vmName-NEW.ova --format=ustar vmName.ovf vmName-disk1.vmdk vmName.mf

to get it imported.

Thanks! The --format=ustar made the difference for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment