Rpi5, decided to make backup script for /boot
- rdtsc
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 46
- Thank you received: 8
21 Jun 2025 16:33 - 21 Jun 2025 19:57 #330642
by rdtsc
Rpi5, decided to make backup script for /boot was created by rdtsc
Hi, several times I have borked the Rpi5 install for various reasons. So, decided to make a script to backup the entire /boot folder. Perhaps this will be useful. Have tested the backup and it works, have not tried the restore yet (and hesitant to.) But just having a backup alone might be worth it's weight in gold. P.S. it looks like there is a /boot partition and a / partition, however the / partition also has a /boot folder... so unsure if a restore would clobber anything.
boot-backup:
boot-diff:
boot-restore:
boot-backup:
#!/bin/bash
# this assumes you've already created /boot.bak with sudo mkdir /boot.bak
echo '* Backing up /boot to /boot.bak...'
echo
echo "Are you sure you wish to backup /boot?"
select strictreply in "Yes" "No"; do
relaxedreply=${strictreply:-$REPLY}
case $relaxedreply in
Yes | yes | y ) sudo cp -r -f -v /boot/* --target-directory=/boot.bak/; break;;
No | no | n ) exit;;
esac
done
boot-diff:
#!/bin/bash
echo '* Differences between /boot and /boot.bak...'
echo
sudo diff -r /boot /boot.bak
boot-restore:
#!/bin/bash
echo '* Restoring /boot.bak to /boot...'
echo
echo "Are you sure you want to RESTORE the backup?"
select strictreply in "Yes" "No"; do
relaxedreply=${strictreply:-$REPLY}
case $relaxedreply in
Yes | yes | y ) sudo cp -r -f -v /boot.bak/* --target-directory=/boot/; break;;
No | no | n ) exit;;
esac
done
Last edit: 21 Jun 2025 19:57 by rdtsc. Reason: Added diff script to see what changed between the two.
Please Log in or Create an account to join the conversation.
Time to create page: 0.073 seconds