Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a machine with two harddrives. I have installed OpenSolaris on one of them and now I want to add the other one as a mirror-drive in my zpool rpool. I guess I have to format the second disk first and then add it to the pool. How can I do this?

I have tried to follow OpenSolaris ZFS rpool mirror, but when I come to prtvtoc /dev/rdsk/c7t0d0s0 | fmthard -s - /dev/rdsk/c7t1d0s0 then I get this message: fmthard: Cannot stat device /dev/rdsk/c7t1d0s0 and prtvtoc: /dev/rdsk/c7t0d0s0: No such file or directory

Here is some commands and my output (I have removed parts of the output that I don't think is needed:

pfexec format

AVAILABLE DISK SELECTIONS:
    0. c7d0
    1. c7d1

and

zpool status

  pool: rpool
 state: ONLINE
 scrub: none requested
config: 
        NAME     STATE   READ   WRITE  CKSUM
        rpool    ONLINE     0       0      0
          c7d0s0 ONLINE     0       0      0   

EDIT: After running devfsadm -v the following comman works fine:

pfexec fdisk /dev/rdsk/c7d1s2
prtvtoc /dev/rdsk/c7d0s2 | fmthard -s - /dev/rdsk/c7d1s2
zpool attach -f rpool c7d0s0 c7d1s0

and

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 completed after 0h10m with 0 errors
config: 
        NAME     STATE   READ   WRITE  CKSUM
        rpool    ONLINE     0       0      0
          c7d0s0 ONLINE     0       0      0  
          c7d1s0 ONLINE     0       0      0 3,77G resilvered

errors: No known data errors

but I fail with installgrub

pfexec installgrub /boot/grub/stage1 /boot/grub/stage2 c7d1s0
cannot open/stat device c7d1s0
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted
  • Use format to get a list of the available harddisks.
  • rpools are special. Their disks must not have an EFI label. You can delete the EFI label with format/fdisk.
  • You don't have to format the drive before adding it to a zpool. But in case of rpools you need to copy the partition layout from the first to the 2nd disk. The commands you've mentioned are correct but you need to call them with s2 (entire disk) and not s0.
  • Use zpool attach to add a new mirror device for the existing device.
  • Verify the new mirror with zpool status rpool.
  • It's recommended to add entire disks to data zpools (and not only a single slice/partition).
  • Don't forget to install grub on the 2nd disk, too, to make it bootable. (Enable it as a boot drive in the BIOS, too. And test it!)

So finally here's the command sequence:

fdisk /dev/rdsk/c7d1s2  (confirm that you want a 100% Solaris partition)
prtvtoc /dev/rdsk/c7d0s2 | fmthard -s - /dev/rdsk/c7d1s2
zpool attach [-f] rpool c7d0s0 c7d1s0 (maybe use "-f" flag)
zpool status
installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c7d1s0

If you still can't get it to work please show us the output of zpool status and the drive list output from format.

share|improve this answer
    
Sorry, I somehow missed that you've mention that you're talking about an rpool. I'm going to updated my answer. –  knweiss Mar 13 '10 at 18:08
    
Updated, please try again. –  knweiss Mar 14 '10 at 0:35
    
What does ls -l /dev/rdsk/c7d1* show then? Did you try running devfsadm -v? I don't understand in what state your 2nd drive is. I've tried the commands myself in an OpenSolaris virtual machine and had no problems adding the rpool mirror disk. –  knweiss Mar 14 '10 at 12:23
    
The /dev/rdsk/ path prefix was missing in the installgrub line. –  knweiss Mar 18 '10 at 19:18
    
Excellent! It works perfect! Thank you very much! –  Jonas Mar 19 '10 at 22:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.