Lubos Rendek

The only solution is determination.

Rsync Hardisk Backup Clone to External Drive

| Comments

Here is a simple and cheap idea on how to make a backup of your desktop data to a external disk. It is always good idea to keep your data on a some other storage not directly associated with your primary desktop hardware and software. This kind of redundancy makes you recover from disaster easier. First, get new external USB hard-drive dedicated for this backup. The best would be to have drive with the same size as your primary data disk and preferably for a faster speed the drive should be USB 3.0. The aim is to keep a exact copy of our home directory on a external USB drive.

Plug-in your USB drive, format it with ext4 filesystem and execute:

1
2
3
4
5
6
7
8
9
10
11
# blkid 
/dev/sda3: UUID="c95b5c0f-262f-4322-91cd-2b6e2af469c4" TYPE="swap" 
/dev/sda1: LABEL="System Reserved" UUID="3C600AA3600A63CC" TYPE="ntfs" 
/dev/sda2: UUID="DE921498921476ED" TYPE="ntfs" 
/dev/sdb1: LABEL="STEAM" UUID="2A2E093B2E090195" TYPE="ntfs" 
/dev/sda5: UUID="8d5c2d82-b5c2-48a0-a1f8-dd406a5db3f2" TYPE="ext4" 
/dev/sdc: TYPE="isw_raid_member" 
/dev/sde: TYPE="isw_raid_member" 
/dev/sdd1: UUID="4356e78b-6f85-4c2d-91a6-f561f35d9e20" TYPE="ext4" 
/dev/md0: UUID="11161d35-ce93-4abd-beef-4748577f7001" TYPE="ext4" 
/dev/md0p1: UUID="38ad8d8c-f0b1-4f1a-bb07-1193eb4eefb0" TYPE="ext4"

Our drive has UUID=“4356e78b-6f85-4c2d-91a6-f561f35d9e20” and this is what we are going to insert into /etc/fstab config file so it will mount after each reboot. To do that insert the following into /etc/fstab:

1
UUID=4356e78b-6f85-4c2d-91a6-f561f35d9e20       /mnt/backup ext4 rw,relatime,user_xattr,barrier=1,data=ordered    0      0

Make sure that /mnt/backup mount point is created:

1
# mkdir /mnt/backup

Next open your crontab and set rsync to clone all data in your home directory to /mnt/backup/ every hour:

1
0 * * * * /usr/bin/rsync -a --delete-after /home/lubos/ /mnt/backup/

All is done. From now on your home directly will be cloned/backup to external device. If you are paranoid you could also encrypt your destination drive.

Comments