TUTORIAL RasPi Backups to microSD Cards

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,170
Reaction score
5,199
We've found a new way to make Raspberry Pi images, and I thought I'd share it since it also works as an ideal way to backup production servers running on the RasPi platform since you can perform the backups in place with a removable microSD card (not the one you booted the RasPi from obviously).

To get started, you'll need a USB-MicroSD adapter. Our favorite is the Vanja ($6.99 on Amazon).

For the backup microSD card, you need one large enough to hold all of the data (df -h) that you've used on your primary microSD card. For example, if your boot device is a 32GB SD card, but you've only used 12GB of space, then you can use a 16GB microSD card as the backup device. It will still be bootable.

To get started, format the backup microSD card as an MSDOS partition. Tutorial here.

Unless you're using an Incredible PBX 2020.3 build, you will need to install rpi-clone. Tutorial here. You can skip the step of setting the hostname.

Now we're ready to begin. Make sure your RasPi is up and running with the microSD card to be cloned.

1. Insert your USB adapter with the microSD card to be used for the backup.
2. Run fdisk -l to decipher its identity, typically sda.
3. Issue the following command to make the bootable backup image: rpi-clone -f sda
4. Shutdown your RasPi: halt
5. Remove the USB stick.
6. Boot your RasPi using the microSD backup to be sure it works.
7. Shutdown your RasPi and store the backup microSD card in a safe place.
 
Last edited:

ostridge

Guru
Joined
Jan 22, 2015
Messages
1,618
Reaction score
517
We've found a new way to make Raspberry Pi images, and I thought I'd share it since it also works as an ideal way to backup production servers running on the RasPi platform since you can perform the backups in place with a removable microSD card (not the one you booted the RasPi from obviously).

To get started, you'll need a USB-MicroSD adapter. Our favorite is the Vanja ($6.99 on Amazon).

For the backup microSD card, you need one large enough to hold all of the data (df -h) that you've used on your primary microSD card. For example, if your boot device is a 32GB SD card, but you've only used 12GB of space, then you can use a 16GB microSD card as the backup device. It will still be bootable.

To get started, format the backup microSD card as an MSDOS partition. Tutorial here.

Unless you're using an Incredible PBX 2020.3 build, you will need to install rpi-clone. Tutorial here. You can skip the step of setting the hostname.

Now we're ready to begin. Make sure your RasPi is up and running with the microSD card to be cloned.

1. Insert your USB adapter with the microSD card to be used for the backup.
2. Run fdisk -l to decipher its identity, typically sda.
3. Issue the following command to make the bootable backup image: rpi-clone -f sda
4. Shutdown your RasPi: halt
5. Remove the USB stick.
6. Boot your RasPi using the microSD backup to be sure it works.
7. Shutdown your RasPi and store the backup microSD card in a safe place.
Just incase you arrived here before completing the 'upgrade-to-incrediblepbx2021'
Then you now need to continue with the Tutorial:

Migrating Raspberry Pi from Incredible PBX 2020 to 2021

 

tycho

Guru (not...)
Joined
Aug 9, 2011
Messages
652
Reaction score
272
Just incase you arrived here before completing the 'upgrade-to-incrediblepbx2021'
Then you now need to continue with the Tutorial:

Migrating Raspberry Pi from Incredible PBX 2020 to 2021

Thanks.

If not too far off-topic (the FIRST thing I would do is make a backup to a handy MicroSD. There; fixed it!) I have a RasPi install from the first half of 2020 that has been set aside while dabbling with other platforms. What say you folks who have upgraded/migrated to the comparison/wisdom of upgrading current to 2021, vs. nuking the chip and starting fresh with 2021?

The RasPi works fine and is fully configured, but it's a sandbox, not production, and I could rebuild trunks, routes and extensions without much more than the usual muttering and cursing...
 

ostridge

Guru
Joined
Jan 22, 2015
Messages
1,618
Reaction score
517
Thanks.

If not too far off-topic (the FIRST thing I would do is make a backup to a handy MicroSD. There; fixed it!) I have a RasPi install from the first half of 2020 that has been set aside while dabbling with other platforms. What say you folks who have upgraded/migrated to the comparison/wisdom of upgrading current to 2021, vs. nuking the chip and starting fresh with 2021?

The RasPi works fine and is fully configured, but it's a sandbox, not production, and I could rebuild trunks, routes and extensions without much more than the usual muttering and cursing...
Well the migration itself is fairly painless.
As it happens I had already updated from asterisk 16 to Asterisk 18 as post
and I did an update of the raspbian 10.7 to 10.11 OS
Code:
cat /etc/debian_version
10.11
.

I would just make sure your do a (Edit: sudo rpi-clone -f sda # where sdx is your target msd card.) Make sure the 'clone' msd card boots OK, before going for it.
 
Last edited:

tycho

Guru (not...)
Joined
Aug 9, 2011
Messages
652
Reaction score
272
Well the migration itself is fairly painless.
As it happens I had already updated from asterisk 16 to Asterisk 18 as post
and I did an update of the raspbian 10.7 to 10.11 OS
Code:
cat /etc/debian_version
10.11
.

I would just make sure your 'clone' msd card boots OK, before going for it.
OK; thanks for the info and suggestions...
 

Members online

No members online now.

Forum statistics

Threads
25,782
Messages
167,514
Members
19,203
Latest member
frapu
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top