Sunday, November 27, 2011

Backups

Since SSD-s are still viewed as not as durable storage devices as hard disk drives, one needs at least to consider doing backups. Preferably to a HDD. Since I have accumulated a good deal of files and pictures over the years and like to keep them present for some time I decided also to join the SSD-are-probably-not-as-durable-as-HDD-s band and start doing backups of my files. I have 2 external HDD-s. One is my old 80GB 5400rpm drive that came with my T60. The other is an upgrade to that, 256GB 7200rpm. Now that the T60 is gone I can use them both to hold my backup data. Since my SSD drive holds only 128GB - not big enough for all the data I'd like to store - I decided to use the 80GB drive as a storage device and the 256GB drive for backups.

So I included both of my external HDD-s to /etc/fstab, so automounting is easy (mount -a). Once that is done, I move files that I don't need on my laptop to the external 80GB drive. Then I run the backup script:

.backup.sh

sudo sh -c "
rsync -av --delete-excluded --exclude-from=.backup.lst / /media/backup/;
touch /media/backup/BACKUP
"

Backup is done using the program called rsync. What the script does is it is taking every file from root folder recursively (/) and copying it to /media/backup/ folder that is the mountpoint of my 256GB external HDD. The script will exclude every file included in .backup.lst file (there sould be definitely an entry for the mountpoint of the backup drive to avoid infinite loop, in my case /media/backup/):

.backup.lst

#Include
+ /dev/console
+ /dev/initctl
+ /dev/null
+ /dev/zero

#Exclude
- /dev/*
- /proc/*
- /sys/*
- /tmp/*
- lost+found/
- /media/backup/*



Usually the locations that contain runtime data for the operating system are excluded.

So the simple steps to backing up my data include:
1) connect the external drives to laptop
2) mount -a
3) move neccesary files to 80GB drive
4)./.backup.sh

and done.

No comments:

Post a Comment