3

we have NFS storage, where we store our backups.. we manipulate with them from linux machine where the nfs is also mounted.. So, for example thin provisioned thin.vmdk disk is on linux seen as thin.vmdk and thin-flat.vmdk. We want to archive and compress them with tar and gzip, however when issuing simple tar command on those two.. the thin just dissappears and everythnig is suddenly 10G.

Even when I try to tar the thin-flat.vmdk, which has 1.6G, separately (with "tar cf thin.tar thin-flat.vmdk") it makes 10G tar file. This also happened when the I tried to run tar cf /extfs/thin.tar to create the tar on ext fs.

What kind of sorcery is this? Does anybody have a clue?

Thanks a lot.

5

GNU tar, which you should have if you're using Linux, supports handling sparse files with the -S (or --sparse) option. Try

tar cSf thin.tar thin-flat.vmdk
  • Wow, thanks. How is does it work? How come I did not specify the -S option, tar created 10G tar archive and after I restored it, it was still 10G non-thin vmdk? Y'know what I mean? Isn't tar supposed to create identical unarchived file with the same checksum as the one before archiving? – Jakub Žitný Aug 6 '13 at 15:19
  • If you search for 'sparse files' you'll see how it works. – Flup Aug 6 '13 at 15:20
4

From the GNU tar(1) man page:

       -S, --sparse
              handle sparse files efficiently
4

You should tell tar to treat sparse files efficiently with the -S --sparse command line switch.

-S, --sparse handle sparse files efficiently

3

You're not supposed to do this. At least, if you're trying to develop a process around this, the more scalable approach is to archive using a different method.

If you want to export a VM and preserve its attributes, you can export as an OVF file. Or if you have VM-aware backup methods available, that may make more sense.

Also see: Move VMware ESXi VM to new datastore - preserve thin-provisioning

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.