Horneker Online

Home >> Wallpapers for the PCLinuxOS Distribution


Always Back Up Your Data

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 download Clonezilla, then burn a live CD (or write to a USB flash drive), 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:

CD-R 700 MB: 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 700 MB: 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.7 GB: 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.7 GB: 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.7 GB: Same as DVD-R discs, except that these are reusable. You need to reformat these discs to reuse them.

DVD+RW 4.7 GB: 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 50 GB: 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. As one can guess, these discs have a capacity of 8.5 GB. Not all DVD readers or DVD writer drives can read these 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

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 16MB (for older 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.

Digital Photography Note: At some universities and community colleges, if you take a digital photography course, a external hard drive is required for storage of photographs you create for your assignments, so when you complete that course, you will already have a external hard drive available.

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.

A new filesystem called exFAT was created for USB flash drives and memory cards whose capacities are 128 MB or larger. Mounting these devices in Linux is the same with exFAT as it is with VFAT.

You can reformat flash drives, memory cards and external hard drives using the ext2, ext3, or ext4 filesystem using the mkfs command (for make file system). However, if you do, you can only use these devices under Linux as Windows will not work with the ext2, ext3 or ext4 filesystems. (But then, can we really expect Windows to do so?) I recommend keeping these devices formatted for VFAT (or exFAT) for portability among computers.


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 are not recommended

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.

I used the term cracker attack rather than hacker attack as there are two types of hackers in the world of computer science. The type portrayed in the US media is really termed a cracker, or someone whose intent is to unlawfully log in to a computer network (more often than not for profit). The other type of hacker is someone who likes to tinker and modify hardware and software for educational purposes or simply out of curiosity. This is the type of hacker referred to by Dr. Richard M Stallman, who has been advocating freedom in technology since the late 1960s, and is the founder of the Free Software Foundation.


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, Banshee, and Amarok 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.

However, some distributions such as Slackware only setup a home directory. It is up to you to setup the structure for organizing your data. The following are typical directories on your user account and their intended purposes

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

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 music files used by 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 Shotwell.

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


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 Brasero 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.

Finding the Device Name for USB Storage Devices

Let us say we want to use a flash drive for a backup device. If you are running KDE, GNOME, XFCE or LXDE, simply plugin the flash drive and an icon representing the flash drive will appear on the screen. All you need to do is double click on the icon to mount the flash drive and open a file manager window. Then double click on the icon labelled Home to get the contents of your home directory. To backup these contents, simply select all icons (Hold down Control, then press A to select all icons), then using your mouse, drag these icons to the window representing your flash drive. If a popup menu appears, select Copy and watch the action on your screen as your home directory files are being copied to your flash drive.

But what if you are using another desktop environment such as WindowMaker, or are in the console (text) mode. You will need to find the device name for your flash drive when you plug it in. Plug in the flash drive and open a terminal window (if you are using a desktop environment). You will need to login as root for the next step.

With the terminal window open type su -c "dmesg", press Return, then type in the administration password (i.e. the password for the root user) and press Return. If you are using Ubuntu or a distribution that uses sudo rather than su, then you would type in sudo dmesg, then the administrator password.

You should then see something like this:

[17127.770150] usb 2-1: new high-speed USB device number 7 using ehci-pci
[17127.886832] usb 2-1: New USB device found, idVendor=0c76, idProduct=0005
[17127.886842] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[17127.886850] usb 2-1: Product: USB Flash Disk
[17127.886857] usb 2-1: Manufacturer: 3SYSTEM
[17127.886863] usb 2-1: SerialNumber: 00EA0109207BF9B1A4282BE4
[17127.887432] usb-storage 2-1:1.0: USB Mass Storage device detected
[17127.887606] scsi11 : usb-storage 2-1:1.0
[17128.889890] scsi 11:0:0:0: Direct-Access 3SYSTEM USB Flash Disk 1.00 PQ: 0 ANSI: 2
[17128.891981] sd 11:0:0:0: [sdc] 8002864 512-byte logical blocks: (4.09 GB/3.81 GiB)
[17128.892825] sd 11:0:0:0: [sdc] Write Protect is off
[17128.892835] sd 11:0:0:0: [sdc] Mode Sense: 03 00 00 00
[17128.893455] sd 11:0:0:0: [sdc] No Caching mode page found
[17128.893464] sd 11:0:0:0: [sdc] Assuming drive cache: write through
[17128.896572] sd 11:0:0:0: [sdc] No Caching mode page found
[17128.896582] sd 11:0:0:0: [sdc] Assuming drive cache: write through
[17128.897493] sdc: sdc1
[17128.900227] sd 11:0:0:0: [sdc] No Caching mode page found
[17128.900231] sd 11:0:0:0: [sdc] Assuming drive cache: write through
[17128.900235] sd 11:0:0:0: [sdc] Attached SCSI removable disk

This example represents a DaneElec 4GB flash drive that I use to backup my photographs, with Solid State System (of Zhubei City, Taiwan) being the actual manufacturer of the flash drive. Here, the device was detected by Linux and assigned the device name /dev/sdc. On my laptop, /dev/sdb represents the built-in SD card reader and /dev/sda represents the hard drive. Note that the flash drive has only one partition, formatted with the VFAT filesystem, for compatibility with other Linux/UNIX systems, Mac OS-X, and of course Windows. This partition is given the name /dev/sdc1. /dev/sdc1 is the name that we want to use to mount the flash drive before copying files. /dev/sdc represents the entire flash drive.

Mounting the Flash Drive

There are two directories in UNIX world that we can use to mount the flash drive. They are /mnt and /media. The latter was intended to be used for removable devices, such as flash drives, while the former was intended to be used for hard drives and devices that are constantly in use throughout a Linux session, such as a second hard drive (commonly found on servers and desktops), or a connection to a server within the same internal network or intranet.

I recommend using /media to mount the flash drive. Mounting the flash drive requires administrator access, so we must login as root for the next step. This is done by typing su or sudo -i, then entering the administrator password.

If you are using Plasma 5, MATE, XFCE, Lumina, LXDE or Enlightenment, PCLinuxOS will automatically mount your flash drive or memory card and assign it a name.

Once logged in as root, type ls -l /media. You should be able to see your mounted device. If that device has not been mounted automatically, you should type in the following:

mkdir mount-name
mount -t vfat /media/mount-name /dev/device-name

where mount-name is a name you assign to the point where the flash drive or memory card is to be placed in the filesystem, and device-name is the name of the flash drive or memory card assigned by PCLinuxOS when it detected the device.

Linux/UNIX Note: Everything in Linux/UNIX is considered a file and the directory structure is the Linux/UNIX mechanism for the basic operation of your computer. All devices, whether it be a hard disk, a network connection, a printer, or a mouse, must be mounted (or attached) to this directory structure in order to be used. When finished, devices must be unmounted from the directory structure so Linux/UNIX will know that the device is no longer available for use.

If you are using Plasma 5, MATE, XFCE, LDXE, Lumina or Emlightenment, you should unmount the device by selecting that device from the Device Notifier applet on the toolbar, and then select the icon representing Eject to unmount the device.

For all others, simply open a terminal, login as the administrator with the su command, then type umount device-name to unmount the flash drive or memory card.


Now make the backup

If you are using the command line to make your backups, you already have the mount point as the destination where to backup your files. Simply type in for each directory in your user space:

cp -vr directory mount-point

The v tells the copy command cp to display all files being copied to the backup device. The r tells the command to traverse all directories within the specified directory and to copy all files within that directory.

If you are using a graphical file manager, simply open two windows: one for the files to be copied to the backup device, and one for the backup device itself.

Once the windows are opened, simply select the files to be copied and drag them to the window representing the backup device. Alternately, you may press Control-C after selecting the files to be backed up to tell the file manager to copy the files to the clipboard. Then select the window representing the backup device and press Control-V to paste the files to the backup device.