billw2 / rpi-clone

A shell script to clone a booted disk.
BSD 3-Clause "New" or "Revised" License
2.56k stars 333 forks source link

Progress Indicator and RPi Stalling #58

Open SolarDuck opened 6 years ago

SolarDuck commented 6 years ago

I have sometimes found it desirable to have a progress indicator while using rpi-clone. I have been experimenting with the rsync option --info=progress2 both with and without the --no-i-r option to make the display more meaningful. For more information on decoding the output, please refer to:

[https://unix.stackexchange.com/questions/215271/understanding-the-output-of-info-progress2-from-rsync]

The --no-i-r option slightly delays the start of file syncing but I regard the extra delay as tolerable to obtain a much more useful progress display.

In the process of testing the progress2 option, I noticed that rsync stalled several times, sometimes for many seconds. Concurrently using the command:

watch -n 1 grep -e Dirty: -e Writeback: /proc/meminfo

it looks like the output micro SD card cannot handle the speed of data being written by rpi-clone in random access mode, and the cache hangs. To alleviate this behavior, I am contemplating permanently adding the rsync option:

--bwlimit=<kbytes/second>

Initial testing with a SanDisk UHS1 micro SD card indicates limiting rsync output to 7 MBytes/second considerably reduces the freezing behavior of rpi-clone.

The RPi SBC platform is extensively listed on the web as experiencing hangs (pauses) when writing multiple small files to a micro SD card. Testing so far has indicated that there is a slight trade-off between clone duration and alleviation of application freezing. Given the amount of web based discussion about RPi SBCs and micro SD card issues, I do not think I am the only user experiencing hangs when using rpi-clone. What have other users done to address this issue, please?