- Posts: 57
- Thank you received: 0
Rpi5, decided to make backup script for /boot
1 year 4 months ago #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:
Code:
#!/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:
Code:
#!/bin/bash
echo '* Differences between /boot and /boot.bak...'
echo
sudo diff -r /boot /boot.bak
boot-restore:
Code:
#!/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
Please Log in to join the conversation.
Time to create page: 0.246 seconds
