Photo by Siyuan Hu / Unsplash

Backup Linux OS Using Rsync

Linux Nov 9, 2021

This one is really simple and effective.

Let's say we have a external HDD and we want to backup whole linux OS (both server or desktop)

Create dir, mount and backup:

sudo mkdir /backup
# lsblk to check your external drive
# in my case it's /dev/sdc1
lsblk -f
sudo mount /dev/sdc1 /backup
# adding folder with date
sudo mkdir /backup/linux-os-$(date +%F)
sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/backup"} /backup/linux-os-2021-11-09

Don't forget to exclude your backup folder.

Let it do it's thing. :)

Tags