Admin: Making OpenSolaris Boot Disk Mirrored via ZFS

This blog entry is a "note to self" entry.  I've got a system running OpenSolaris and I want to protect the data on the boot disk by mirroring it with a second disk; if one disk fails, ZFS will let me boot from the other disk, and I can easily replace the failed disk without any downtime.

I followed the instructions in this blog entry, about the most concise and easy-to-follow tutorial I've ever seen.  I've got two disks I'm going to use for my boot disk mirror; call them Disk A (device c7d9) and Disk B (device c9d1).  Here's what I did; note that for these instructions below, either be root or prefix these commands with "pfexec", sort of like "sudo" on Linux but without having to type a password if you have the right privileges:

  1. Installed OpenSolaris on Disk A (c7d9s0).

  2. Format Disk B (c9d1s0), putting a Solaris Partition on the full disk:


    • # format

    • within the format program, type "fdisk"

    • within fdisks, create 100% Standard Solaris Partition over the full disk)



  3. Overwrite Disk B's  info, copying Disk A's partition info onto it:


    • # prtvtoc /dev/rdsk/c7d9s2 |  fmthard -s - /dev/rdsk/c9d1s2
    • (note: for both disks involved here, use slice 2, not slice 0.  i.e., c7d9s2, c9d1s2)



  4. Attach Disk B to the ZFS root pool (the OpenSolaris install creates a ZFS pool called "rpool" by default; this is where the OS bits are laid out):


    • zpool attach -f rpool c7d9s0 c9d1s0



  5. Install the GRUB boot loader on the mirrored disk (Disk B):


    • # installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c9d1s0



That's it.  Meanwhile, as soon as you do the "zpool attach", ZFS will start "resilvering" the second disk, mirrorring the contents of Disk A onto Disk B.  Don't believe me?  Check it out:
  • # zpool status

will show you something like this:


drapeau@choctaw:~$ zpool status
  pool: rpool
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
 scrub: resilver in progress for 0h1m, 40.90% done, 0h1m to go
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror    ONLINE       0     0     0
            c7d0s0  ONLINE       0     0     0
            c9d1s0  ONLINE       0     0     0  1.98G resilvered

errors: No known data errors


That's all there is to it.

Comments

I was searching all over the

I was searching all over the web for tips to mirror my OpenSolaris boot disk and I found a detailed step by step tutorial here. I have tried it and successfully mirrored my OpenSolaris boot disk too. Since the shell scripts are also provided along with each step, it was really simple. So there is no need for us to search for the scripts to perform each mentioned steps in the internet again. Any reviews about www.datanumen.com I have checked the link to the blog post you have provided in the post to view the original article. But I think the post was removed from the blog recently.

Quick Question....

Hi there, Thank you for the easy to follow tutorial on how to set this up. I have 2 quick and hopefully easy questions. I am in the process of assembling all my hardware and I plan on running a Open Solaris machine for my home network for back ups, streaming media and other odds and ends. I have been educating myself about the OS and all it’s great features. 1.If you decide not to mirror your boot and your single drive with the OS on it does die off what do you do? Will you loose all your pools that you have created or is it simply a matter of reinstalling the Open Solaris OS on a new drive and importing your pools again? 2.If you do decide to mirror your boot drive and it does die off how would one go about initializing your mirror drive? Thanks in advance for any help!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.