Guide to backing up an Indy under IRIX 6.* with the xfs file system
Introduction
Attach the backup disk, make it a system disk and repartition it as a 'rootdrive'
Backup using 'dd', for identical system and backup disks
Backup using 'xfsdump/xfsrestore' for identical or different sized disks
Add 'sash' and 'ide' to the volume header
Run 'xfsdump/xfsrestore
Automate the backup
Introduction
System backup, which refers to this page, has been discussed at 'Byte'. There are two ways that I have backed up my Indy's 'system' disk onto a 'backup' disk. The 'backup' disk is made so that it will replace the 'system' disk, if it fails. The first backup procedure uses 'dd' and the second one uses 'xfsdump/xfsrestore'. They will work on any SGI computer running IRIX 6.* with the 'xfs' file system. I use 'xfsdump/xfsrestore' regularly on my Indy running IRIX 6.5.*. I have also used 'xfsdump/xfsrestore' to increase the size of the 'system' disk by copying it to a larger disk. Details of how to 'clone' a disk using 'tar' is also available.
Note that this is my personal 'help' file, so only use it at your own risk. The procedure should be easy to adapt to other backup strategies. SGI also have a URL about 'Creating a New System Disk by Cloning' using 'dump/restore'.You can use either the 'dd' or 'xfsdump/xfsrestore' procedures to copy all the files on the 'system' disk to the 'backup' disk. With 'dd', the two disks must be physically identical. Either method can be used to make a 'backup' disk that contains all the files on the 'system' disk. If you have made an 'exact copy' of the system disk, you can replace a 'dead' system disk simply by jumpering the 'backup' disk as SCSI 1 in place of the removed previous system disk, and restarting the system. I recommend that the backup disk be kept separately from the Indy, to cover loss from theft and/or fire after the backup has been made.
Notes:
I have an external Toshiba CD-ROM drive on 'SCSI 2', which is replaced by the backup disk during the procedures described below. If the SCSI number of your backup disk is not 'SCSI 2', remember to alter the entries for SCSI 2 in the commands below. Text in red is what you type into a UNIX shell. 0 is number 'zero' not the letter 'oh'.
Attach the backup disk, make it a system disk and repartition it as a 'rootdrive'
First, attach the backup disk, make it a system disk and repartition it as a 'rootdrive' if this has not been already done previously. Do not do this if it is already partitioned as a 'rootdrive'.
Become superuser
init 0 This switches the system off.
Connect the 'backup' disk in place of the Toshiba CD-ROM.
Check that the 'backup' disk is physically set to SCSI=2 and restart the system.
login as Root.
init s Enter single user mode.
Enter the superuser password then <return> when invited.
sync Writes unsaved data to the 'system' disk
sync
fx -x enters expert mode.
0 (SCSI 0) Sets the SCSI id as 0
2 (SCSI ID 2) Repartition the disk on SCSI 2
repartition as [ro]otdrive Repartitions with 's0' as the file system rather than 's6' which is used for non-system disks.
When this is complete, you should go to the next step for 'dd' or 'xfsdump/xfsrestore'.
Backup using 'dd'
The system and backup disks must be physically identical before 'dd' can be used to make an image (exact copy) of the 'system' disk. First, attach the backup disk, make it a system disk and repartition it as a 'rootdrive', as described above, if this has not been done already.
Enter single user mode: login as 'root' and type 'init s'.
Then delete all the files on the backup disk and make a new 'xfs' 'version 2' file system on it:
mkfs_xfs -n version=2 /dev/rdsk/dks0d2s0 Deletes all the files on the 'backup' disk SCSI 2. It also creates a drive for 'xfs' version 2, which other operating systems, including Linux, can work with.
Make the file system on the disk and copy the files over using 'dd':
sync Writes unsaved data to the 'system' disk
dd if=/dev/rdsk/dks0d1s0 bs=32k of=/dev/rdsk/dks0d2s0 This takes about 30 minutes for a 4 GB disk
dd if=/dev/rdsk/dks0d1vh bs=32k of=/dev/rdsk/dks0d2vh This takes about 1 minute.
init 0 Closes down and switches the system off
Switch off the SCSI devices and remove the 'backup' disk.
Backup using 'xfsdump/xfsrestore'
Use 'xfsdump/xfsrestore' to copy an IRIX system disk to another hard disk. The system disk and backup disk can be different sized disks, providing the 'backup' disk can hold all the data on the 'system' disk, or they can be identical.
First, attach the backup disk, make it a system disk and repartition it as a 'rootdrive', as described above, if this has not been done already.
Add 'sash' and 'ide' to the volume header
Add 'sash' and 'ide' to the volume header on 'disk2' using 'dvhtool'. This only needs to be done once. It is not needed, if you are using 'dd'.
/etc/dvhtool -v get sash /stand/sash
/etc/dvhtool -v get ide /stand/ide
/etc/dvhtool -v list /dev/rdsk/dks0d2vh
/etc/dvhtool -v creat /stand/sash sash /dev/rdsk/dks0d2vh
/etc/dvhtool -v creat /stand/ide ide /dev/rdsk/dks0d2vh
/etc/dvhtool -v list /dev/rdsk/dks0d2vh
If the backup disk has 'sash' and 'ide' in its volume headers, delete all the files on the backup disk and make a new xfs file system on it:
mkfs_xfs /dev/rdsk/dks0d2s0 Deletes all the files on the 'backup' disk SCSI 2 It does not delete 'sash' or 'ide' in the volume headers.
Mount the backup disk, then copy the files from the 'system' disk to the 'backup' disk:
mkdir /disk2 Creates a mount point for 'disk2'.
mount -v /dev/dsk/dks0d2s0 /disk2 Mounts the backup disk on /disk2.
df -l Check that 'disk2' is mounted.
cd /disk2 Sets the backup directory.
sync Writes unsaved data to the 'system' disk
xfsdump -l0 - /dev/rdsk/dks0d1s0 | xfsrestore -p60 - . 'l0' is '-elle zero' . Be sure to enter correctly the two '<space><minus><space>' entries. Be sure to enter the final 'period/full stop'. This line is the hardest to get right :(.
It takes about 60 minutes to copy about 4 GB from one disk to the other, on my Indy. Be patient and wait until you get a command prompt. Half a screen of information will be given as the backup proceeds. When it is done, type:
sync
rmdir disk2 Delete '/disk2' from the backup disk.
cd /
sync Writes unsaved data to the 'system' disk
sync
umount -v /disk2 Unmounts 'disk2' from /disk2.
rmdir /disk2 Deletes /disk2 directory.
init 0 Closes down and switches the system off.
Switch off the SCSI devices and remove the 'backup' disk.
Note that, once you have gone through the 'xfsdump/xfsrestore' backup procedure successfully, it is possible for 'su' to do the backup this way with the computer still accessible to users. To do this, shutdown the computer, attach the backup disk, restart, login as 'root' and run 'xfsdump/xfsrestore'. I find this very convenient, as this backup can be done while retaining full access to the system disk.
Automate the backup
If you want to 'automate' the backup procedure, you can use the script provided by Ralph Myers <ralph_myers@cinmach.com> who wrote in message news:yU%m3.2303$CK6.2663@client "Here is a 'clonedisk' script I use to duplicate disks when I need to. This version is for a "system" or "root" drive, and an xfs file system." Save the script as the executable file 'clonedisk'. Shut the system down. Attach the drive to be the 'clone' as SCSI 2. Check that the drive is set to SCSI 2. Restart the system and login as root. Type 'init s' to run in 'single user mode'. Then change to the directory where the script was saved and type './clonedisk sys_id' where 'sys_id is to be the content of /etc/sys_id, the resolved name of the computer. In my case it is 'sprysgi.sghms.ac.uk'. So I type './clonedisk sprysgi.sghms.ac.uk'.
In April 2003, John Tomaszewski has noted(1) that two lines in the script below 'usr=/dev/dsk/dks0d2s6' and 'rusr=/dev/rdsk/dks0d2s6', may not be required as they may refer to an older version of the script and (2) that on the O2, xfsrestore was in '/sbin/xfsrestore' not ' /usr/sbin/'.
#! /bin/sh
#
cat << EOF
This script creates an exact copy of the system disk on a second disk.
The second disk must be the same size or larger than the system disk.
The second disk must be set as SCSI 2.
The second disk will be overwritten with the contents of the system disk, SCSI 1.
Run this script in single user mode: 'init s'. Give the 'root' password when requested.
Run this script in '/' as './clonedisk sprysgi.sghms.ac.uk',
where 'sprysgi.sghms.ac.uk' is to be the contents of '/etc/sys_id' on the second disk.
EOF
if test $# != 1
then
echo 'usage: clonedisk sys_id'
echo ' (for example: clonedisk sprysgi.sghms.ac.uk)'
exit 1
fi
vh=/dev/rdsk/dks0d2vh
root=/dev/dsk/dks0d2s0
rroot=/dev/rdsk/dks0d2s0
usr=/dev/dsk/dks0d2s6
rusr=/dev/rdsk/dks0d2s6
echo This disk will be setup to boot as $1
echo ""
echo checking that disk is not in use:
echo "running df -l | grep s0d2"
df -l | grep s0d2
echo interrupt if disk is mounted.
set -x
sleep 10
df -kl
mkdir /clone
echo adding sash and ide to volume header
/etc/dvhtool -v get sash /stand/sash
/etc/dvhtool -v get ide /stand/ide
/etc/dvhtool -v list $vh
/etc/dvhtool -v creat /stand/sash sash $vh
/etc/dvhtool -v creat /stand/ide ide $vh
/etc/dvhtool -v list $vh
sync
sync
sleep 10
echo copying root partition
/sbin/mkfs_xfs $rroot
mount -v $root /clone
df -kl
cd /clone
/usr/sbin/xfsdump -l 0 - /dev/rdsk/dks0d1s0 | /usr/sbin/xfsrestore -e - .
rmdir clone
echo $1 > etc/sys_id
cd /
sync
sync
df -kl
umount -v /clone
sleep 5
rmdir /clone
echo " "
echo " Done"
echo " "
# shutdown -g0
exit 0This script can be adapted to run in a cron job with the computer in multi-user mode.
If you have a DAT drive, Brent L. Bates has information on both setting it up and using scripts to backup a drive using xfsdump/xfsrestore.
Addendum: Backing up the system disk in an SGI 'Visual Workstation' running Windows NT is different. As the computer cannot be booted with a DOS diskette, take the system drive to a computer that can run DOS, and use disk imaging software, such as Ghost or DriveImage to create a copy of the drive, then return it to the SGI 540 computer.