Backing up your home directory
- Relevant to all editions of PCLinuxOS.
Backing Up Your /home Directory
This tip comes from forum member davecs.
On your PCLinuxOS computer, the folder /home will have a subfolder for every user on the system. If you have a large external drive (and they can be bought cheap these days, though those can be slow), you can back up the /home system onto it easily, using a program called rsync. I've also got an extra subfolder in /home, called /home/storage, where I keep stuff safe, like extra fonts, my own wallpaper collection, drivers for my printer/scanner, copies of a few scripts that I like to install when my system needs re-installing, and so on. Of course the main / (root) folder, apart from /home, is installed when I re-install Linux, and if it gets broken somehow, it's probably best to re-install from a more recent iso. Your /home folder stores the personal stuff that you, and everyone else who uses your computer, can't put back from your PCLinuxOS ISO.
What I have done is to format my external drive to ext4, and give it the Volume name "DataBackup". When I plug it to the computer via USB, it gets mounted at /media/DataBackup. I have rsync installed, and I have written a little script called "backup", made it executable and put it in /usr/local/bin/, to do the job for me as follows (it needs to be run as root):
#!/bin/bash START=`date +%T` rsync -aP --exclude-from=/home/storage/rsync-homedir-excludes/rsync-homedir-excludes.txt /home/ /media/DataBackup/home END=`date +%T` echo Backup started: $START echo Backup ended: $END
Note that from rsync to /media/DataBackup/home is all one line.
The file specified in --exclude-from contains a list of patterns used to tell rsync not to backup certain files or directories. In my case, as I use the Vivaldi browser and want to exclude the various temporary and cached files I have the following lines in /home/storage/rsync-homedir-excludes/rsync-homedir-excludes.txt:
.config/vivaldi/ShaderCache .config/vivaldi/*/Local Storage .config/vivaldi/*/Session Storage .config/vivaldi/*/Application Cache .config/vivaldi/*/History Index * .config/vivaldi/*/Service Worker/CacheStorage
rsync in this case will only write files that either were not on the last backup, or have been updated since the last backup. So the more frequently you run the script, the less time it will take. It will also, during backup, delete files from the last backup that you have since deleted from your computer. So it's quite a clever program. If you tried to do this either from a file manager using its copy command, or from a terminal using "cp", the outcome would be a total mess.
Finally, I suggest that you also copy the backup script to /home/storage so that you will have a copy of it should your computer have an accident wiping your data.