Copy Sparse Files with Rsync

Patrick Jayet
XRB’s Blog
Published in
1 min readJun 4, 2007

Updating my backup script that is using rsync, I have just realized that without further options, rsync does not handle well copying sparse files (i.e. files that are for instance holding a file system and that just take the space needed by their actual size). A consequence is that on the target file system, the sparse file won’t be any longer a sparse one, i.e. will take its maximal size.

Fortunately, adding the -S option to rsync will do the trick, for instance

rsync -a -S /source_dir/ /dest_dir

--

--

Patrick Jayet
XRB’s Blog

Polyglot (FR, DE, EN, ES), polyglot programmer (Java, Groovy, Ruby, Swift, Objective-C, Scala, Python, O’Caml) polyglot methodologist (Scrum, Kanban, Lean).