Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 5 down vote accepted

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
share|improve this answer
    
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

From the GNU tar(1) man page:

       -S, --sparse
              handle sparse files efficiently
share|improve this answer

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

-S, --sparse handle sparse files efficiently

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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