Editor's Note: Tip Top Tips is a semi-monthly column in The PCLinuxOS Magazine. Periodically, we will feature – and possibly even expand upon – one tip from the PCLinuxOS forum. The magazine will not accept independent tip submissions specifically intended for inclusion in the Tip Top Tips column. Rather, if you have a tip, share it in the PCLinuxOS forum's “Tips & Tricks” section. Occasionally, we may run a “tip” posted elsewhere in the PCLinuxOS forum. Either way, share your tip in the forum, and it just may be selected for publication in The PCLinuxOS Magazine.
This month's tip comes from forum member davecs.
Image by OpenClipart-Vectors from Pixabay
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.
You get the file rsync-homedir-excludes.txt from this page. In my case, as I use the Vivaldi browser, and Vivaldi uses the same architecture as Google Chrome. I have copied the lines relating to Chrome and changed them for Vivaldi as follows:
#Vivaldi:
.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.
|