How to add a mirror-disk to my OpenSolaris?
- 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
.
Comments
-
Jonas over 1 year
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
andprtvtoc: /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
-
knweiss about 14 yearsSorry, I somehow missed that you've mention that you're talking about an rpool. I'm going to updated my answer.
-
knweiss about 14 yearsUpdated, please try again.
-
knweiss about 14 yearsWhat does
ls -l /dev/rdsk/c7d1*
show then? Did you try runningdevfsadm -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 about 14 yearsThe
/dev/rdsk/
path prefix was missing in the installgrub line. -
Jonas about 14 yearsExcellent! It works perfect! Thank you very much!