Conventional wisdom has it that creating backups by using dd if=/dev/mmcblk0 ...
from a live filesystem is prone to error. Changing a filesystem that's being copied as an image will result in a corrupted image that at best will fail immediately on fsck
or mount
, and at worst will appear to be safe but will have left important files silently corrupted. This is what I've understood since first using UNIX way back when.
Pi documentation, repeated many times by others, seems to state that this dd
approach is not only acceptable but indeed recommended. Here are two of the many posts I've seen:
- https://raspberrystreet.com/learn/how-to-backup-raspberrypi-sdcard
- https://www.tomshardware.com/uk/how-to/back-up-raspberry-pi-as-disk-image
I'm ignoring snapshot filesystems, since mostly Pi systems default to using ext4.
I am also not looking for a backup solution, or suggestions of alternatives such as using LVM or rsync
.
Has the Pi kernel got a feature that pauses writes to a block device while it's open for reading from user space? Or is it on the assumption that "not much" generally writes to the filesystem?
If not, how are these two positions reconciled?
dd
is recommended on a mounted rw filesystem? – Dmitry Grigoryev Oct 26 '21 at 09:34