horneker online

Sysadmin 101: Always Back Up Your System

PCLinuxOS Version

Introduction

Anytime we work on a computer, whether we write that great term paper, enhance a photograph, or digitize your record/cassette/CD collection, we create data files which are generally stored on your hard disk. (At least it was until the advent of the cloud computing concept.) One would think that these data files are safe stored on a local hard drive. This is, was, and always will be nothing more than a myth. Truth is that data, once saved to disk are available when you next power up your desktop, netbook or laptop. However, what if something unforseen happens, such as accidental erasure of important files, or your hard drive is damaged, or fails completely, or something completely worse like a security breach.

The latter, of course, is very unlikely to happen on Linux/UNIX only if basic security precautions are taken. Thankfully, many distributions have these precautions enabled by default at the time of installation, though the basic security on Mac OS-X is debatable. But this is not the topic of this page.

What I am talking about is the safety of the software and data files on your Linux/UNIX machine. There are many ways to going about backing up of your data and software. Having the original installation DVD helps to restore the Linux distribution in case you need to reinstall Linux.

First, let us discuss backing up of your data. Backing up is defined as making a copy of all files we want to protect from disaster onto a separate physical medium for the purpose of restoring such files if and when needed. On most any Linux machine, user data files are stored in /home/username, where username is the name of the account you are currently logged in. We could backup the entire /home directory, or individual users could backup all files in their respective accounts, resulting in one set of backed up files for each user.

If we are interested in backing up the entire system, we could install Clonezilla, burn a live CD supplied with Clonezilla, and use that and a external hard drive (of the same or greater capacity as the internal hard drive) to backup the entire contents of your hard drive.

Many of us just want to backup our data files. In the early days of computing (late 1960s to the 1990s), we typically used magnetic tape or floppy disks to create data backups. These days, blank CD/DVD discs, external hard drives, memory cards, and USB flash drives are the common medium in which to backup our data.

This page covers backing up of data on one Linux/UNIX machine, typically that which is used in a home, on the road (as in a laptop or netbook), or in a small business. Backing up of data on multiple machines throughout a network is beyond the scope of this page, and requires additional (and somewhat complicated) procedures to accomplish the task.

Blank CD/DVD Media

Backing up to CD/DVD media (or even Blu-ray discs) is a inexpensive and somewhat permanent way to preserve your data. You will need a CD burning program such as K3B or Brasero to accomplish this task, and a compatible CD/DVD writer. Fortunately, most DVD writers will work with Linux, be it internal or external, so finding compatible hardware should not be an issue.

The medium on the other hand can be problematic. Not all medium is compatible with all CD/DVD/Blu-Ray writers. The following is a table of the disc types and their capacities:

Disc Type Capacity Notes
CD-R 700MB Available in CD-R Data and CD-R Audio, with the difference being that CD-R Audio was optimized for recording audio CDs. These discs can only be recorded once, and never recorded on again. This type of disc is ideal for small (700MB or less) archives of photographs and documents
CD-RW 700MB These type of discs are reusable. Formatting of these discs is required if they are to be reused. Note: Some older Sony CD-RWs have a capacity of 650MB rather than 700MB.
DVD-R 4.7GB These discs can only be recorded once in a single session. This means that once you have recorded on them, the discs cannot be reused. This is ideal for full and long term backups of your data.
DVD+R 4.7GB These discs can be recorded more than once, but each session is appended to the end of the previous session on the disc. For these types of discs, I recommend backing up as close to 4.7GB as possible of your data to make the most of these discs.
DVD-RW 4.7GB Same as DVD-R discs, except that these are reusable. You need to reformat these discs to reuse them.
DVD+RW 4.7GB These are the most versatile of the DVD discs. You can reuse them, and there is no need to reformat these discs. Simply rewrite over them.
Blu-Ray 50GB This type of optical CD is large enough to hold the PCLinuxOS repository (a whopping 50GB capacity).

There is a Double Layer variant of the DVD-R and DVD+R. I have not been able to successfully write to these discs, even though my DVD writer is supposed to support these type of discs.

Backing up data using blank CD/DVD discs requires some planning on not only how many discs to use for the backup, but how to organize the data being backed up. For example, you could use two blank DVDs for storing video projects, one blank DVD for photographs, one blank DVD for documents, and one blank DVD for music stored on your computer.

USB Mass Storage Devices

A more common medium for backing up of data is the use of USB mass storage devices. Linux treats these devices as if they were just another disk. To backup files to these devices, simply mount, copy the files to be backed up, then unmount when you are done. This depends on the desktop environment you are using (such as KDE, GNOME, MATE, LXDE or XFCE) and whether you are using a file manager or not.

USB flash drives are the most portable and easiest to use for data backup. Simply plug it in and Linux will automatically mount the flash drive (depending on the desktop environment you are running). Flash drives range in capacity from 2GB to 128GB (though older flash drives have much smaller storage capacities).

Memory cards such as SD/MMC (all variants), Memory Stick(TM) (all variants), and Compact Flash, are commonly used in devices such as digital cameras, media players, portable gaming consoles, cellular phones (smartphones as well as the basic models), and the Raspberry PI . Memory cards can also be used for backup storage as well as Linux installation (especially on netbooks). As with USB flash drives, capacities vary from 32MB (for the oldest memory cards) to 256GB (which is enough to backup some hard drives) available.

External hard drives are the preferred devices for backing up of data. They are quite expensive when compared to USB flash drives and memory cards, but they are designed to be used to backup your entire hard drive. Capacities (as of this writing) range from 256GB to 2TB. This is the preferred medium for use with the Clonezilla product to backup your entire hard drive.

Other devices such as media players contain flash memory and can be used as backup devices. However, I do not recommend doing so if you plan to use that device for which it was intended.

One thing that is common with USB mass storage devices is that they generally come formatted with the VFAT filesystem. VFAT stands for Virtual File Allocation Table, and is called FAT32 in the Windows world. File Allocation Tables are a small portion of the disk set aside to keep track of what files are where on the disk and how much space they take up. This file system was introduced with the original IBM Personal Computer back in 1981, and has been in use ever since. In fact, USB mass storage devices are the only reason that FAT is still in use today.

USB 3 Considerations

USB 3.0 is the latest specification that promises data transfers that much faster than USB 2.0. To get that kind of data transfer speed, you must have a USB 3.x controller either built-in to your machine, or a separate controller installed on your machine.

Thankfully, USB 3.x is backwards compatible with USB 2.0 devices. The downside here is that data transfers are limited to USB 2.0 speeds (about 480 megabits per second versus 5 gigabits per second for USB 3.0, and 10 gigabits per second for USB 3.1).

Also, a recent Linux kernel (at least a 4.0 series) is required to use USB 3.0 and 3.1 devices under Linux. But the kernel is only half the equation for getting USB 3.x devices to work under Linux.

USB 3.0 was designed to work with desktops and laptops built in the 2010s. So, if you have an older laptop or desktop, there is no guarantee your machine will be able to accommodate a USB 3.0 or 3.1 controller. In this case, you may have to settle for USB 2.0 speeds.

That brings us to the topic of USB 3.0 storage devices. Before purchasing a USB 3.0 flash drive or external hard drive, make sure it can work with USB 2.0 controllers, or you are going to have serious issues with your desktop or laptop using the flash drive or external hard drive.

I have seen some newer flash drives available that are USB 3.0 only. Avoid these unless you have a USB 3.0 controller installed on your machine.

Cloud Services

Thanks to the advent of cloud computing (and Web 2.0 in general), there is another means for backing up your data. Services like Carbonite allow you to backup your data onto remote servers (for a nominal fee, of course).

While this may keep your data safe and accessible, the security of your data comes into question. How can we be really sure that the data you store on remote servers is safe from cracker attacks, or from prying eyes? Companies that provide such services can only promise such protection such as encryption of your data. There is still the possibility that your data is not truly safe, especially at a time when surveillance issues are still hot topics.

Because of this, I still recommend using physical medium to backup the data files on your hard drive.

On the other hand, PCLinuxOS comes with its own cloud service. This service is built on NextCloud, and comes with 5GB of storage. To get this service, You must have an account on the User Forum, and be an active member.

Organizing Your Data

Making backups of your data can be easier if you have your data files organized in your home directory (or folder if you are used to Windows and Mac OS). By organizing your data files, you can easily select which files to backup simply by specifying the directory they are stored in. (Another reason for doing this is that some applications such as DigiKam and Clementine expect their data files to be located in subdirectories such as /home/username/Pictures and /home/username/Music, where username is the name of the account you logged into.

The following are some directories found in a PCLinuxOS installation:

Desktop: This directory contains files created and used by desktop environments such as KDE, Lumina, XFCE, LXDE and MATE.

Documents: This is where documents you create and edit are normally stored.

Downloads: Anything downloaded from a web browser such as Firefox and Chrome is stored here.

GNUstep: This directory is used by WindowMaker and AfterStep window managers to store their configuration and resource files.

Music: This directory contains digitized music files and is the default directory for Clementine, aTunes, Mixxx, and other software media players. Subdirectories here generally are named to represent albums that have been digitized.

Pictures: This directory is where digital photographs are stored, and is the directory expected to be present with DigiKam and LightZone.

Videos: This directory is where digital videos are stored, and is used by MPlayer, SMPlayer, OpenShot, Xine, and VLC

How Much and When

Here, we need to make a plan on what type of backup we are doing, and how often to perform backups.

Full Disk Backup: This is where we need to copy the contents of the entire hard disk. I recommend Clonezilla and a external hard drive of at least the capacity of the hard drive on your computer for this task. After installing Clonezilla, burn the liveCD image that comes with Clonezilla and reboot your system with that and your external hard drive attached to backup your hard drive.

Full Data Backup: For this type of backup, you simply make a copy of the contents of /home onto blank CD/DVD discs, USB flash drives, memory cards, or to an external hard drive.

Full Home Directory Backup: Use this option if you are the only user on your Linux system, or if you want individual users to be responsible for their own data backups.

Incremental Backups: This option supplements the full backup options by providing updates to the full backup set. To restore data if needed, you will need to restore the full backup first, then the incremental backups.

Software for Making Backups

Though software is available dedicated to making backups of your data, your Linux distribution contains all the tools you need to accomplish this task (unless you are planning to backup data and software).

Applications such as K3B and SimpleBurn can be used to create data backups to CD/DVD/Blu-Ray discs. Making backups to USB storage devices is much easier. Simply plugin and mount the device, copy the files to be backed up, then unmount the device.

If everything went OK, then you have successfully backed up your home directory.