I was asked the other day how to create a bootable backup disk. In a previous post, I used the dd command to perform this task. However, you can use the ufsdump/ufsrerestore procedure, too. Here are 2 generic scripts, one c shell and the other Bourne shell.
Note: This was done on a Solaris 8 system and in single user mode.
=====================================
C Shell Script
=====================================
#!/bin/csh
foreach myslice ( 0 3 4 )
echo y | newfs /dev/rdsk/c1t1d0s$myslice
end
cd /
foreach myslice ( 0 3 4 )
mount /dev/dsk/c1t1ds$myslice /mnt
cd /mnt
ufsdump 0uf - /dev/rdsk/c1t0d0s$myslice | ufsrestore rf -
rm restoresymtable
cd /
umount /mnt
end
/usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
mount /dev/dsk/c1t1d0s0 /mnt
sed 's/t0/t1/g' /mnt/etc/vfstab > /var/tmp/vfstab
cp /var/tmp/vfstab /mnt/etc/vfstab
umount /mnt
=====================================
Bourne Shell Script
=====================================
#!/bin/sh
for myslice in 0 3 4
do
echo y | newfs /dev/rdsk/c1t1d0s$myslice
done
cd /
for myslice in 0 3 4
do
mount /dev/dsk/c1t1ds$myslice /mnt
cd /mnt
ufsdump 0uf - /dev/rdsk/c1t0d0s$myslice | ufsrestore rf -
rm restoresymtable
cd /
umount /mnt
done
/usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
mount /dev/dsk/c1t1d0s0 /mnt
sed 's/t0/t1/g' /mnt/etc/vfstab > /var/tmp/vfstab
cp /var/tmp/vfstab /mnt/etc/vfstab
umount /mnt
This blog covers Unix system administration HOWTO tips for using inline for loops, find command, Unix scripting, configuration, SQL, various Unix-based tools, and command line interface syntax. The Unix OS supports tasks such as running hardware, device drivers, peripherals and third party applications. Share tips/comments. Read the comments. But most importantly: Read Disclaimer - Read Disclaimer.
No comments:
Post a Comment