Here's how I cloned the system disk of my Personal Iris 4D to SCSI2SD
The disk to clone was a Seagate ST2383N 337MB with IRIX 4.0.5 installed and SCSI ID 1.
Partitions are EFS, so all the tutorials using xfs_copy will not work.
I have used a second machine (IRIS Indigo) because I don't have a SCSI controller in my non-SGI box and couldn't boot the Personal Iris with the drive completely unmounted.
----- Clone using dd ----
First I removed the source disk, changed SCSI ID to 5 and attached to another SGI machine (Iris Indigo), then booted into the OS of the Indigo (IRIX 5.3).
The device name of the source disk with SCSI ID 5 is /dev/rdsk/dks0d5* (where * is either a partition number or 'vol' / 'vh' for volume or volume header)
Here's the partition listing:
Set partition ID 5; starts at 0; sector size 512; and 658770 sectors (as reported in fx output above!).
Now boot again with SCSI2SD attached. write the volume image back to the same device name:
try to mount partition 6 to verify:
--- Clone using tar ---
Alternatively, if you don't have the possibility to unmount the root partition or to mount the drive in a second machine, there is another method using tar to copy all the files and just unmount /proc before starting the copy job.
Credits for this script go to Ian and gijoe77:
The disk to clone was a Seagate ST2383N 337MB with IRIX 4.0.5 installed and SCSI ID 1.
Partitions are EFS, so all the tutorials using xfs_copy will not work.
I have used a second machine (IRIS Indigo) because I don't have a SCSI controller in my non-SGI box and couldn't boot the Personal Iris with the drive completely unmounted.
----- Clone using dd ----
First I removed the source disk, changed SCSI ID to 5 and attached to another SGI machine (Iris Indigo), then booted into the OS of the Indigo (IRIX 5.3).
The device name of the source disk with SCSI ID 5 is /dev/rdsk/dks0d5* (where * is either a partition number or 'vol' / 'vh' for volume or volume header)
Here's the partition listing:
to create an image of the disk including all partitions and volume header, I dumped 'dks0d5vol' to an image on the disk (also as a backup copy, but you could also write straight to another disc).fx -x
select 0, 5, 0 -> repartition -> this will list the current partition layout:
----- partitions-----
part type cyls blocks Megabytes (base+size)
0: efs 5 + 62 2625 + 32550 1 + 16
1: raw 67 + 156 35175 + 81900 17 + 40
6: efs 223 + 1031 117075 + 541275 57 + 264
7: efs 5 + 1249 2625 + 655725 1 + 320
8: volhdr 0 + 5 0 + 2625 0 + 1
10: volume 0 + 1254 0 + 658350 0 + 321
capacity is 658770 blocks
then power off the machine, remove the source disk, prepare a blank SD-Card and configure the drive geometry in SCSI2SD tool:$ dd if=/dev/rdsk/dks0d5vol bs=32k of=/data/dks0d5svol.img
Set partition ID 5; starts at 0; sector size 512; and 658770 sectors (as reported in fx output above!).
Now boot again with SCSI2SD attached. write the volume image back to the same device name:
Verify if the disk was written properly:$ dd if=/data/dks0d5svol.img of=/dev/rdsk/dks0d5vol
this should now print exactly the same partition layout as on the source disk. Even that strange partition number 7 which confused me.$ prtvtoc /dev/rdsk/dks0d5s0
try to mount partition 6 to verify:
then power off, change SCSI ID back to 1 using SCSI2SD tool and then the disk is ready to boot!$ mount /dev/dsk/dks0d5s6 /mnt/test
--- Clone using tar ---
Alternatively, if you don't have the possibility to unmount the root partition or to mount the drive in a second machine, there is another method using tar to copy all the files and just unmount /proc before starting the copy job.
Credits for this script go to Ian and gijoe77:
#!/bin/ksh
if [[ ($# -eq 0) || ($# -eq 1) ]]
then
echo""
echo "Usage: $0 <target disk SCSI Controller> <target disk SCSI ID>"
echo ""
echo "Example to clone to target disk 2 on SCSI channel 1: $0 1 2"
echo ""
exit 1
else
SCSI_CHANNEL=$1
DISKID=$2
fi
echo
echo WARNING: this script assumes the 'fx -x' procedure has
echo already been performed on the target disk!
echo
echo "Cloning root disk /dev/dsk/dks0d1s0 to target:"
echo "/dev/dsk/dks"$SCSI_CHANNEL"d"$DISKID"s0"
echo "OK? "
read ANSWER
case "$ANSWER" {
y|Y|yes|Yes|YES|Yes) ;;
*) echo "Aborted!";
exit 1;;
}
echo Making file system on /dev/dsk/dks"$SCSI_CHANNEL"d"$DISKID"s0...
mkfs -b size=512 /dev/dsk/dks"$SCSI_CHANNEL"d"$DISKID"s0
echo Mounting /dev/dsk/dks"$SCSI_CHANNEL"d"$DISKID"s0 on /0...
mount /dev/dsk/dks"$SCSI_CHANNEL"d"$DISKID"s0 /0
echo Unmounting /proc...
umount /proc
echo Changing to root dir...
cd /
echo Copying...
tar cvBpf - . | (cd /0; tar xBpf -)
echo
echo Changing to /0...
cd /0
echo Removing unwanted contents of /0/0...
/bin/rm -rf 0
echo Recreating /0/0...
mkdir 0
echo Changing to root dir...
cd /
echo getting the sash from the root disk...
dvhtool -v get sash /stand/sash /dev/rdsk/dks0d1vh
echo Changing to /0...
cd /0
echo Writing the sash to the target disk...
dvhtool -v creat /stand/sash sash /dev/rdsk/dks"$SCSI_CHANNEL"d"$DISKID"vh
echo Remount /proc...
/etc/mntproc
echo Now power down the system and remove the cloned disk.
echo "Remember to switch the cloned disk's SCSI ID back to 1."
echo NB: after installing the cloned disk into the next machine
echo and powering on the system, remember to login as root and
echo do an immediate reboot before running this script again -
echo this will install the new unix.install file.
echo