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!

F’ You Hard Drives!

April 5, 2009 in Blog

So, I hate hard drives. I think everything about them is like a bad flashback to the 1980′s. They have something that constantly spins (stupid), which means they require lots of power (also stupid) and in turn generate lots of heat (ridiculous). All that aside, they’re by far the slowest part of any given computer!!!!! [...]

Read more

Picasa sucks!

March 31, 2009 in Blog

Why don’t they let you download images with anything except picasa?! Isn’t that a feature that the world might like? Why do you have to install picasa to download a friend’s web album? Google, you’re the worst company ever. You’re the queens of doing 85% of something. EDIT: Thanks to Scabdates, I now am able [...]

Read more

Wiki or DIE

March 31, 2009 in Blog

Alright, I guess it’s impossible to do anything except blog or wiki. I was thinking it might be nice to have some good knowledge base software implemented for myself, but I’ve played with a few of them that I found (via Google) and they’re terrible! Can someone write a not horrible, free KB tool that [...]

Read more

mod_security FTW

March 20, 2009 in Blog

The other night, I noticed that popsicle.easymac.org’s mailq was >22,000 message. I figured that was a problem. Turns out one of my users (who’s account I deleted without hesitation) was running a PHP proxy from his ~ directory. Looks like the stupid thing allowed some idiot to download some obnoxious looking perl scripts into the [...]

Read more

imgfixr update

March 13, 2009 in Blog

Okay, so the imgfixr.com update is coming fairly. I know i’ve been super lazy about it, but I’m actually working on code for it right now. The trouble is this: I can’t design ! Anyone who feels like helping out on a new design for imgfixr.com please let me know, and I’d be more than [...]

Read more

IRSSI botcmd hiding!

February 10, 2009 in Blog

Recently I got angry about the fact that IRSSI opens a new window to message the bots when I join a channel and doesn’t close it. I’m sure many have had this problem. Turns out the people who make IRSSI thought of this. I know, crazy right? Anyway… I had my botcmd set to: -botcmd [...]

Read more

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