using clonezilla or partclone from the commandline to create a "sparse" img file

W Scott Lockwood III vladinator at gmail.com
Tue Jun 30 19:10:51 UTC 2015


There are alternatives to partclone and dd. For example, if you've 
already backed up the partitions to files:

cp --sparse=always source dest

Or my favorite:

rsync -avz --sparse source dest

If you want to use rsync on an inplace file (after the first time it's 
been copied and you just want to make it sparse):

rsync -avz --inplace source dest

Sadly, --inplace and --sparse are mutually exclusive. No idea why. I 
hope they fix that at some point.


On 6/30/2015 10:07 AM, robert rottermann wrote:
> Hi there,
>
> I would like to copy the contents of an sd-card that contains two 
> partitions (actually a raspberry boot and data partition) into a file 
> that later can be used to copy to an other sd-card .
>
> using a python script, this works well when I just open the device 
> pointing to the sd-card (like /dev/sdc) as a file, and the copy its 
> content to a disk file.
> to restore it, I copy that disk file to the device again.
>
> However, this approach has  big disadvantages:
> my disk file is exactly as big as the the sd-cards capacity.
> And, worse, to copy it back again, I need a sd-card with the same 
> capacity as the original one.
>
> I hope to find tools that would allow me to create such "sparse" copies.
> It looks, as if partclone is such a tool.
> Unfortunately I found no description how it could be used from the 
> command line.
>
> can sombody of you point me to such a documentation/tutorial,
> or better yet: tell me what is the right way to dump an sd card into 
> an img file.
> I know dd, ..
>
>
> thanks
> robert
>





More information about the ubuntu-users mailing list