this post was submitted on 28 Nov 2024
5 points (85.7% liked)

raspberrypi

3349 readers
2 users here now

Community about the single-board computers, micro-controllers and related projects.

https://www.raspberrypi.com/

Other RaspberryPi communities on Lemmy

founded 4 years ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 week ago

I just recently switched over to rpi-clone after doing backups of the booted SD with SD Card Copier, the GUI app on Raspberry OS.

The original version from billw2 didn't work with modern OS versions. After doing some lookups in the issues and online, the users pointed to geerlingguy's version, which seems to be maintained.

I'm not using rpi-clone-setup but rpi-clone sdX and after trying it for the first time, it worked. I swapped out the SD with the copy and the raspberry booted (it didn't boot with billw2's version).

Next step is to create a script for regular backups.

To your questions:

  • Tried it, it works for my use-case
  • rpi-clone asks for confirmation, which I need to address when trying to do backups automatically
  • Have tried others but needed a working copy on a new SD card, so this is the solution I'm going with
  • If you want a file you probably want to use dd. I'm aware of the space issue. I quickly looked up other tools: partclone and fsarchiver seem to address the free space issue, but I never tried them so I cannot speak to that.