Most people would agree, that backing up your files regularly is very important. However: Most people don’t. I don’t have any scientific data to support this, but it is my personal experience.
When I switched from Windows to Linux (a long time ago) I was used to nice GUI based backup tools like Cobian backup, which just sits there in the background and takes care of everything. I wanted something similar for linux. So I tried mostly GUI stuff like Unison, but I never got it to work quite properly. If you are looking for a GUI backup solution, I can’t help you… please stop reading and close your browser… maybe take a walk? (Or look here)
There are many different ways to back up your system or files. You can choose to mirror your whole hard drive including all partitions and boot information and what not. You can back up your operating system, so you can go „back in time“ if you misconfigure something in the future. Or you can just backup your personal files: Pictures, Videos, Music, Documents. For me the latter is sufficient since after a complete hardware crash I would setup a fresh system anyway.
I finally found a suitable program in rsync which is the go to guy of file synchronization in *nix systems. Many other tools even rely on it, e.g. Unison. Rsync is very feature rich, has support for SSH and can run as a daemon. (However none of this is important for a backup solution).
So here is what I do: Every once in a while I think it’s a good day for a backup, plug in my external hard drive and run a shell script that calls rsync with a couple of parameters. (A more organized person would probably have some sort of schedule. Not me. Please don’t judge!) Here is what it looks like:
#!/bin/bash rsync -avP --exclude-from='/home/niklas/rsync_excludelist' --delete-excluded --delete --stats /home/niklas/ /media/Backup/niklas
what does it all mean?
- -a (archive) tells rsynch to leave file properties intact (i.e. owner, access rights, etc) This only works if you are not backing up to a different file system!
- -v lets rsync be verbose and -P gives you a progress bar
- –exclude-from specifies the exclude file, I will talk about that later
- –delete makes sure files you delete in your original data will also be deleted from the backup
- –delete-excluded means that files or directories you choose to exclude later will then be deleted from the backup
- –stats lets rsync summarize the whole operation after it is done
- then you must give the source and destination directories (for me that is my home folder and a folder on my external drive called „Backup“
I chose to exclude several directories, my exclude file looks like this:
Dropbox Downloads .gvfs
The reason for excluding Dropbox is obvious: It would be super dumb and redundant. I do not backup my Downloads folder, because there it’s often quite big, full of crap and if I want to keep something I move it to another folder.
.gvfs (for GNOME virtual file system) is where remote file systems are mounted. I frequently mount my home folder at the university and don’t want it included in the backup (I am not sure if it even works that way).