INFODOC ID: 2088 SYNOPSIS: setting up a mirrored system disk with Disk Suite DETAIL DESCRIPTION: BOOTING FROM A MIRRORED SYSTEM DRIVE - An hypothetical example ============================================================== It may be desirable to make use of the Disksuite mirroring feature to duplicate the system disk. In case of disk failure onthe primary system drive, a switch can be made to operate on the mirrored drive. The purpose of this article is to give a step by step guideline on how to set up the mirroring; and how to boot from the mirrored system drive. Since this is a hypothetical example, device names and kernel configuration file names should be changed according to individual cases. IMPORTANT: This procedure should not be applied to a system that has IPI DualPort 1.0 software, because dual ported drives cannot be used as system drives. I System configuration assumptions -------------------------------- sd0 - consists of a, b, d, g partition sd1 - consists of a, b, d, g partition sd0 is considered as the existing system drive sd1 is considered as the mirrored system drive II To set up the mirroring ------------------------ 1. Load DiskSuite software. 2. To include the metadevices in the kernel, modify the kernel configuration file to include: pseudo-device md128 # 128 is the maximum value and the # value has to be a multiple of 8 3. Rebuild the kernel. 4. Copy the new kernel to /vmunix. 5. To create metadevices in the /dev directory, run: root_prompt# /usr/etc/metascript To patch the kernel to include the state database location in the kernel, root_prompt# /usr/etc/metadb -p -k /vmunix NOTE: Without running /usr/etc/metascript, "/usr/etc/metadb -p -k /vmunix" will fail with: "problem finding patch location in kernel" error. To include /usr/etc/metainit, /usr/etc/metasync commands in the /etc/rc.boot and /etc/rc.local files: root_prompt# /usr/etc/metarc root_prompt# /usr/etc/reboot 6. After the machine is rebooted, create /etc/md.conf to define the metadevices: # # to define the database replicas location on the drives # mddb01 is the label name, it can be replaced by another name # mddb01 /dev/sd0d /dev/sd1d # # /dev/md2a is a 1 way mirror metadevice # /dev/md0a is a submirror of /dev/md2a # /dev/md1a is another submirror of /dev/md2a # # 1-way mirror tree structure # # md2a (metadevice) # | # | # md0a (1st submirror) # | # | # md1a (2nd submirror) # # /dev/md1a is attached to /dev/md2a using metattach command # which is explained later on in the procedure # # data iswritten to md0a through md2a, and data is then # synced to md1a # # same reasoning for the other paritions # /dev/md2a -m /dev/md0a /dev/md0a 1 1 /dev/sd0a /dev/md1a 1 1 /dev/sd1a # /dev/md2b -m /dev/md0b /dev/md0b 1 1 /dev/sd0b /dev/md1b 1 1 /dev/sd1b # /dev/md2g -m /dev/md0g /dev/md0g 1 1 /dev/sd0g /dev/md1g 1 1 /deb/sd1g 7. To initialize the replicas: root_prompt# /usr/etc/metadb -a -f mddb01 To initialize the metadevices, -f option is used because it forces metainit to initialize mounted components: root_prompt# /usr/etc/metainit -a-f To attach second submirror to each metadevices: root_prompt# /usr/etc/metattach /dev/md2a /dev/md1a root_prompt# /usr/etc/metattach /dev/md2b /dev/md1b root_prompt# /usr/etc/metattach /dev/md2g /dev/md1g 8. Modify the kernel configuration one more time : change: config vmunix swap generic to: config vmunix root on md2a swap on md2b 9. Rebuild the kernel. 10. Copy the new kernel to /. 11. To inform the new kernel the location of the state database: root_prompt# /usr/etc/metadb -p -k /vmunix 12. Modify /etc/fstab: change: /dev/sd0a / 4.2 rw 1 1 /dev/sd0g /usr 4.2 rw 1 2 to: /dev/md2a / 4.2 rw 1 1 /dev/md2g /usr 4.2 rw 1 2 13. Reboot the machine. III Boot from mirrored system drive ------------------------------- A. To test the bootability of the mirrored drive ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Detach the mirrored partitions from the metadevices: root_prompt# metadetach /dev/md2a /dev/md1a root_prompt# metadetach /dev/md2b /dev/md1b root_prompt# metadetach /dev/md2g /dev/md1g 2. Mount the mirrored partitions: root_prompt# mkdir /g root_prompt# mkdir /a root_prompt# mount -ot rw 4.2 /dev/sd1a /a root_prompt# mount -ot rw 4.2 /dev/sd1g /g 3. Copy a backup kernel that does not contain the disksuite changes. In this example, the generic kernel that is from the SunOS distribution is used: root_prompt# cp /g/stand/vmunix /a 4. Rename the rc files that contain the metasync and metainit commands: root_prompt# mv /a/etc/rc.boot /a/etc/rc.boot.ds root_prompt# mv /a/etc/rc.local /a/etc/rc.local.ds 5. Rename the original rc files that does not contain the meta commands: root_prompt# mv /a/etc/rc.boot_411 /a/etc/rc.boot root_prompt# mv /a/etc/rc.local_411 /a/etc/rc.local 6. Modify the entries in the fstab file: root_prompt# vi /a/etc/fstab: change: /dev/md2a / 4.2 rw 1 1 /dev/md2g /usr 4.2 rw 1 2 to: /dev/sd1a / 4.2 rw 1 1 /dev/sd1g /usr 4.2 rw 1 2 7. Change the boot-device prom parameter: root_prompt# eeprom boot-from='sd(0,1,0)'(for PROM 1.x) OR eeprom boot-device=disk1 (for PROM 2.x) root_prompt# reboot 8. After the machine reboots from the mirrored drive successfully, in order to return the booting device back to sd0: root_prompt# eeprom boot-from='sd(0,0,0)'(for PROM 1.x) OR eeprom boot-device=disk0 (for PROM 2.x) root_prompt# reboot 9. The machine will be rebooted with DiskSuite turned on. However, the booting process may take longer than usual because the data from the primary drive will be resynched to the mirrored drive. B. In case of disk faulure on sd0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Boot up the system from a bootable tape or cdrom. 2. Load miniroot and reboot the machine from the loaded miniroot. 3. Create mount points for the mirrored root and usr partitions and mount them: # mkdir /g # mount -ot rw 4.2 /dev/sd1a /a # mount -otrw 4.2 /dev/sd1g /g Disable DiskSuite on the mirrored system drive: < copy the a kernel that does not have any disksuite configuration to the mirrored root partition > < in this example, the generic kernel that is from the SunOS distribution to the mirrored root partition > # cp /g/stand/vmunix /a < rename rc.boot and rc.local that contains the metainit and metasync commands > # mv /a/etc/rc.boot /a/etc/rc.boot.ds # mv /a/etc/rc.local /a/etc/rc.local.ds < rename rc.boot_411 and rc.local_411 > # mv /a/etc/rc.boot_411 /a/etc/rc.boot # mv /a/etc/rc.local_411 /a/etc/rc.local < modify fstab using ed > # ed /a/etc/fstab: change: /dev/md2a / 4.2 rw 1 1 /dev/md2g /usr 4.2 rw1 2 to: /dev/sd1a / 4.2 rw 1 1 /dev/sd1g /usr 4.2 rw 1 2 # sync;sync # /g/usr/etc/halt 4. To reset the PROM parameter for the booting device, at theboot prompt: >n < go to the new command mode > ok setenv boot-from sd(0,1,0) ok boot ok setenv boot-device disk1 ok boot PATCH ID: n/a PRODUCT AREA: SunOS Unbundled PRODUCT: Online Disksuite SUNOS RELEASE: 4.1.1, 4.1.2 UNBUNDLED RELEASE: 1.0 HARDWARE: All