Search This Blog

05 August 2008

Mirroring resolved the correct way!

Thanks to Mike Ellis for helping get this resolved correctly...

malachi@serveris:~# zpool detach rpool c5t1d0s2
malachi@serveris:~# zpool status -v
  pool: rpool
 state: ONLINE
 scrub: resilver completed after 0h1m with 0 errors on Tue Aug  5 21:16:53 2008
config:

    NAME        STATE     READ WRITE CKSUM
    rpool       ONLINE       0     0     0
      c5t0d0s0  ONLINE       0     0     0

errors: No known data errors

malachi@serveris:~# prtvtoc /dev/rdsk/c5t0d0s2 | fmthard -s - /dev/rdsk/c5t1d0s2
fmthard:  New volume table of contents now in place.

malachi@serveris:~# prtvtoc /dev/rdsk/c5t0d0s2
* /dev/rdsk/c5t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*   30400 cylinders
*   30398 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00    4209030 484134840 488343869
       1      3    01      16065   4192965   4209029
       2      5    01          0 488343870 488343869
       8      1    01          0     16065     16064
malachi@serveris:~# prtvtoc /dev/rdsk/c5t1d0s2
* /dev/rdsk/c5t1d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*   30400 cylinders
*   30398 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00    4209030 484134840 488343869
       1      3    01      16065   4192965   4209029
       2      5    01          0 488343870 488343869
       8      1    01          0     16065     16064
malachi@serveris:~#

malachi@serveris:~# zpool status
  pool: rpool
 state: ONLINE
 scrub: resilver completed after 0h1m with 0 errors on Tue Aug  5 21:16:53 2008
config:

    NAME        STATE     READ WRITE CKSUM
    rpool       ONLINE       0     0     0
      c5t0d0s0  ONLINE       0     0     0

errors: No known data errors
malachi@serveris:~# zpool attach rpool c5t0d0s0 c5t1d0s0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c5t1d0s0 overlaps with /dev/dsk/c5t1d0s2
malachi@serveris:~# zpool attach -f rpool c5t0d0s0 c5t1d0s0

malachi@serveris:~# zpool status
  pool: rpool
 state: ONLINE
 scrub: resilver completed after 0h1m with 0 errors on Tue Aug  5 21:40:29 2008
config:

    NAME          STATE     READ WRITE CKSUM
    rpool         ONLINE       0     0     0
      mirror      ONLINE       0     0     0
        c5t0d0s0  ONLINE       0     0     0
        c5t1d0s0  ONLINE       0     0     0

errors: No known data errors

malachi@serveris:~# prtvtoc /dev/rdsk/c5t0d0s0
* /dev/rdsk/c5t0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*   30400 cylinders
*   30398 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00    4209030 484134840 488343869
       1      3    01      16065   4192965   4209029
       2      5    01          0 488343870 488343869
       8      1    01          0     16065     16064
malachi@serveris:~# prtvtoc /dev/rdsk/c5t1d0s0
* /dev/rdsk/c5t1d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*   30400 cylinders
*   30398 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00    4209030 484134840 488343869
       1      3    01      16065   4192965   4209029
       2      5    01          0 488343870 488343869
       8      1    01          0     16065     16064
malachi@serveris:~#

malachi@serveris:~# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c5t1d0s0
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 260 sectors starting at 50 (abs 16115)

17 comments:

  1. Hi,thank you for this Blogentry. I've posted a simple Tutorial for a ZFS Root Mirror on my own Blog. What do you think about it?

    ReplyDelete
  2. It appears that we were missing a step....

    before doing the fmthard, you have to do fdisk on the new drive.

    In my case, I did 'pfexec fdisk /dev/rdsk/c4t1d0s2', it complained, I said yes then everything was fine.

    If you skip this step, you'll get:
    fmthard: Partition 2 specifies the full disk and is not equal

    and later:
    "Partition 0 of the disk has an incorrect offset"

    ReplyDelete
  3. Is this something that you need to do even if you created the mirrored root during the OS install? We're running opensolaris and have the option of creating a mirrored zfs root from the text gui

    ReplyDelete
  4. I wouldn't think so. When I did mine, mirror wasn't an option. Maybe install grub on the second drive, but I don't know.

    ReplyDelete
  5. Many Thanks for those precise explanations mate!!

    Im now running mirror on my rpool!

    I tried to how swap the main drive but opensolaris did not like it at all :(
    Altrough it booted fine on the spare after reboot.
    ZFS FTW !!!
    the box is full now with 7x 1tb raidz2 and 2x 160gb mirror

    ReplyDelete
  6. Thanks for this, was fluffing around for ages trying to get this to work!

    ReplyDelete
  7. Thanks a lot for the info, was plain & simple!

    ReplyDelete
  8. I used these instructions to mirror my T5440 using Sun Solaris 05/09 U7 and it all worked until I used the installgrub command and my system does not have this command so what do I do instead?

    Cheers

    Steve

    ReplyDelete
  9. I don't know what's on that Sun box. On this x86 install of OpenSolaris (ie: Solaris 11) it is at /usr/sbin.

    ReplyDelete
  10. Malachi, glad you posted this tutorial.

    A couple things maybe worth mentioning. If you hotplug a SATA disk, and your controller supports hotswapping, you may still have to do cfgadm and check the state of the drive. (This happens on an nVidia 610i) If it's unconfigured just cfgadm -c configure SATA1/1 or whatever port it's on. Then you should be able to add it to the pool. The other advantage is it will give the address (c0t0d0 etc. of the new drive). This will not work for IDE, and I don't have any SCSI drives to try this with so I can't say if itworks the same way.

    Also, I have been trying to figure out a way to find the IDE (SCSI?) disks other than using the format command. Yeah you can control C out of it but it just makes me nervous having to tell someone else to do that. Especially some of the Windows users, say the word format and they get all red nervous and itchy ;)

    ReplyDelete
  11. Thanks for the tip. I haven't used that tool yet.

    As far as the IDEs go... check your dmesg - maybe it shows there?

    ReplyDelete
  12. Hi ,

    These procedures look something like "disk clone". Are there any methods to do ZFS RAID-1 on Solaris ?

    ReplyDelete
  13. Hi Fred.Lin. I am not sure I follow your question. That is RAID-1 (mirror) implemented on ZFS.

    ReplyDelete
  14. Regarding procedures for SPARC (@anonymous who had a T5440), if you are using Solaris 10 (would have been the most likely case in 2009 when the post was made), you use the following utility, not installgrub:

    sparc# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/

    ReplyDelete