UNIX System Administration Handbook - Evi Nemeth [93]
# mkdir /bkroot
# mkdir /new
# mount /dev/dsk/c0t3d0s0 /bkroot
# mount /dev/dsk/c0t3d0s6 /new
# df -k /bkroot
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t3d0s0 2055855 9 1994171 1% /bkroot
df shows that the backup root partition has been correctly mounted.
We next inform the kernel, by using swap -a, of the new swap space on partition 1; then, with swap -l, we make sure it is being used:
# swap -a /dev/dsk/c0t3d0s1
# swap -l
swapfile dev swaplo blocks free
...
/dev/dsk/c0t3d0s1 32,25 16 4194272 4194272
swap -l lists all the currently active swap areas. Since the new swap partition is included in its output, we know that everything is hunky dory.
You must add entries to the /etc/vfstab file if you want your new filesystems to be mounted automatically when the system boots. The Solaris /etc/vfstab file is a little bit different from other systems’ /etc/fstab files. It contains both the block device and the raw device (used by mount and fsck, respectively), as well as the mount point. It then specifies the type of the filesystem and the pass number for parallel fscking. Next is a yes or a no that tells the boot process whether that filesystem should be mounted at boot time. The last field specifies options such as logging. If the information is not relevant to that filesystem type, use a dash as a place holder.
Here are the lines we would add for our new filesystems and swap space:
#device device mount FS mount
#to mount to fsck point Type at boot
/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 /bkroot ufs 1 yes -
/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /new ufs 2 yes -
/dev/dsk/c0t3d0s1 - - swap - no -
...
To turn the /bkroot filesystem into a useful backup of the root partition, we need to copy over the contents of the standard root. ufsdump and ufsrestore are the proper tools for the job:
# cd /bkroot
# ufsdump 0uf - / | ufsrestore -rf -
DUMP: Date of this level 0 dump: Tue Jun 7 19:11:44 1994
...
The bkroot partition will not be bootable until installboot has been run on the new disk to copy a small boot program to the beginning of the disk. When the system is powered on, the PROM monitor loads the boot program, and the boot program then loads the kernel from the root filesystem. installboot needs to be pointed both at the disk and at a file containing the boot block to be written:
# /usr/sbin/installboot /usr/lib/fs/ufs/bootblk /dev/rdsk/c0t3d0s0
The final step of the installation process is to reboot and verify that all filesystems mount correctly and that swapping is enabled on the new swap partition. You must also ensure that you can boot from the /bkroot partition once all of the files have been copied over—don’t wait until your main root partition is blown to find out that there’s a problem.
Adding a disk to HP-UX
As of HP-UX 10.20, HP provides a full logical volume manager called LVM. It’s a nice addition, especially when you consider that HP-UX formerly did not even support the notion of disk partitions. It also includes the Veritas File System, which is available on Solaris, Windows NT, and other operating systems as well.
A logical volume manager gives you a lot of flexibility, but it also makes disk management somewhat more complex. We will use the volume manager commands to set up a backup root, a large free space partition, and some swap space; however, coverage of the advanced features provided by the logical volume manager is beyond the scope of this book. See the man pages and the user guide for more information.
Before you boot UNIX, you can obtain a listing of the system’s SCSI devices from the PROM monitor. Unfortunately, the exact way in which this is done varies quite a bit among machines. After you boot, you can verify that the kernel has recognized your device by looking at the output of the dmesg or ioscan commands. Our disk engenders the following ioscan output, which verifies that the new disk is target 3:
# ioscan -fn -C disk
Class I H/W Path Driver S/W State Description
= = = = = = = = = = = = = = = = = =