banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Backing Up Your Files


by The PCLinuxOS Magazine Staff

If you have been running a computer system for a while, it will be tuned to your personal taste, and without doubt, you will have accumulated a large number of mostly insignificant files, together with a few crucial ones which you cannot afford to lose.

When your system breaks, for whatever reason, you need to be able to get it back up again ... fast. When your files disappear, you need to get them back. If you have backups, you are cushty. If not, perturbed.

Any number of things can break files and systems. Power spikes/brownouts, hardware breakages, bad updates, user abuse, stupidity, fire, weather events, a mad axeman. The problem will inevitably arise unexpectedly and usually at the worst possible moment to upset your tranquillity.

To ameliorate such a happenstance, you need backups of your files, and maybe your system. There are an abundance of gotchas you need to consider. For example, if you are doing a synchronised copy from a source to a destination, you need to be aware that if your source files are corrupted, then so the destination files will be, too. If the destination backup has an issue, then you have no backup. If your source and backup files are in the same box or building, then you have no backup if the box/building is destroyed. Off site and offline backups of particularly critical files are to be commended, but given special consideration.


Backing up your system.

For free software systems, we can download a system ISO and reinstall, followed by updating and tweaking to get a system back as it was. This can be a little time consuming.

You can alternatively backup your al dente system by making a "live" ISO with the nifty mylivecd utility from time to time. My own preference is to backup my system partition (sda1 on my computer) with a clonezilla "live" disk once a month, with two images available. This has saved me many times over, usually from my own meddling. There are tutorials for both of these on the forum and for Clonezilla in the June 2011 magazine back issue.

For a Clonezilla "live" session the procedure is:

Saving > Beginners Mode > Save Parts > This sda1 partition > Done
Recovery > Expert Mode > Recover Parts > This image > Don't touch MBR > Done

For me, saving and recovery are a five minute job. Your results may differ, based on the speed of your DVD writer, the medium being used to record the disk images, the size and speed of your hard drive, the amount of memory on your system, and the processor speed. Some users could see their efforts take two hours, or more. However, it's a well spent two hours or more, to protect your data.



Backing up files.

For backing up files, the rsync command is your friend. If you want a nice front end, Luckybackup is powerful and easy. There is a nice tutorial in the July 2011 magazine back issue.

The mechanics of the rsync command are easy (ensure you run as root if backing up for many users):

rsync --archive --delete /source /destination

--archive preserves all permissions
--delete synchronises source and backup files (watch out for corrupted source files)

Note /source means copy over the directory and subdirectories of /source. Whereas /source/ (see the trailing slash) means copy the contents of / source. Be careful.



To make this happen without you worrying about it, create a script with something like kwrite and make the file executable. Then as root in Configure Your Desktop > Task Scheduler, create a recurring cron job to run your script when you want it to run. Ensure this cron job is a Personal Cron for root rather than a System Cron: otherwise it will not work.

Example simple script to copy to a second attached backup drive:

mount -t ext4 /dev/sdb1 /Backup
rsync --archive --delete /home/user /Backup/home
echo "Job done, bye"
umount /dev/sdb1

If the user has purchased a new external drive for this type of backup, that user will have to reformat the external drive for ext4 BEFORE executing the script. Most new external hard drives are generally formatted for FAT32 or NTFS, as they are intended to be used with W*****s systems.

Also, the mount point must be created on the main hard drive before executing the script. It is not recommend creating a separate directory, such as /Backup, on the root directory of any system's hard drive. All you need to do is delete the wrong directory by accident, and you will have to reinstall the entire operating system.

Instead, it's recommend to create "Backup" in either /mnt or /media (e.g. /mnt/Backup or /media/Backup. It is much safer to do this.

I am a KDE user and for my /home directory I ensure I have a copy of the .kde4 hidden dot file (desktop settings) and also the desktop wastebin trash.desktop, which I regularly delete. (You can always copy one over from another user and change the permissions).

Email is something you may wish to backup separately. Email clients usually have something to facilitate this, or if you know where your email is stored you can make your own arrangements.



Critical Offsite Backups.

You may well have critical and confidential files which you cannot afford to lose, and do not want them to be read by outsiders. For this the solution is to put them into a file container and encrypt them. Sent the file container to wherever you like, and when needed, recover them.

zuluCrypt is a nifty and easy to use utility. Create a container, load it with your files and send it on its way in its encrypted form.


CAUTION! BEWARE!

Before backing up anything off site, be aware of where you are storing your backed up data. Privacy and security of your backed up data should be paramount. Cloud service, such as Dropbox, are a good idea for convenience sake. However, privacy and security are not guaranteed, especially with recent events concerning Internet surveillance (NSA, GCHQ, rogue governments and groups, coups, etc.).

If you want to ,b>guarantee safety and security of your backed up data, I recommend using physical medium such as recordable DVD (DVD-R, DVD+R, DVD-RW, and DVD+RW, both single and dual layer) discs, USB flash drives, and memory cards. Recordable DVDs are relatively inexpensive compared to purchasing an external hard drive.

Also, PCLinuxOS provides K3B or Brasero for creating backups of your home directory. Simply select directories to be included on each disk. K3B tells you how much space you have used as you add files. Then burn the DVD. This takes some time and effort, but the results will be well worth the effort. You will have your data preserved on DVD discs, and you do not need to connect to the Internet to accomplish this, ensuring security of your data.



WIth USB flash drives now being available in sizes ranging from 4GB to 128GB, it is now possible to backup an entire home directory with minimal cost ($16.00 for 16GB at Big Lots) and on a device that will fit into your shirt pocket. Try that with an external hard drive.

Also, with the prices of physical storage medium so affordable, it might be a good idea to make two copies, and then store one off site (a bank safety deposit box might be a good choice). This way, if a disastrous calamity should strike your primary place of residence (fire, floods, tornadoes, hurricanes, landslides, etc.), your critical files and information are safely stored in a second location.


Summary

If you think ahead then when the inevitable happens and you have a borked system or accidentally delete a critical file, it is a non-issue. If your backup system is not in place or otherwise impaired, then you are in a bad place. As ever, with free software, it is your choice.

This article was the collaborative effort of several members of The PCLinuxOS Magazine staff. Contributing (in no particular order) were parnote, Meemaw, YouCanToo, Phil, and phorneker.



Previous Page              Top              Next Page