Freelance Writing Jobs | Today's Articles | Sign In

 

Linux Data Backup Software and Recovery

Archiving Files with the Tar and Gzip Utilities

Nov 16, 2009 Fleur Hupston

Automating a data backup routine that is reliable and cost effective can be easy with a Linux based computer.

Linux comes with reliable data backup software for archiving files that can work with easy to write scripts. These scripts can then be scheduled to run a a certain time, informing the administrator by e-mail that the backup has been successful.

Linux Data Backup Software

Linux comes with a number of command line utilities, the most popular of which are tar and gzip. Linux has combined the tar and the gzip utilities to give a data backup solution that uses the excellent archiving capabilities of tar and the compression of gzip.

Using these two products together gives the network administrator a good all round data backup and data backup recovery solution. The “tar” utility archives but doesn’t compress very well, so Linux has incorporated additional “switches” that make use of the compression abilities of “gzip”. A Linux backup solution is inexpensive and reliable.

Back up Data Using Tar

The command to archive using the tar utility, and compress using the gzip utility data is “tar -vzcf filetocreate.tar.gz /files/tobackup”. “-v” means “verbose”, whereas the “-z” means use “gzip” to compress. “-c” and “-f” mean “create” and “file” respectively. In order to archive without compression, just use the same command without the “-z” as follows, “tar -vcf filetocreate.tar.gz /files/tobackup

For example, if one were to backup and compress the “/home” directory into a file called “backup.tar.gz” in the “backup” directory, one would type the following command:

tar -vzcf /backup/backup.tar.gz /home/

In order to archive only, the “z” would be left out of the command

It is not necessary to give the archive file a particular file extension, but of the sake of indicating the type of file and whether it was compressed or not, it is a good idea to use a file extension that indicates this. The above example uses the file extension “tar.gz” to indicate that the file was created with the tar utility and compressed with gzip.

Data Backup Recovery Using Tar

The command to restore an archived and compressed file is “tar -vzxf backupfile.tar.gz” The command to restore an archived only file is “tar -vxf backupfile.tar

To extract to a different location you would include the “-C” switch followed by the location, as follows:

tar -vzxf backup.tar.gz -C /home/extracted/

To extract selected files use the “tar -vzxf zipfile.tar.gz location/filetoextract.txt” command.

Viewing the Content of a “tar.gz” File

A archive file can be viewed with the following command.

tar -tzvf /backup/etc.tar.zg | more

This command allows the administrator to see what is in the archive file.

How to use Incremental Backup Utility to do a Computer Backup

For an incremental backup, tar needs to generate a “snapshot” file which tells tar which files have been backed up and when. To generate this file, tar uses the “-g” switch as follows:

tar -cz -g /backup/snapshot_file -f /backup/backup_monday.tar.gz /home

The first time this command is run, tar will do a full backup and create the snapshot file if it doesn't exist. Change the name of the “tar.gz” file for each backup that is run after the initial run as the following example shows:

tar -cz -g /backup/snapshot_file -f /backup/backup_tuesday.tar.gz /home

Using Linux Utilities as Data Backup Software

Linux provides a robust and effective data backup and data backup recovery solution which can easily be incorporated into a simple script. This script can include a command to e-mail the administrator once the backup has completed successfully.

The backup script can also be scheduled to run as a scheduled task after hours without human intervention. A Linux backup solution is inexpensive and reliable.scheduled task after hours without human intervention. A Linux backup solution is inexpensive and reliable.

Not only does Linux provide a reliable backup solution, but also a number of other Open Source solutions that are equally reliable and cost effective. A Linux server can function as a data server, mail server, firewall, web server and proxy server to name just a few examples.

The copyright of the article Linux Data Backup Software and Recovery in Computer Software is owned by Fleur Hupston. Permission to republish Linux Data Backup Software and Recovery in print or online must be granted by the author in writing.
Linux Backup, notacias Linux Backup
Data Backup Recovery, ilco Data Backup Recovery
 
What do you think about this article?

NOTE: Because you are not a Suite101 member, your comment will be moderated before it is viewable.
post your comment
What is 4+1?

Related Topics

Reference


;