Backup and Restore of OS on SGI IRIX

author: Fred James - fjames@aps.vertisinc.com - fredjame@concentric.net

9 January 2002

With appreciation for all his help to SGI Engineer, Henry Zamenski


Goal:

  1. Restore the OS to a know state

    1. Create a bootable backup copy of the OS partition

    2. Boot from the backup copy

    3. Copy backup OS to original OS partition

    4. Boot from the original partition

  2. Do all of this without mirroring, and without physically swapping the disks

Notes:

  1. This was worked out on an SGI Origin 200 running IRIX 6.5.11m, with xfs

  1. Create an empty file at the mount point as a quick, visual check of whether filesystem is mounted ("ls /clone" will show "filesystem_not_available" when partition is not mounted)

    1. umount /clone

    2. cd /clone

    3. touch filesystem_not_available

The Procedure has Five Phases:

  1. Create a place for the bootable backup of the OS

    1. This phase is only required once

  2. Create the bootable backup of the OS

  3. Switch to the backup OS

  4. Restore the original OS from the backup

  5. Switch to the original (restored) OS

Phase 1 - Create a place for the bootable backup of OS

  1. Using "fx -x"

    1. Create a second "rootdrive" on a separate disk

    2. Repartition the drive to include Volume (partition type 10), Volume Header (partition type 8), Root (partition type 0), and Swap (partition type 1), partitions

      1. Root partition must be at least as large as original

      2. disk may have other partitions if space allows

  2. Using "dvhtool" add "sash" to the volume header of the new disk

  3. Use "mkfs" to make a filesystem in the root partition of the new disk

    1. Example: "mkfs /dev/dsk/dks0d2s0"

  4. Make a mount point, and mount the new partitions

    1. "mkdir /clone"

    2. edit /etc/fstab to include new mounts, including additional swap if desired

    3. "mount -a"

    4. "swap -m"

    5. Mounts could be done manually if desired

Phase 2 - Create a bootable backup of OS

  1. If the filesystem was just created, and mounted, skip to step 2, otherwise continue here

    1. Unmount the filesystem ("umount /clone")

    2. Cleanout the filesystem ("mkfs /dev/dsk/dks0d2s0")

    3. mount the filesystem again ("mount -a", or manually if desired)

  2. Copy the OS partition

    1. "cd /clone"

    2. "xfsdump -l 0 - / | xfsrestore - ."

      1. xsfdump will not cross filesystems so there is no need to unmount anything

      2. xsfdump will ignore /hw, /ns, /dev/fd, and /proc

    1. Edit /clone/etc/fstab to correctly mount partitions when /clone is running as the OS

Phase 3 - Switch to the backup OS

  1. Reboot ("init 0")

  2. At the menu, select 5 for command monitor

  3. Use "printenv" to display the current parameters

  4. Change the settings for "root", "SystemPartition", and "OSLoadPartition"

    1. Changing "root" may not be necessary on all boxes, but it won't hurt

    2. Cut and paste won't work here, so type carefully

    3. Example commands:

      1. "setenv root dks0d2s0"

      2. "setenv SystemPartition scsi(0)disk(2)rdisk(0)partition(8)"

      3. "setenv OSLoadPartition scsi(0)disk(2)rdisk(0)partition(0)"

    4. Alternative example commands:

      1. "setenv root dks0d2s0"

      2. "setenv SystemPartition dksc(0,2,8)"

      3. "setenv OSLoadPartition dksc(0,2,0)"

  5. Use "printenv" to display the current parameters

    1. The "root" parameter will be at the bottom of the list now

  6. Reboot from where you are (init)

    1. If the menu returns, select "start system"

    2. "init" causes the changes to be written

  7. Check that the system came up on the expected partition

    1. "nvram" should show the three parameters as changed, plus another one for the kernel name, which should show "unix" on the same devise as "OSLoadPartition"

      1. Example: "kernname=scsi(0)disk(2)rdisk(0)partition(0)/unix"

    2. "df -k" and "swap -lnf" should show all desired mounts and swap

    3. "ls -l /dev/dsk/*" should show the same major/minor numbers for both "/dev/dsk/root" and the expected boot partition.

      1. Example: for me both "/dev/dsk/dks0d2s0" and "/dev/dsk/root" have the major/minor numbers "0,181".

Phase 4 - Restore the original OS partition from the backup

  1. We will assume the original partition is now mounted at "/clone"

    1. Unmount the filesystem ("umount /clone")

    2. Cleanout the filesystem ("mkfs /dev/dsk/dks0d1s0")

    3. mount the filesystem again ("mount -a", or manually if desired)

  2. Copy the OS partition

    1. "cd /clone"

    2. "xfsdump -l 0 - / | xfsrestore - ."

      1. xsfdump will not cross filesystems so there is no need to unmount anything

      2. xsfdump will ignore /hw, /ns, /dev/fd, and /proc

    1. Edit /clone/etc/fstab to correctly mount partitions when /clone is running as the OS

Phase 5 - Switch to the original OS partition

  1. Reboot ("init 0")

  2. At the menu, select 5 for command monitor

  3. Use "printenv" to display the current parameters

  4. Change the settings for "root", "SystemPartition", and "OSLoadPartition"

    1. Changing "root" may not be necessary on all boxes, but it won't hurt

    2. Cut and paste won't work here, so type carefully

    3. Example commands:

      1. "setenv root dks0d1s0"

      2. "setenv SystemPartition scsi(0)disk(1)rdisk(0)partition(8)"

      3. "setenv OSLoadPartition scsi(0)disk(1)rdisk(0)partition(0)"

    4. Alternative example commands:

      1. "setenv root dks0d1s0"

      2. "setenv SystemPartition dksc(0,1,8)"

      3. "setenv OSLoadPartition dksc(0,1,0)"

  5. Use "printenv" to display the current parameters

    1. The "root" parameter will be at the bottom of the list now

  6. Reboot from where you are (init)

    1. If the menu returns, select "start system"

    2. "init" causes the changes to be written

  7. Check that the system came up on the expected partition

    1. "nvram" should show the three parameters as changed, plus another one for the kernel name, which should show "unix" on the same devise as "OSLoadPartition"

      1. Example: "kernname=scsi(0)disk(1)rdisk(0)partition(0)/unix"

    2. "df -k" and "swap -lnf" should show all desired mounts and swap

    3. "ls -l /dev/dsk/*" should show the same major/minor numbers for both "/dev/dsk/root" and the expected boot partition.

      1. Example: for me both "/dev/dsk/dks0d1s0" and "/dev/dsk/root" have the major/minor numbers "0,181".