I am working on cloning my Raspberry PI microSD cards in order restore then quickly. I use DD linux tool with SSH because they are difficult to access physically.
From my computer, my command is : ssh root@rpi-one "dd if=/dev/mmcblk0 bs=64K conv=noerror,sync status=progress | gzip --fast " | dd of=~/rpi-clones/$(date %Y-%m-%d)_$(hostname).gz
This one give me best result : 3.9GB in 18 minutes for a 32GB microSD
My two raspberries are pretty close :
RPI 1 :
Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 3,0G 25G 11% /
devtmpfs 1,8G 0 1,8G 0% /dev
tmpfs 1,9G 16K 1,9G 1% /dev/shm
tmpfs 1,9G 8,8M 1,9G 1% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 1,9G 0 1,9G 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 49M 204M 20% /boot
log2ram 40M 11M 30M 28% /var/log
tmpfs 384M 0 384M 0% /run/user/1000
tmpfs 384M 0 384M 0% /run/user/0
RPI 2 :
Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 3,0G 25G 11% /
devtmpfs 1,8G 0 1,8G 0% /dev
tmpfs 1,9G 16K 1,9G 1% /dev/shm
tmpfs 1,9G 137M 1,8G 8% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 1,9G 0 1,9G 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 49M 204M 20% /boot
log2ram 40M 13M 28M 32% /var/log
tmpfs 384M 0 384M 0% /run/user/1000
tmpfs 384M 0 384M 0% /run/user/0
So :
RPI 1 : 3.9GiB in 1103s
RPI 2 : 6,8GiB in 1337s
At the beginning of my test, RPI1 && RPI2 was identical at 3.9GO with same time.
I wanted to make a test on local RPI2 to see if dd then scp will make me gain time but not.
So in my history :
159 dd if=/dev/mmcblk0 bs=64K status=progress | gzip -9 > /opt/backups/$(date +%Y%m%d\_%H%M%S)\_$(hostname).gz
160 ll /opt/backups/
161 rm -rf /opt/backups/
I wonder even if this test was deleted, if something like sectors are still 'occupy' but available like we can see with df -h command above.
I made several tests with pishrink, e4defrag etc, and I still have the same results (just gain 0.4GiB after e4defrag).
I use these RPIs with screenly-OSE to diffuse images and videos.
If you have any suggestions ... thank you :)