Compressing a VMWare Virtual Machine Image
Bash ScriptA bash script is available here (text form)
To use the script, first set the downloaded file's executable bit by entering
chmod +x rea_compress.sh
then, you can either enter the file name on the command line and it will run in interactive mode and determine
the settings you want by asking you questions, or you can use the following syntax to do it all at once:
rea_compress <image folder> [output filename]
Manual Image Creation
Supported formats:
- zip (.zip)
- gzip (.tar.gz, .tgz)
- bzip2 (.tar.bz2, .tbz2)
- no others (yet)
Place the following file types in a flat archive (no subfolders):
- .vmdk
- .vmsd
- .nvram
- .vmx
- IF the machine is in a suspended state, include:
- .vmss
- .vmem
- zip (The first line is always for suspended machines, the second for non-suspended):
- zip -9 -T <MachineName>.zip *.vmdk *.vmx *.vmsd *.nvram *.vmss *.vmem
- zip -9 -T <MachineName>.zip *.vmdk *.vmx *.vmsd *.nvram
-
- gzip (manual download: source binaries):
- GNU tar supports the z flag:
- tar -czf <MachineName>.tar.gz *.vmdk *.vmx *.vmsd *.nvram *.vmss *.vmem
- tar -czf <MachineName>.tar.gz *.vmdk *.vmx *.vmsd *.nvram
- UNIX tar doesn't support the z flag or pipe:
- tar -cf <MachineName>.tar *.vmdk *.vmx *.vmsd *.nvram *.vmss *.vmem ; gzip -9 <MachineName>.tar
- tar -cf <MachineName>.tar *.vmdk *.vmsd *.nvram *.vmx ; gzip -9 <MachineName>.tar
- bzip2 (manual downloads):
- GNU tar supports the j flag:
- tar -cjf <MachineName>.tar.bz2 *.vmdk *.vmx *.vmsd *.nvram *.vmss *.vmem
- tar -cjf <MachineName>.tar.bz2 *.vmdk *.vmx *.vmsd *.nvram
- UNIX tar doesn't support the j flag or pipe:
- tar -cf <MachineName>.tar *.vmdk *.vmx *.vmsd *.nvram *.vmss *.vmem ; bzip2 -9 <MachineName>.tar
- tar -cf <MachineName>.tar *.vmdk *.vmx *.vmsd *.nvram ; bzip2 -9 <MachineName>.tar
How can I tell if I'm using UNIX tar?
Entering the following command:
tar -zshould cause UNIX tar to reply with the following message:tar: z: unknown optioninstead of the message that GNU tar replies with:
Usage: tar {txruc}[vfbFXhiBEelmopwnq[0-7]] [-k size] [tapefile] [blocksize] [exclude-file] [-I include-file] files ...tar: You must specify one of the `-Acdtrux' optionsFurthermore, entering
Try `tar --help' or `tar --usage' for more information.
tar --helpwill cause UNIX tar to respond with relatively short usage message whereas GNU tar will respond
with many many lines of detailed instructions.
Written for the CERIAS ReAssure project by Drew Anderson
