It’s always a good idea to make backups of important data (documents, images, music, etc.), e.g. the worst case for students is to lose data of written reports or theses.
I wanted to make backups of my documents and source codes every day. The backup should be stored on a usb flash drive. But I also wanted to keep deleted files for a couple of days, in case of accidentally deleted files. There are many ways to complete this task, but I decided to use rsync and cronjobs for this purpose. Both tools make the backup process very flexible. It’s very easy to manage the time of the backup process with cronjobs and rsync makes it easy to change the destination (e.g. another folder, device or remote host).
My idea was to add a cronjob to start a bash script which uses rsync to copy the directories and files to the flash drive. But the device names of flash drives changes, if you plug them in a different order. To avoid this problem, I added a udev rule to create a symbolic link every time the flash drive is plugged.
Read the rest of this entry