SÍNTESI 25 | SAIA

PREPARATION OF THE OPERATING SYSTEM RECOVERY SYSTEM

  1. Install Clonezilla and Necessary Tools
    • To install Clonezilla, use the following command:

sudo apt install clonezilla

2. Modify the Script to Send the Backup to the Server

  • Edit the script /usr/local/bin/backup_clonezilla.sh to include a line at the end that sends the backup to the server. The file should look like this:
!/bin/bash
Define local directory and image name

BACKUP_DIR=”/mnt/backup/clonezilla”
DATE=$(date +%Y-%m-%d)
IMAGE_NAME=”backup-$DATE”

Create the system image automatically

sudo clonezilla-auto -o2 -icds -r -j2 -q2 -z1p -scr -sfsck -p true -s /dev/sda -d $BACKUP_DIR/$IMAGE_NAME

Send the backup to the server using rsync

SERVER_USER=”USERNAME”
SERVER_IP=”SERVER_IP”
SERVER_DIR=”/home/user/backups”

rsync -avz $BACKUP_DIR/$IMAGE_NAME $SERVER_USER@$SERVER_IP:$SERVER_DIR

3. Set Up Passwordless SSH Access

  • To avoid typing the password every time, generate an SSH key and copy it to the server using the following commands:

ssh-keygen -t rsa
ssh-copy-id USERNAME@SERVER_IP

4. Schedule the Backup to Run Daily at 11:45 AM

  • Open the cron configuration to schedule the script:

sudo crontab -e

Add the following line to schedule the backup:

45 11 * * * /usr/local/bin/backup_clonezilla.sh

Leave a Comment