Avoiding Device Confusion in FreeBSD with ZFS

Avoiding Device Confusion in FreeBSD with ZFS

In tutorial after tutorial, I find people creating zpools using a method that looks like:

% zpool create tank /dev/da2 /dev/da3 /dev/da4 /dev/da5

But, what happens when you reboot without /dev/da2 plugged in? /dev/da3 becomes /dev/da2 and your pool is confused and weird and all that junk.

A simple tip is to create a GPT on each disk you plan to add to a pool and rather than using the device node of /dev/da#p#, use the GPT partition ID device node that’s automatically created under /dev/gptid.

First, wipe the partition table on each of your disks, using:


% dd if=/dev/zero of=/dev/da2 bs=512 count=1
% dd if=/dev/zero of=/dev/da3 bs=512 count=1
% dd if=/dev/zero of=/dev/da4 bs=512 count=1
% dd if=/dev/zero of=/dev/da5 bs=512 count=1

Now create a new GPT on each disk, using:


% gpart create -s gpt da2
% gpart create -s gpt da3
% gpart create -s gpt da4
% gpart create -s gpt da5

Now create a FreeBSD ZFS partition on each disk. This is easy because we’re only making one partition per disk.


% gpart add -t freebsd-zfs da2
% gpart add -t freebsd-zfs da3
% gpart add -t freebsd-zfs da4
% gpart add -t freebsd-zfs da5

You should now see the gptids listed in /dev/gptid/


# ls -l /dev/gptid
total 0
crw-r----- 1 root operator 0, 126 Jan 23 15:44 1bcdc07f-4603-11e1-bd02-003048bb1b96
crw-r----- 1 root operator 0, 135 Jan 23 15:44 1cf8bda4-4603-11e1-bd02-003048bb1b96
crw-r----- 1 root operator 0, 143 Jan 23 15:44 1da00324-4603-11e1-bd02-003048bb1b96
crw-r----- 1 root operator 0, 151 Jan 23 15:45 1e83229b-4603-11e1-bd02-003048bb1b96

Now simply create your zpool however you like, using the gptid device node instead of the device ID.


# zpool create external \
/dev/gptid/1bcdc07f-4603-11e1-bd02-003048bb1b96 \
/dev/gptid/1cf8bda4-4603-11e1-bd02-003048bb1b96 \
/dev/gptid/1da00324-4603-11e1-bd02-003048bb1b96 \
/dev/gptid/1e83229b-4603-11e1-bd02-003048bb1b96

And check on it…


# zpool status external
pool: external
state: ONLINE
scan: none requested
config:

NAME STATE READ WRITE CKSUM
external ONLINE 0 0 0
gptid/1bcdc07f-4603-11e1-bd02-003048bb1b96 ONLINE 0 0 0
gptid/1cf8bda4-4603-11e1-bd02-003048bb1b96 ONLINE 0 0 0
gptid/1da00324-4603-11e1-bd02-003048bb1b96 ONLINE 0 0 0
gptid/1e83229b-4603-11e1-bd02-003048bb1b96 ONLINE 0 0 0

errors: No known data errors

You can use the gpart utility to see all kinds of data about your partitions as well. This is useful to figure out which gptid belongs to which disk.

ZFS Deduplication on Existing Pool

ZFS Deduplication on Existing Pool

Similarly to enabling compression on a ZFS partition that already has data, enabling deduplication does not deduplicate the data that already exists. This was a problem for me. To add to the problem, this pool had many partitions and the partitions each had many snapshots, all of which I wanted to preserve.

The only solution seems to be moving all the data away and back. I bought 4 external hard drives, made a storagebomb and away I went. This page has a good description of how to move an entire pool to a different device, preserving all the snapshots and whatnot.

Duplicity & S3

Duplicity & S3

It works really well and it’s cheap. Try it. Also read: http://andyleonard.com/2009…-of-others/

I’ll post my script here later.

Troubleshooting Roundcube 101

Troubleshooting Roundcube 101

I often idle in the #roundcube channel on Freenode and I’ve come to realize that time after time, I offer exactly the same help to numerous users. There are a few basic tasks that you should make sure you’ve completed before asking in the channel:

1. Read The Config Files!!!

RC’s configuration files are well documented and revisiting that potent, inline documentation can often answer your questions.

2. Enable Logging

If you’re experiencing undesired behavior, 9 times out of 10, the problem is the way you’ve configured RC. There is no way to identify yourself as the problem, without knowing exactly what it is that RC is doing behind the scenes. For that, you need to enable logging.

Just think… If the problem is in the logs, you won’t have to look stupid when you realize you made a typo on the mail server hostname. Less public ridicule is always a good thing!

Make sure your log directory is able to be written to by the web server!

3. READ THE LOGS

The logging is written in plain English. If you don’t know English, you’re probably not reading this page.

4. Google The Error

Now that you have thoroughly read through the log file and see errors indicating what may be wrong with your configuration, you have everything you need to make important inferences. If these inferences aren’t enough to guide you into a working configuration, it’s time for you to Google the error message. Chances are you’ll find somebody who has had the same issue and has since fixed it. If you’re lucky enough, this kind fellow may have posted the solution to your very problem!

5. Still Need Help?

If you’re unfortunate enough to come to this section having completed the previous sections thoroughly, you’ve either missed something (which happens), or you’ve got a problem that people in the channel will be interested to help you solve! All that’s left is for you to present the problem in a well-thought-out form. You should also make sure to mention the steps you’ve performed to try to fix your issue.

Now that you’ve asked your question, you have only one thing left to do — WAIT. Nobody in the channel is paid to support you, so if they’re busy, they may be disregarding the channel. You get what you pay for.

Headless FreeBSD Install

Headless FreeBSD Install

Ever wanted to install without a keyboard and mouse on the system? Do it over serial console! Here’s how to make a CD that can do it.

Extract the ISO

Get your install ISO from somewhere and extract it to some directory.

mkdir ./iso
tar -C ./iso -pxf 8.0-RELEASE-i386-disc1.iso
cd ./iso

loader.conf

Next thing to do is to tell the boot loader to start using the serial port. This can be done by putting:

console="comconsole"

somewhere inside boot/loader.conf (obviously inside the iso directory)

Make the ISO!

Now wrap it all up into an iso using:

mkisofs -J -r -b boot/cdboot -no-emul-boot -o 8.0-RELEASE-i386-disc1-serial.iso ./iso

or something of the sort.

You’re done!

Go burn the ISO file and boot a system off the CD. Set your terminal’s baud rate to 9600 and you’ll eventually see things booting up!

Solaris 10′s native LDAP client and an OpenLDAP server

July 29, 2009 in Blog

After plenty of hours of trying to figure out why it was that Sun’s native LDAP client wouldn’t talk to my OpenLDAP server I decided to call support. I had been through just about every Google result I could read and still got nowhere. It turns out that when you use the native client you’re [...]

Read more

The Scoop on FreeBSD & iSCSI (Currently)

July 17, 2009 in Blog

Please see the update to this post As A Target (Server) The only available iSCSI target software in FreeBSD is the /net/iscsi-target port. This is the iSCSI target from OpenBSD and is absolutely not suitable for production use (or even most non-production uses). Problems I’ve come across: Does not support CHAP. Will not allow multiple [...]

Read more

PowerEdge 2900 iSCSI Performance Problems w/ FreeBSD

June 19, 2009 in Blog

Got a new storage server, it’s a PE2900 from Dell. Installed FreeBSD 7.2 on it, rebuilt the kernel with all the updates and included: options iscsi_initiator connected to the iSCSI target across the LAN, then I used: dd if=/dev/zero of=/mnt/testiscsi/file.out bs=65536 to test the speeds after mounting it. I observed horrific speeds (in the range [...]

Read more

Hitachi Simple Modular Storage 100 Review

June 10, 2009 in Blog

I hate it. I didn’t buy it, someone else did and I got stuck “using” it, then selling it. It came preconfigured with a bunch of 300GB SAS 15K RPM drives in it for use with iSCSI. To me that makes no sense. What’s the point of the HUGELY fast drives in something that at [...]

Read more

Summer Schedule

May 18, 2009 in Blog

Here’s my horrible looking summer schedule. I can’t wait for August 15th. Seriously? History of Folk Music?!?! One more semester after this!!! http://www.easymac.org/~uminac/schedule.pdf

Read more

VLAN Trunking: Cisco vs. Dell

April 26, 2009 in Networking

In a recent battle at work I put a Cisco 2960G up against a Dell PowerConnect 5424. The PowerConnects aren’t bad… They’re cheap, gigabit, and Layer-2. Anyway, I quickly found out that unless you use GVRP, the Dell cannot learn what VLANs are out there. You have to specify allowed VLANS specifically on both ends [...]

Read more

Copyright © 2009 Christopher J. Umina - Powered by WordPress - Portfolio WordPress Theme by ThemeShift.com.