Selecting a Backup Medium


Armed with a backup strategy in mind, it's time to select a backup medium. Several types of backup hardware and media are available for use with Fedora and RHEL. Each type has its advantages and disadvantages.

The type of medium to choose depends largely on the amount of data you need to archive, how long you will store backups, how often you expect to recover data from your backups , and how much you can afford to spend . Table 13-1 compares the most common backup media.

Table 13-1: Comparison of Common Backup Media
Open table as spreadsheet

Backup Medium

Advantage

Disadvantage

Magnetic tape

High capacity, low cost for archiving massive amounts of data.

Sequential access medium, so recovery of individual files can be slow.

Writable CD

Random access medium, so recovery of individual files is easier. Backups can be restored from any CD-ROM drive.

Limited storage space (up to 700MB per CD).

Writable DVDs

Random access medium (like CDs). Large capacity (4.7GB, although the actual capacity you can achieve might be less). DVDR-9 and DVD-9 DVDs can store up to 8.5GB of data.

DVD-RW drives and DVD-R disks are relatively expensive (although they are coming down in price). As more manufacturers add DVD writers to their PCs, DVD will eventually replace CDs as the most common removable media drives .

Additional hard drive

Allows faster and more frequent backups. Fast recovery from crashes. No media to load. Data can be located and recovered more quickly. You can configure the second disk to be a virtual clone of the first disk, so that you can boot off of the second disk if the first disk crashes.

Data cannot be stored offsite, thus there is risk of data loss if the entire server is destroyed . This method is not well suited to keeping historical archives of the many revisions of your files. The hard drive will eventually fill up. By using removable hard drives, you can overcome this limitation by removing the backup drive when it is full and moving it to a secure location.

The following sections describe how to use magnetic tape, writable DVDs, and writable CDs as backup media. Using additional hard drives as backup media is described later in this chapter.

Magnetic Tape

Magnetic tape was for years the most common medium used for backing up large amounts of computer data. Tapes provide a low-cost, convenient way to archive your files. Today's high-capacity tape drives can back up many gigabytes of data on an amazingly small tape, allowing vast amounts of information to be safely stored. Tapes are also easy to transport offsite so that data will be secure in case of fires, hurricanes or other disasters.

The primary disadvantage of magnetic tape is that it is a sequential access medium. This means that tapes are read or written from beginning to end, and searching for a particular file can be time-consuming . For this reason, tape is a good choice for backing up and restoring entire file systems, but not the ideal choice to recover individual files on a regular basis.

Fedora and RHEL can use a wide variety of tape drives. Most SCSI tape drives will work without loading special modules. Even many IDE tape drives are now supported natively, without requiring the drive to operate in a "SCSI emulation" mode. Some drives, however, require installation of additional software.

Using ftape Tools for Magnetic Tape

If your tape drive is attached to an IDE floppy controller cable, you will need to use the ftape driver to access it. Fortunately, the ftape loadable module is bundled with the Linux 2.6 kernel. When your Linux system boots, it should autodetect the tape drive and load the ftape driver. To verify that your system loaded the tape driver, type the following command shortly after you boot your computer:

 dmesg  grep ftape 

This searches the most recent kernel messages for lines containing the word ftape . If the ftape module was loaded, you should see something like this:

 ftape v4.04d 25/11/97 [000] ftape-init.c (ftape_init) - installing QIC-117 floppy tape hardware drive... . [001] ftape-init.c (ftape_init) - ftape_init @ 0xd08b0060. [002] ftape-buffer.c (add_one_buffer) - buffer nr #1 @ c1503914, dma area @ c02c0000. [003] ftape-buffer.c (add_one_buffer) - buffer nr #2 @ c1503c44, dma area @ c0298000. [004] ftape-buffer.c (add_one_buffer) - buffer nr #3 @ c50abaac, dma area @ c0328000. [005] ftape-calibr.c (time_inb) - inb() duration: 1109 nsec. [006] ftape-calibr.c (ftape_calibrate) - TC for `ftape_udelay()' = 310 nsec (at 20479 counts). [007] ftape-calibr.c (ftape_calibrate) - TC for `fdc_wait()' = 2208 nsec (at 2559 counts). 

If the module was not loaded, then you should check whether your kernel is compiled with support for the ftape module and your particular tape drive. It should be available and ready to include as a loadable module.

In most cases, an ftape device can be accessed just like a SCSI device. The primary difference is that an ftape device file contains the letters qft (for QIK Floppy Tape) where a SCSI tape contains st . For example, the device file for the first SCSI tape on your system will probably be /dev/st0 ; the device file for the first floppy tape will likely be /dev/qft0 .

All of the standard tape- and archiving- related programs should work fine with both types of hardware. Nevertheless, there are a few extra programs that you might find useful when working with a floppy tape drive. These programs can be found in the mt-st package in Fedora Core. The mt command is used to control magnetic tape operation. The stinit command can initialize SCSI magnetic tape drives.

Testing the Magnetic Tape Drive

With the mt-st package installed, you should now be ready to test your tape drive. Insert a blank tape into the tape drive and type the following commands:

 $  mt -f /dev/qft0 status  $  mt -f /dev/qft0 rewind  

The first command will present a status of the tape drive. After the second command, you should hear the tape spin as the system rewinds the tape. This will be a very short process if the tape is already rewound. The mt command provided with mt-st package is used to scan, rewind, and eject magnetic tapes in a tape drive.

Writable CD Drives

Another backup medium that is gaining popularity is the writable CD drive. Writable CD drives have several advantages over tape, the primary one being that CDs are a random access medium. This means that the CD drive can quickly locate a particular file on the CD without sequentially scanning through the entire disc. This is useful when you need to keep a revision history of frequently changing data files (such as source code for a software project or drafts of legal documents).

Although people used to believe that CDs had a very long life span, that belief has recently come into question. CDs are probably still a good choice if the backup will be needed for two years or less. For longer time periods, a tape backup will generally last longer than a writable CD. If your backups are intended for short- term storage, you should probably consider a rewritable or CD-RW CD drive. A rewritable CD (unlike plain writable CDs) can be reformatted and used to store new backups.

The biggest drawback is that a CD can store at most about 700MB of data. In contrast, DVDs can store 4.7GB of data (or about 8.5GB for dual-layer CDs) and many tape drives can store multiple gigabytes of data. For example, DAT DDS-3 tapes can hold up to 24GB of compressed data, while 8mm AIT-2 tapes can hold up to 100GB of compressed data.

Getting Cdrecord for Writable CDs

To write CDs with Fedora or RHEL you can use the cdrecord package, which is installed by default with Fedora Core and RHEL. This package contains components such as the cdrecord, devdump, isodump, isoinfo, isovfy , and readcd commands.

Writing to CDs

Because the data written to a CD-R or CD+R disc becomes permanent once it is written, you need to format the CD and copy files to it all in one step. If you formatted it first, you would end up with an empty file system on a CD that can no longer be written to.

Note 

Using a command called growisofs (described later in this chapter), you can write to a CD in such a way that the session is not closed. Later, you can add more data, in multiple sessions, before you finally close the CD. The cdrecord command itself also now supports a -multi option, which can keep the session open for further writing. Not all CD drives will support multi-session writing (which reqires that the hardware support CD-ROM XA mode 2 form 1).

The first step is to create an image of the CD file system as a file on your computer. You do this with the mkisofs command. As an example, imagine that you want to back up the home directory for user mary . You would invoke the mkisofs command and pass it the name of the file system image file to create, followed by the directory to base it on:

 $  mkisofs -R -o /var/tmp/mary.iso /home/mary  

This creates an ISO9660 file system image in a file named mary.iso located in the /var/tmp directory. The -R option causes Linux-specific file ownership and long file names to be used. If your /var partition does not have enough room for the image, choose a different location.

Tip 

By default, mkisofs preserves the ownership and access rights of files and directories when it creates the file system image. This is appropriate when you are making a backup, but not when you are creating a software distribution CD. In such a case, add the -r option instead of -R as the first parameter to mkisofs . It will then store all files as publicly readable and, where appropriate, executable.

If you have an ATAPI CD drive, you no longer need a SCSI ID for that drive to be able to record to it. You could enter the device name instead of the SCSI ID (such as dev=/dev/ cdrom ) . However, if you have a SCSI CD drive, before you can write the image file to a CD, you must first discover the SCSI bus number, device ID number, and Logical Unit Number (LUN) of the CD drive. You can find out which SCSI device ID the CD drive is using. Invoke the cdrecord command with the single parameter -scanbus :

 #  cdrecord -scanbus  

You should see a response similar to the following:

 Cdrecord-Clone 2.01-dvd (i686-pc-linux-gnu) Copyright (C) 1995–2004 Jrg Schilling Linux sg driver version: 3.5.27 Using libscg version 'schily-0.8' scsibus0: 0,0,0 0) 'IDE-CD ' 'R/RW 4x4x24 ' '1.04' Removable CD-ROM 0,0,1 1) * 0,0,2 2) * 0,0,3 3) * 0,0,4 4) * 0,0,5 5) * 0,0,6 6) * 0,0,7 7) * 

This tells you that the CD drive is using SCSI ID zero. The Logical Unit Number in this case should always be zero, so you now have all three numbers . You supply them to cdrecord as part of the dev parameter.

The SCSI bus number is listed first; it is followed by the ID number, and then by the LUN. The entire command should look similar to this:

 #  cdrecord -v speed=2 dev=0,0,0 -data /var/tmp/mary.iso  

For an ATAPI CD drive, with the CD drive as /dev/cdrom , your command line might appear as follows instead:

 # cdrecord -v speed=2 dev=/dev/cdrom -data /var/tmp/mary.iso 

Several additional parameters are included in the command. The -v parameter tells cdrecord to supply verbose output to the screen. The speed parameter tells cdrecord what speed to record at (in this case X2). (You might choose to leave off speed=2 and let cdrecord autodetect the record speed of your CD burner .) The -data parameter tells cdrecord to burn .WAV or .AU files as data, instead of audio tracks (without that option, those file types are burned as audio tracks while all other files are burned as data).

Before running cdrecord live, you might consider adding the - dummy option, which runs through the CD burn process without actually turning on the laser. You can add the -eject parameter to eject the CD when it is done. As it works, cdrecord should display status messages that look similar to the following:

 cdrecord: No write mode specified. cdrecord: Asuming -tao mode. cdrecord: Future versions of cdrecord may have drive dependent defaults. cdrecord: Continuing in 5 seconds... Cdrecord-Clone 2.01-dvd (i686-pc-linux-gnu) Copyright (C) 1995–2004 Jrg Schilling TOC Type: 1 = CD-ROM scsidev: '/dev/cdrom' devname: '/dev/cdrom' scsibus: -2 target: -2 lun: -2 Warning: Open by 'devname' is unintentional and not supported. Linux sg driver version: 3.5.27 Using libscg version 'schily-0.8'. cdrecord: Warning: using inofficial libscg transport code version (schily - Red Hat-scsi-linux-sg.c-1.83-RH '@(#)scsi-linux-sg.c 1.80 04/05/20 Copyright 1997 J. Schilling'). SCSI buffer size: 64512 atapi: 1 Device type : Removable CD-ROM Version : 0 Response Format: 1 Vendor_info : 'IDE-CD ' Identifikation : 'R/RW 4x4x24 ' Revision : '1.04' Device seems to be: Generic mmc CD-RW. Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr). Driver flags : MMC SWABAUDIO Supported modes: TAO PACKET RAW/R16 Drive buf size : 1572864 = 1536 KB FIFO size : 4194304 = 4096 KB Track 01: data 0 MB Total size : 0 MB (00:04.02) = 302 sectors Lout start: 1 MB (00:06/02) = 302 sectors Current Secsize: 2048 ATIP info from disk: Indicated writing power: 5 Is not unrestricted Is not erasable Disk sub type: Medium Type B, low Beta category (B-) (4) ATIP start of lead in: -12369 (97:17/06) ATIP start of lead out: 359849 (79:59/74) Disk type: Short strategy type (Phthalocyanine or similar) Manuf. index: 69 Manufacturer: Moser Baer India Limited Manufacturer is guessed because of the orange forum embargo. The orange forum likes to get money for recent information. The information for this media may not be correct. Blocks total: 359849 Blocks current: 359849 Blocks remaining: 359547 Starting to write CD/DVD at speed 4 in real TAO mode for single session. Last chance to quit, starting real write 0 seconds. Operation starts. Waiting for reader process to fill input buffer ... input buffer ready. trackno=0 Performing OPC... Starting new track at sector: 0 Track 01: 322 of 322 MB written (fifo 100%) [buf 99%] 2.0x. Track 01: Total bytes read/written: 338395136/338395136 (165232 sectors). Writing time: 1110.710s Average write speed 2.0x. Fixating... Fixating time: 126.108s cdrecord: fifo had 5331 puts and 5331 gets. cdrecord: fifo was 0 times empty and 5262 times full, min fill was 96%. 

After cdrecord finishes writing the CD and your shell prompt returns, delete the file system image file /var/tmp/mary.iso . Label the CD appropriately and store it in a safe place.

If you need any files that were copied to the CD, just return the CD to the CD drive. If it doesn't automatically open a window displaying the contents of the CD, type: mount /media/cdrecorder . Open /media/cdrecorder in a folder window and copy the files you want.

Note that the mount point name for the CD drive may be something other than /media/cdrecorder . The way that the udev facility works in the latest version of Fedora is to use generic names such as cdrecorder, disk , or cdrom for CDs or DVDs that include no volume id. However, if a volume ID was added to the CD header when the CD was created, that name will be used as the mount point. For example, a game CD with a volume id of GAMEDISK would be mounted as /media/GAMEDISK .

Cross-Reference 

See Chapter 8 for more information on cdrecord . You can also learn more about installing and troubleshooting writable CD drives from the CD-Writing-HOWTO. If you are using a desktop Fedora or RHEL system, you might want to use a graphical CD writer instead. Chapter 8 also describes the K3B graphical tool for copying and burning CDs and DVDs.

Writable DVD Drives

In previous versions of Fedora and RHEL, the dvdrecord command was used to write DVDs. Now, cdrecord can be used to write both CDs and DVDs. Using a writable DVD drive and the cdrecord command, you can back up your data to DVD-R, DVD-RW, DVD+R, and DVD+RW disks.

The first trick with recording to DVDs in Linux is to make sure that you have a drive that supports DVD writing. You can check by removing any disks in the CD/DVD drive and typing the following:

 $  cdrecord -prcap -dev=/dev/cdrom  less  Cdrecord-Clone 2.01-dvd (i686-pc-linux-gnu) . . . Device type : Removable CD-ROM Version : 0 Response Format: 2 Capabilities : Vendor_info : 'PIONEER ' Identifikation : 'DVD-RW DVR-105 ' Revision : '1.30' Device seems to be: Generic mmc2 DVD-R/DVD-RW. Drive capabilities, per MMC-3 page 2A: Does read CD-R media Does write CD-R media Does read CD-RW media Does write CD-RW media Does read DVD-ROM media Does read DVD-R media Does write DVD-R media Does not read DVD-RAM media Does not write DVD-RAM media Does support test writing . . . 

In the above output, you can see that this drive supports reading and writing of both CDs and DVDs. Use the Spacebar to page through the output (and q to quit). Near the end of the output, you should see read and write speeds supported by the drive. Note that those are maximum possible speeds, so the actual maximum write speeds will depend on the CD or DVD media you are using.

The procedure for writing to DVDs is almost identical to backing up data onto a CD disk, with the following exceptions:

  • Each backup disk can hold a lot more data (4.7GB for single-layer and 8.5GB for dual-layer DVD, as compared to 700MB for CDs).

  • Both the DVD writer and medium are more expensive than the CD counterparts, although the cost of DVD writers has come down drastically in the past few years.

Note 

When manufacturers say 4.7GB, they are talking about 1000MB per GB, not 1024MB. Therefore, you can really only store up to about 4.3GB of data on a DVD (or, more precicely, 4,294,967,296 bytes).

There are also a few other issues you should be aware of that relate to using DVD media to record from Linux:

  • While most new writable DVD drives today support both DVD-R and DVD+R formats, some older drives may not support DVD+R.

  • DVD+RW media that have not been formatted must be formatted before you can write to it. However, you can use cdrecord on an unformatted DVD+RW because it will automatically detect and format an unformatted disk. To force a format, you can use the -format option to cdrecord . There is also a dvd+rw-format that you can use to format a DVD drive (just run dvd+rw-format with your DVD device as the option).

  • You don't need to reformat DVD-RW media more than once. Multiple reformats can make the DVD-RW media unusable.

Follow the procedure in the "Writable CD drives" section to create a file system image file (using mkisofs ) and determine the location of your DVD-R driver. Then use the cdrecord command to actually burn the DVD. Here is an example of a cdrecord command line that burns a file system image called bigimage.iso :

 #  cdrecord -v speed=2 dev=/dev/cdrom -data bigimage.iso  

Writing CD or DVDs with growisofs

Instead of doing separate mkisofs and cdrecord commands, as just shown, you can use the growisofs command to combine the function of those two commands. The growisofs command is particularly useful for mastering of large ISO images (such as those for doublelayer DVD recording). That's because instead of copying the ISO image you create to a file (as mkisofs does), growisofs sends the ISO image directly to the CD or DVD to be burned.

The growisofs command is also nice for backups because it has simple options for doing multisession DVDs. For example, if you want to back up your /home/chris directory today, then back up your /var/www directory later, you start the first backup as follows:

 $  growisofs -Z /dev/cdrom -R -J /home/chris  

The -Z indicates that this is an initial session being written to the CD or DVD. The device of the CD/DVD drive is /dev/cdrom . The -R and -J options allow longer Linux filenames on ISO9660 images (so the disk can be read by other operating systems, yet still retain Linux extensions). The last option (in this case, /home/chris ) is whatever directories or files you want to copy to DVD.

When you are ready to write more to the CD or DVD, use the -M options instead, to indicate that you are adding on to an existing CD or DVD. Here is an example:

 $  growisofs -M /dev/cdrom -R -J /var/www  

Here, the - M indicates to add a new session to the existing session on the CD or DVD. The content of the /var/www directory (and its subdirectories) is written to the media. You can mount the media between sessions. Just be sure to unmount it before you try to write to it again.




Fedora 6 and Red Hat Enterprise Linux Bible
Fedora 6 and Red Hat Enterprise Linux Bible
ISBN: 047008278X
EAN: 2147483647
Year: 2007
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net