As noted in my previous post, I am interested in playing with ZFS and seeing what it can really do. This is what I am writing about today.
To start out, I figured I should really learn how disks are labeled in Solaris. I knew that the labeling has something to do with all the /dev/[r]dsk/c* labels and that is about all I knew. Then I found this article [1] about what the labels are and how they work. As a refresher for those who know, or a micro lesson for the impatient, here is a summary.
/dev/dsk/cCtTdDsS
represents (c)ontroller C
(t)arget T
(d)isk D
(s)lice S
Slices in Solaris are like partitions, kinda. Slices are effectively partitions that can overlap each other. Traditionally slice 2 is the entire disk, and slice 0 is the root directory and so on. Learning this clears up some questions that I had.
The disk slices can be accessed by either the /dev/dsk/ or the /dev/rdsk interfaces. The /dev/dsk/* are intended to be accessed at the block level, while /dev/rdsk/* are intended to be accessed as a character device.
Really read [1] for the real info. It does a great job of describing what is going on.
While I'm waiting for the new openSolaris install to complete in VirtualBox, I will describe for you what I am trying to do.
(1) Install OpenSolaris on a Mirrored ZFS root partition
(2) Write random data to disk and see what ZFS does
(3) learn some of the ZFS commands and how they work.
It seems like (1) will be the most difficult part. Googling for "OpenSolaris root mirror" showed some good results. It would seem that you need to install OpenSolaris on one disk, then add a second disk as mirror to the rpool. So that is what I did. I added another virtual disk to my VirtualBox setup as Secondary Slave. I will use that to mirror to. Following the instruction in [2] and [3] to got it up and running.
On a side note, the Open Source edition of VirtualBox only allows you to use IDE drives and doesn't have USB support and whatnot. I really don't care, at this point I am just toying with OpenSolaris, so these issues are of no concequence. See [4] for detail.
Now to write random data to disk and see what happens.
# dd if=/dev/urandom of=/dev/rdsk/c4d1s0 bs=64k count=10k
This copies out about 640Mb of random data to disk.
Absolutely nothing happens! As expected. I played around with different tools and toys and such, and eventually, I ended up getting some silent errors that showed up when I looked at the pool status::
# zpool status
Appearently there was so many errors that the disk was marked as bad by ZFS and therefore was DEGRADED. But all I did was ::
# zpool clear rpool
And the error when away. In 'real' life I wouldn't dare do that, as the disk is probably bad. We caused the errors, expected them to occur, and now we are happily rolling along as if nothing ever happened.
ZFS is cool.
-----------
References:
[1] http://initialprogramload.blogspot.com/2008/07/how-solaris-disk-device-names-work.html
[2] http://darkstar-solaris.blogspot.com/2008/09/zfs-root-mirror.html
[3] http://malsserver.blogspot.com/2008/08/mirroring-resolved-correct-way.html
[4] http://www.virtualbox.org/wiki/Editions
Share
You need to be a member of Open Source University Meetup to add comments!
Join this social network