@as Sparse files was one of the things I'd considered, but I assumed that rsync -av was smart enough to copy sparse files as sparse. Otherwise it shouldn't have been recommended for the purpose of cloning my whole root fs.
rsync can handle
sparse file, but you need to add the option -S
, see man rsync
(you found this yourself)
About cloning: cloning is different from copy, in that when you copy a file you meant to duplicate the content, i.e. you can copy one file from ext3 fs to an xfs filesystem obtaining a duplicate of content but for sure you will have a different underlying structure. rsync is not a cloning tool. Cloning tools works at blocks level which is under the filesystem layout, i.e. dd
, you can clone a disk.
That said, generally there is no need to backup /tmp, because by definition it contains only temporary files.
You can loose it's content at any time without any problem.
BTW, if your intent is mirroring some content, rsync surely can do that, in addition to the option -av (and -S) you may need to use also the --delete
option, so that when you update
your backup (that's the reason to use rsync), you may want that files deleted on the source will be deleted on the destination.
Maybe I needed another command line option to get rsync to preserve sparseness? I had a similar problem with gunzip at work a while back. When you zipped and then unzipped a sparse file, it would come back non-sparse (all the zeros taking up real disk space). I made my own gunzip with a --sparse option that we use at work - submitted the change to the GNU folks, but they never responded
Take a few time, make a few tests, and you will find your way with rsync.