OpenSolaris with a raid-z array, Part2

Here is my attempt to install OpenSolaris on 3x 4GB drives in a virtualised environment. This did not go well at all! My virtualised environment could not boot because I used the wrong commands in Step 3 and overwrote the wrong partition information. I’ve left this here for my own personal records.

Part of the problem is that OpenSolaris does not really support using sub-partitions within a hard disk, and I was trying to do with creating a raid-z array without a fourth disk for my zfs rpool.

In the end because I was targeting the wrong slices, my OpenSolaris ended up unbootable.

DO NOT FOLLOW THESE INSTRUCTIONS UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!

Step 1: Install OpenSolaris to the first partition.

osol-install01

One blog post I came across claims that, you cannot install OpenSolaris with the “Use whole disk” option and later use this disk in a root zpool. I’m not sure how reliable this information is, because ZFS prefers to use whole disks instead of partitions (or slices, in Solaris parlance). You can see that in the Solaris documentation, it creates a zpoool using an entire disk (controller 1, target 0, disk 0 = c1t0d0).

Installing on slices is doable … but ZFS seems to disable the disk’s write cache if you did that. More steps follow:

Step 2: Create a 2nd partition for the raid-z array

rootzpool-01

Here I created a 2nd partition for the raid-z array.

Step 3: Prep drives 2 and 3

Now we have to copy the layout of the first drive onto drives 2 and 3 in the array.

First we have to get a root shell. Do this with the command: su -

rootzpool-02

You can examine the layout of the first drive with the command : prtvtoc /dev/rdsk/c4t0d0s2
prtvtoc is “print volume table of contents”.  And OpenSolaris puts the raw disk device nodes in /dev/rdsk.

rootzpool-03

If the jargon is a bit difficult, you can always use the format tool and then use the command: verify when you have the format> prompt.

rootzpool-04

[Ignore the screenshot - this was a mistake! I should NOT have copied the prtvtoc from c4t0d0s0, I THINK the CORRECT use is c4t1d0s2. Slice 2 is the "whole disk slice".]

Now take the partition table from the first disk, and apply it to the 2nd (c4t1d0s2) and 3rd (c4t2d0s2) disks:
prtvtoc /dev/rdsk/c4t0d0s2 | fmthard -s  – /dev/rdsk/c4t1d0s2 [WARNING: I haven't tested this - the first time I tried it I targeted the wrong slice]
and
prtvtoc /dev/rdsk/c4t0d0s2 | fmthard -s – /dev/rdsk/c4t2d0s2
[WARNING: I haven't tested this - the first time I tried it I targeted the wrong slice]

rootzpool-04

Step 4: Create a mirrored rpool

Now that the drive partitions are prepared, go add disks to the rpool mirror.

rootzpool-05

The commands are as follows. NOTE: zpool attach -f means “ignore the warnings”. If you look at Step 3 above, you’ll notice that Partition 0 overlaps with Partition 2 and Partition 8 overlaps with both Partitions 0 & 2. In retrospect, this was the warning I should have heeded! I think I was targeting the wrong slices.

zpool attach -f rpool c4t0d0s0 c4t1d0s0 [WARNING: I haven't tested this - the first time I tried it I targeted the wrong slice]

and
zpool attach -f rpool c4t0d0s0 c4t2d0s0
[WARNING: I haven't tested this - the first time I tried it I targeted the wrong slice]

Congrats! If you check the output of zpool status and zpool list you’ll see you’ve expanded the rpool by adding 2x mirrors, and the storage available is the same (4 GB).

Step 5: Create a raidz zpool called “tank”

I love this naming convention … raidz ! Awesum … we gonna plan some 25-disk raidz … hahaha. If you can follow the first 4 steps above, then creating the raidz zpool is an extension of what you’ve learned above.

zpool attach -f tank c4t0d0s2 c4t1d0s2 c4t2d0s2 [WARNING: I haven't tested this - the first time I tried it I targeted the wrong slice.]

Now you can check out your new storage:
zpool list
zpool status

rootzpool-06

You might think that there is an intentional mistake in this configuration?

Take 5 minutes …

… got it ?

The raidz zpool has 12 gigs of space … that’s 4GB x 3. Which might lead you to believe that there is no redundancy in our raidz zpool. Because if ine drive dies = bye bye data.

Actually … you should try and copy a 5 gig file over to the zpool. You’ll notice that the disk used is more than 5 gigs … this is because the zpool list command does not take into account the disk space used to store the parity  / checksums.

Step 6: Check out Sun’s 12 minute demo (Optional)

If you couldn’t follow that, or if you want to compare notes with how Sun likes to demo ZFS, you can check out their 12-minute ZFS Basics Demo.

Congrats!

No related posts.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>