I'm really looking for something simple that can be done while Pi-hole is running, and was thinking of using a USB SD card reader/writer. I have found two possible options:
"SD Card Copier", from the Raspberry Pi Desktop's Accessories menu, which I would use via VNC, or
I was particularly wondering how large the risk was of getting an inconsistent set of files was, and if necessary how to mitigate that risk. Apart from the software mentioned above, there should be nothing I am aware of running - but there may be stuff in the background?
Also, any pros and cons of the two methods mentioned above, and other thoughts that may spring to mind, would be welcome.
On my Pi, the disk/SD card is called mmcblk0 with two partitions mmcblk0p1 and mmcblk0p2:
pi@ph5:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 14.9G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 14.6G 0 part /
pi@ph5:~ $ sudo parted -l /dev/mmcblk0
Model: SD SU16G (sd/mmc)
Disk /dev/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 4194kB 273MB 268MB primary fat32 lba
2 273MB 15.9GB 15.7GB primary ext4
If want to create a disk image live, you can run below command.
But the backup path below (the of= argument) cant reside on the same SD card or the disk would run full.
Need to write the backup image to a larger mounted NFS or CIFS share.
Or maybe to a connected USB stick or HDD.
But first run lsblk before and after inserting the backup SD card to validate the card is assigned the name sda from above command (change if other).
Also check with lsblk first if any partitions from that sda block device were automatically mounted (the MOUNTPOINT column).
Unmount them first before start copying with below:
sudo umount /path/to/mountpoint
And check with lsblk again if anything still mounted from sda.
And when copying is finished and want to pull that backup SD card, run below first for safety:
sync
I wasnt reading your initial request properly when first replying as I was distracted
In the sense of coping with possible changes to various files during the copying process, are those methods more likely to succeed than the two methods I mentioned? Or are any pros/cons mainly about how you want to organise backups?
(I am beginning to sense that there is only a negligible chance of not being able to successfully get a working system from a backup, so maybe I need not worry too much.)