MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.8k stars 494 forks source link

Script for dietpi-backup + Mount Sdcard + Update everything before #4846

Open billouetaudrey opened 2 years ago

billouetaudrey commented 2 years ago

Hey, this is my small script for Update all package then mount the good backup partion then Launch dietpi-backup

#Update packages
apt update && apt upgrade -y && /boot/dietpi/dietpi-update 1

#List all HDD
fdisk -l

#Choose Backup Partition && Mount
echo "Enter hdd"
read hdd
mkdir /mnt/backup
mount /dev/$hdd /mnt/backup

#Launch dietpibackup
/boot/dietpi/dietpi-backup 1

#Umount when End
umount /mnt/backup

Sorry if it's bad place :(

MichaIng commented 2 years ago

Thanks for sharing. Little hint:

sudo apt update && sudo apt upgrade -y && /boot/dietpi/dietpi-update

As you anyway need to run the whole script with root privileges, the sudo here is not required. Also you can skip the DietPi-Backup menu when it is already configured to use /mnt/backup:

/boot/dietpi/dietpi-backup 1

Same with DietPi-Update:

/boot/dietpi/dietpi-update 1
billouetaudrey commented 2 years ago

Oh thanks, lemme edit :)

For Sudo I forgot to delete it lol

On my own server, will not use dietpi-update 1 because I like to see if backup is successfully mount and detected ;)