On 20 September 2016 at 08:55, Neil Greenwood
> On 19 September 2016 21:07:13 BST, Colin Law <clan...@gmail.com> wrote:
>>On 19 September 2016 at 20:13, Neil Greenwood
>>> Sorry for the top post, I'm on my phone.
>>> I think partimage does what you want already. Clonezilla gives a
>>> slightly) friendlier front end, but I've not used either for several
>>I believe partimage does not handle ext4 which would be a problem (at
>>least that is what  says)
> You are right. It looks like it may work with ext4, but it's not supported.
> fsarchiver is an alternative that does support ext4 and is written by the
> partimage developer.
I think fsarchiver will only archive one partition at a time rather
than the complete device.
>>I had thought about clonezilla and will have another look at it. The
>>last time I used it (which was some time ago) it seemed overly
>>complex, but perhaps I just need to put a bit more effort in to see
>>how to use it from a script.
> Clonezilla definitely supports ext4, using partclone which may be more easily
I can report that clonezilla does exactly what I need. Having worked
my way through the rather tortuous UI it is, in fact, very easy to
script. To clone the SD card I just need to unmount any mounted
partitions on the device (sdb in my case):
for n in /dev/sdb* ; do umount $n ; done
Then mount the folder I want to save the image in as /home/partimag
sudo mount --bind $FOLDERTOCLONETO /home/partimag
and run the command
sudo /usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck-src-part -p choose
savedisk <image name> sdb
and to restore to a card, unmount its partitions and mount
/home/partimag as above and
sudo /usr/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -icds -j2 -p true
restoredisk <image name> sdb
This seems to work perfectly, and has the added bonus that the image
is much smaller that dd (even when gzipped). The Raspbian Lite image
which contains about 1.3GiB of files in a 2GB partition (plus the
other bits and pieces) is squashed down to just over 0.5GiB when
cloned, but is 1.2GiB when dumped with dd and then gzipped.
Thanks all for the suggestions