ZFS retardness

Normally I have nothing but praise for ZFS. But today is not one of these days.

This is one of the days that I am left puzzled at the design requirement that introduce a hard dependency between the filesystem and the host it runs at. If nothing else for a filesystem that boasts at how easy it is to move data even between boxes with different endianess it’s embarassingly easy to break the zpool status command. Here is how it normally works:

# hostid
# zpool status
pool: rpool
state: ONLINE
scrub: none requested

rpool ONLINE 0 0 0
c0d0s0 ONLINE 0 0 0

errors: No known data errors

And now for some fun let’s fake the hostid(1) output and try this again:

# /etc/init.d/hostid start
# hostid
# zpool status
pool: rpool
state: ONLINE
Assertion failed: reason == ZPOOL_STATUS_OK, file zpool_main.c, line 3182
Abort (core dumped)

Thankfully the hostname in the zdb(1M) output:

# zdb -l /dev/dsk/c0d0s0 | grep hostname

is there for strictly informational reasons and gets updated in case you decide to change it.


Tags: , ,

2 Responses to “ZFS retardness”

  1. Mark Musante Says:

    I’m not sure this is a valid test in that we don’t expect the hostid to change on a running system.

    The reason behind checking the hostid is to attempt to ensure that a pool is not imported on two systems /at the same time/. ZFS is not designed to handle multiple simultaneous writers, so by checking the hostid of the last system to import the pool, we’re reasonably certain that the pool is only imported on one machine at a time.

    The error code we’re not handling in the message you cite above is “ZPOOL_STATUS_HOSTID_MISMATCH”, which we handle prior to import and don’t expect to show up after import.

    I will write up a CR to note the issue.

  2. mperedim Says:

    Hi Mark,

    Thanks for the feedback. Makes sense.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: