Backing up and restoring

    Backing up and restoring files is one of the most common tasks a sysadmin should know.  Not only should you make frequent, full system backups, but your users should also be encouraged to back up files that they couldn't afford to lose.  Backing up also allows transferring large files or entire filesystems without wasting network bandwidth.  This discussion assumes DAT tape backups, although other methods such as disks and optical storage are quite acceptable, and may be better.

    You can use the System Manager Backup and Restore utilities in IRIX if you have a graphical system, although I strongly recommend becoming familiar with the tape utilities below.  Why?  If your system disk dies and you need to restore it from a backup, you'll need to use the text interface with the "Recover System" option at the system's startup menu.  Also, some software is still sent in tape format, and inevitably, some users will expect you to know how to use these commands.  There are a few utilities that you can use for backups and restores, each with different merits.  I prefer bru over all else for system backups, there's more on the pro's and con's of each below.  Whatever you decide, I strongly urge you to read the man page on the particular backup/restore utility you choose.  If you want more detailed information on backing up and restoring, I suggest looking over Marty Dellwo's Backup and Restore page.


Using tapes:
    You should know and understand the "mt" command before starting on tape backups.  You load a tape on most drives like a VCR tape.  Once it's in the drive, your SGI should automatically rewind it to the beginning.  The "mt" command is used to manipulate the tape while it's in the drive.  Assuming you're using the default tape device, /dev/tape, entering "mt" followed by "rewind" will rewind the tape, "unload" will unload the tape.  IRIX makes the default tape device auto-rewinding.
 

Pro's and con's of different tape backup/restore utilities:

Backup, Restore, List_tape
Great for full system backups.  Backup creates an archive that the miniroot restore easily restores during a total disk crash.  It copies the files from the system disk's volume header.  Disadvantages include, not being able to do selective backups under '/'.   Backup had used bru before IRIX 6.5.  Now, it uses "cpio".  Restore in 6.5 will read the older bru and tar formats.

bru:
Bru offers many enhancements to tar and cpio, such as better data integrity checking, multiple volume archives and features that help across different UNIX platforms.  bru will also be read by the IRIX miniroot restore utility.  The nice thing about bru is that you can tell it not to cross mounted filesystems.  For example, you want to backup only the root partition  '/'.  Give bru the 'm' option and it won't include the filesystems mounted on '/', which would happen with tar and Backup.  A disadvantage of bru is that filenames can not be greater than 127 characters.  However, bru is my favorite utility.

tar:
Tar is probably the best known UNIX file archive utility.  Tar is available on many different platforms and in my experience is easier to work with than any other utility.  Tar's pathname limit is 255 characters which is probably adequate for most systems. On the downside, if you want to backup '/' with tar, it will do your whole system, there is no way to restrict it by filesystem boundaries.

xfsdump, xfsrestore:
These are entirely different kind of utility that operate on the filesystem level of data storage as opposed to files and directories like those just mentioned above.  They make for quick incremental backups and I've never heard of a problem with filenames being too long.  xfsrestore includes an interactive restore utility that is quite sophisticated.  There are a number of disadvantages which includes not suitable for non-root users, not being compatible with the Recover System PROM option, not to mention frequent bugs.  It's also more complicated and I highly recommend you read the man page for these if you plan on using them.

Examples of using each of the above in common tape backup tasks.  These assume the tape archive is in the default tape drive and re-wound.

Backing up a whole filesystem
List the contents of a tape backup
Restoring a whole filesystem
Backup up a specific file
Restoring a specific file
Appending a file
Restoring a file to a different directory

Backing up a whole filesystem /disk1, assumes no filesystems mounted under /disk1:

Backup /disk1
bru cv /disk1
tar cv /disk1
xfsdump -f /dev/tape /disk1


List the contents of a tape backup:

List_tape
bru -tv
tar -tv
xfsrestore -t  careful, may need to set verbosity level!


Restoring a whole filesystem /disk1

cd / && Restore /disk1
cd /disk1; bru -xv
cd /disk1; tar -xv
xfsrestore /disk1
 
Backup up a specific file /disk1/file1:
Backup /disk1/file1
bru -cv /disk1/file1
tar -cv /disk1/file1
not possible with xfsrestore
 

Restoring a specific file /disk1/file1

Restore /disk1/file1
bru -xv /disk1/file1
tar -xv /disk1/file1
xfsrestore -f /dev/tape -L backup -s /disk1/file1    assumes a session label "backup"


Appending a file /disk1/file1 to tape archive:

N/A for Backup
bru -rv /disk1/file1
tar -rv /disk1/file1
xfsdump -f /dev/tape /disk1/file1    xfsdump automatically forwards to add the next archive.


Restoring a file /disk1/file1 to a different directory /disk2/:

N/A for Backup
cd /disk2 && bru -xvj /disk1/file1
cd disk2 && tar -xvj
xfsrestore -f /dev/tape -L backup -s disk1/file1 /disk2

More options for backing up and restoring:

Using a remote tape drive:  add the following option to your tape-related command: "-f user@remotehost:/dev/tape", where the user executing this command on the local host has an entry in the .rhosts file of user@remotehost.  This will work with tar, bru, mt, xfsdump, and xfsrestore.  For Backup/Restore/List_tape, use "-h hostname" and make sure guest on the remote host will allow you .rhosts access.
 


 Back to table of contents

last updated 2/29/00 by Martin McCormick, martinm@sas.upenn.edu