home " subscribe " advertise " customer service " back issues " " contacts

 
Sections
  Newbies
  Reviews
  How To
    Best Defense
    Guru Guidance
    On The Desktop
  Developer's Den
    Gearheads Only
    Compile Time
    Perl of Wisdom
  Who's Who
 
Indexes
  Issue Archive
  Author Index
 
Linux Magazine
  Subscribe
  Advertise
  Customer Service
  Back Issues
  
  Contacts
 
On Stands Now Click to view Table of Contents for Linux Magazine March 2000 Issue
Newsletter
  Enter email address:
   
Subscribe to Linux Magazine

Linux Magazine / July 1999 / GURU GUIDANCE
Linux Backup Primer
 
       page 01 02 03 04   next >>

GURU GUIDANCE
Linux Backup Primer
by Tim Jones

One of the frequently asked questions regarding Linux system administration is, "How do I backup my system?" While backup on a Microsoft platform is pretty straight forward (click on the backup button or select backup from the Start menu), Linux backups can be quite intimidating if you're not familiar with the UNIX paradigm of files and devices. This column will explore the devices and methods involved in protecting the data that exists on your Linux systems.

What is a Backup?

In the simplest terms, it is the process of making copies of your data onto alternate media (usually removable) in order to allow the recovery of that data in case the original is lost. A backup can simply be a copy ('cp') of a file or files to another location, or it can be a stream of data that is written out by a special program ('tar') to a special device or location.

Many admins automatically equate backup to tape drives, but this isn't necessarily true. Under Linux, or any other UNIX variant, backups can be made to files on the existing filesystems, alternate filesystems, tape drives, remote systems, and even tape drives on remote systems. Also, from a user-level perspective, there are no "tape drives" or "Zip drives", just files (as we will explain shortly).

What Device Should I Use?

There are a vast number of devices out there that are marketed as being "perfect for system backup". These include tape drives, removable disk drives, and even mystical "Internet backup" systems. For backup operations, tape drives offer the surest storage method. Why tape? Well, while a Jaz or Zip drive from Iomega may seem interesting as a backup, they tend to be hijacked for filesystem duties when hard drives get cramped. As for the mystical Internet backups, if you can't get onto the Internet because of a crash, how can you restore the data that will get you back on? Also, do you really trust your data to someone else's remote systems?

So now that we've settled on the tape drive, how do we access it? As I mentioned earlier, everything on a Linux system can be considered a file when examined in user space (versus kernel space). Therefore, we 'open' the appropriate tape drive "file" for writing and write the data out to the file. While this sounds like an oversimplification, it is what actually occurs. The /dev directory on the root filesystem contains all of the "files" that are associated with physical devices (like a tape drive) under Linux. When you manipulate those files, you are actually manipulating the underlying device. Figure 1 illustrates how device files are associated with physical devices under Linux.

Figure 1: How Device Files Correspond to Physical Devices

 Device               Rewinding    No-Rewind
 1st SCSI tape drive    /dev/st0        /dev/nst0
 2nd SCSI tape drive    /dev/st1        /dev/nst1
 nth SCSI tape drive    /dev/st[n-1]    /dev/nst[n-1]
 
 1st ATAPI tape drive    /dev/ht0       /dev/nht0
 2nd ATAPI tape drive    /dev/ht1        /dev/nht1
 nth ATAPI tape drive    /dev/ht[n-1]    /dev/nht[n-1]
 
 1st floppy tape drive    /dev/ft0       /dev/nft0
 


As you can see from the table in Figure 1, the device names are based upon the logical number of the device within the interface hierarchy for that device type, not its physical id (SCSI) or IDE channel (ATAPI). Therefore, even if the SCSI tape drive was assigned SCSI ID 4, if it is the first TAPE device on the SCSI chain, it would be /dev/st0, not /dev/st4. This convention makes it easier to keep track of your tape drives and even applies across multiple adapters. Also, note that under the 2.0.x kernels, only a single ATAPI drive is supported. Under the 2.2 kernels, you may use multiple ATAPI drives (ht0, ht1,...).


       page 01 02 03 04   next >>
 
Linux Magazine / July 1999 / GURU GUIDANCE
Linux Backup Primer

home " subscribe " advertise " customer service " back issues " " contacts