Hi,

I would like to backup the booted SDcard of my Raspberry pi.

I don’t necessary need to backup as a hot backup[1] So I can remove the SDcard and make the backup on another machine.

with dd
$ fdisk -l
Disk /dev/sda: 29.72 GiB .....
....
Device
/dev/sda1 ...
/dev/sda1 ...

So I first tried:

$ dd bs=4M if=/dev/sda conv=fsync status=progress | gzip > /path/path/foobar.gz

But this create a huge .gz file ! because it backup the unused space too :'(

If you know a ~simple command to just backup the used space I’m all ears.

with rpi-clone

I’ve discovered rpi-clone

Seem really great, too bad the github tab discussion has been not activated :/ and If the documentation is not clear enough, no way to ask the community.

EDIT: Actually it seem that it clone a SD to a full dest drive ! so not as destination file correct ??

in the README you can read:

rpi-clone-setup is for setting the hostname in /etc/hostname and /etc/hosts files.

It is run automatically by rpi-clone if -s args are given, but before your first clone using a -s option, test run rpi-clone-setup with:

rpi-clone-setup -t testhostname

So what is the purpose of the -s argument ? If you want to set another hostname into the destination backup ? why can we set fews ? Can we have few hostname for a same machine ???

and the -t argument is not even documented (if I’m not mistaken …)

  • Did you ever tried rpi-clone ?
  • what’s your 2cent about it ?
  • does rpi-clone sda promt you to confirm the destination ?
  • do know some thing else ?
  • is it possible to output the backup as a file ?


Thanks.


  1. Backup that can be taken while the system is running. ↩︎

  • bushvin@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    25 days ago

    What kind of backup do you want to take? A config backup or a live system backup?

    Live system backups are difficult, as you typically have locked files and files being written to. You would need agents which allow your apps to be suspended is a consistent state. Besides that you have mounted pseudo file systems which you don’t need to backup like /tmp, /sys, /proc. You could use file system snapshots, but not all fs support this. And knowing the default fs used on rpi, you’re out of luck.

    Config backup on the other hand can be done rather easily. You list the dirs and files and you’re off. I use restic, which is a very flexible backup tool leveraging compression, snapshots and encryption. It even allows you to use cloud storage natively to store your backups.