Saturday, November 28, 2009

Pool Mirrored

I just bought another drive for my trusted OpenSolaris box to create a mirror for my data.

The command to create the pool is deceptively simple:


pfexec zpool attach poolname original_drive new_drive

To get the name of the pool and the original drive name:

pfexec zpool status

How about the name of the new drive? The only way I can think of is:

pfexec format

Comparing the outputs of the above commands will let you find the name of the new drive.

Example:
cuppa@opensolaris:/datapool$ pfexec format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c7t0d0
/pci@0,0/pci1458,b002@11/disk@0,0
1. c7t2d0
/pci@0,0/pci1458,b002@11/disk@2,0
2. c7t4d0
/pci@0,0/pci1458,b002@11/disk@4,0
Specify disk (enter its number):
Next we will check the status of my existing pools:


cuppa@opensolaris:~$ pfexec zpool status
pool: datapool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
datapool ONLINE 0 0 0
c7t0d0 ONLINE 0 0 0

errors: No known data errors

pool: rpool
state: ONLINE
scrub: none requested
config:

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

errors: No known data errors
cuppa@opensolaris:~$
Comparing the two outputs, it shows the device 'c7t4d0' is not used and therefore the new drive.

Adding it as mirror is straightforward:

pfexec zpool attach datapool c7t0d0 c7td4d0

Final product:

cuppa@opensolaris:~$ pfexec zpool status datapool
pool: datapool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
datapool ONLINE 0 0 0
mirror ONLINE 0 0 0
c7t0d0 ONLINE 0 0 0
c7t4d0 ONLINE 0 0 0

errors: No known data errors
cuppa@opensolaris:~$




WARNING: If you got the order of drive names wrong, you risk overwriting all your data!!! Be careful.

No comments: