Backup SD card on macOS

  • Hi LE forum,

    I use LE12.0 on RPi3 mainly for plex plugin with wieguard vpn. As it requires several command to make it works fine, I would like to have an image of the SD card that can avoid reproduce the installation steps in case of SD crash. Before, I used ApplePiBaker (macOS) but it doesn't work anymore as it's not maintained.

    So I have to make an image using dd if of... - this step is very long for a 32gb sd card - than I use pishrink to reduce the size. Is there a better way to do that ? my point is to avoid copying 30gb of 0 when doing the dd command. But if i add count param in dd command, the image is corrupted (maybe because the size doesn't fit with te partition table).

    Maybe there is a way to limit the size of the ext4 partition ? for me 6gb is enough.

    Thanks for your help

    Cyril

  • Code
    dd if=/dev/mmcblk1 | gzip > of=backup.img.gz

    You can pipe the dd output through gunzip ^ to reduce the size of the backup file (empty space compresses well) but I would avoid using dd to make backups because you still need to read all the empty space and it will take ages. It's faster and more portable to backup the content in the filesystem than to the backup entire filesystem.

    The backup function in the LE settings add-on captures /storage/.cache, /storage/.config and /storage/.kodi, which covers all the main content on the card and normally produces a 0.5-2GB sized tar file. The restore function in the LE settings add-on will make the process of recovering from backup simple too. If you need to include more directories; learn how to use create a .tar file with the files and directories you need inside (there are thousands of HOWTO docs in Google).

  • Thank you for your reply, I understand your advice. I prefer the sd image because to reinstall LE, a keyboard is needed and/or a wired connection. In my case I usually don't have that when I have sd problem :)

    To close this topic, I discovered that pishrink does what it says. So only one full image with dd command is required. Then, with the script, I can have a storage partition from 100Mo to 30Gb.