Monday, April 6, 2009

Playing around with ZFS File system using Virtual Disk created from Sun xVM VirtualBox - Working with ZFS hotspares

In our earlier scenario we created a zpool and added extra storage to it. Here we would detail how to create a zpool with a hotspare. But before we could do this, we need to delete / destroy our previous pool. (Note - doing this would erase all your data in your zpool). Here's how we do it:

root@opensolaris:~# zpool destroy zpooldata

So with this, zpooldata is gone.

Now lets go ahead and a create one with a hotspare.

In our case, we would be using Disk 1 as a hotspare and Disk 7 and Disk 8 would form part of zpooldata. Here's how we do this:

root@opensolaris:~# zpool create zpooldata c5t4d0 c5t5d0 spare c3d1

(Note: For all practical purposes, make sure that the the disk which you allocate as a hot spare is larger than any of the disk on your pool.)

root@opensolaris:~# zpool status

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

NAME STATE READ WRITE CKSUM
zpooldata ONLINE 0 0 0
c5t4d0 ONLINE 0 0 0
c5t5d0 ONLINE 0 0 0
spares
c3d1 AVAIL

errors: No known data errors
root@opensolaris:~#

the above shows that Disk 2 is a spare.

Now lets go ahead and add another disk to the hotspare. Here's how we do it.

root@opensolaris:~# zpool add zpooldata spare c4d1
root@opensolaris:~# zpool status

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

NAME STATE READ WRITE CKSUM
zpooldata ONLINE 0 0 0
c5t4d0 ONLINE 0 0 0
c5t5d0 ONLINE 0 0 0
spares
c4d1 AVAIL
c3d1 AVAIL

errors: No known data errors
root@opensolaris:~#

Now, lets remove both of the hotspare disks.

root@opensolaris:~# zpool remove zpooldata c3d1 c4d1
root@opensolaris:~# zpool status

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

NAME STATE READ WRITE CKSUM
zpooldata ONLINE 0 0 0
c5t4d0 ONLINE 0 0 0
c5t5d0 ONLINE 0 0 0

errors: No known data errors
root@opensolaris:~#

Remember, adding or removing hotspares from your zpool wont really affect the total available storage in your pool. These are just hotspare disks and would be used in an event when a disk in the main pool fails.

0 comments:

BLOG Maintained by - Vishal Sharma | GetQuickStart