
Send in your Unix questions today! |
See additional Unix tips and tricks
Once you have mirrored your root partition, you may still need to create a device alias for the mirror so that you can boot from it if the primary mirror ever fails. To prepare for this, you should first generate a long listing of the partition on which the mirror resides. It will look something like this:
lrwxrwxrwx 1 root root 43 Feb 3 2004 /dev/dsk/c1t0d0s0
-> ../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@1,0
Print the portion of this path that follows the word "devices". Have this information on hand when you go to define your new alias. In the example above, this would look like this:
pci@8,600000/SUNW,qlc@4/fp@0,0/disk@1,0
This is the physical device name for your alternate root partition. You might need this information when you create your device alias at the open boot prompt.
Once you have copied this information, use the init 0 command to bring your server down to single user mode.
# init 0
Use the devalias command to view the device aliases that are already defined on your system. You might find that your mirror is already defined with an alias such as "disk2".
Use the show-disks command to display a list for disk selections:
ok show-disks
a) /pci@8,600000/SUNW,qlc@4/fp@0,0/disk
b) /pci@8,700000/pci@3/scsi@5/sd
c) /pci@8,700000/pci@3/scsi@4/sd
d) /pci@8,700000/scsi@6,1/disk
e) /pci@8,700000/scsi@6/disk
q) NO SELECTION
Enter Selection, q to quit:
At this point, you can select a device and re-use it to define an alias for your mirror. First, type the letter corresponding to the device you want to use. This stores the device address in memory.
Enter Selection, q to quit: a
/pci@8,600000/SUNW,qlc@4/fp@0,0/disk has been selected.
Type ^Y ( Control-Y ) to insert it in the command line.
e.g. ok nvalias mydev ^Y
for creating devalias mydev for
/pci@8,600000/SUNW,qlc@4/fp@0,0/disk
Next, type "nvalias" followed by the name you want to use for your root mirror (e.g., "nvalias rootmirror") and then control-Y (as was indicated in the system prompts shown above) to past the contents of the buffer into your command line.
ok nvalias rootmirror ^Y
When you type ^Y, the stored path will be filled in and the line will look something like this:
ok nvalias rootmirror /pci@8,600000/SUNW,qlc@4/fp@0,0/disk
Notice that the line is truncated. You'll need to add "@target,0" to the end of what you see. In this case, "@1,0" to match the new device.
ok nvalias rootmirror /pci@8,600000/SUNW,qlc@4/fp@0,0/disk
You can display the devices in your boot devices list by typing "printenv boot-device" at the ok prompt. Then, type the following command to add the rootmirror to the list. Notice how we are adding it after the primary root mirror and before the option to boot off the network.
ok setenv boot-device disk rootmirror net
Display your boot device list again and verify that your change has taken effect:
ok printenv boot-device
boot device= disk rootmirror net
At this point, it's a good idea to boot off your root mirror and make sure that everything works as expected. If your system complains that it cannot open the boot device, you need to check your spelling. Make sure the listing you collected earlier matches your new rootmirror alias.