UP | HOME

Linux Backup

Mount the external on /mnt/sdX1, for example. cd to /, then, use:

sudo rsync -aAXv / --delete --dry-run --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt/sdX1

For my own memory, lately I've been using:

sudo rsync -aAXv /home/czw --delete --exclude="/czw/yay" --exclude="/czw/snap" /mnt/sdb1/02-03-2021/

To restore from a live usb, mount the backup disk on /mnt/sdX1 and mount the system disk on /mnt/sdY for example. Then run rsync in the reverse of above:

sudo rsync -aAXv /mnt/sdX1/ /mnt/sdY/ --delete --dry-run --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"}

Note the trailing slash in the above.

1. For backing up my home directory

sudo rsync -aAXv /home/czw --delete --dry-run --exclude="/czw/yay" --exclude="/czw/snap" --exclude="/czw/anaconda3" /mnt/sdb1/02-03-2021/  

2. Useful links

Created: 2024-07-15 Mon 01:26