Multiplay Labs

tech hits and tips from Multiplay

Archive for January, 2012

ZFS: i/o error – all block copies unavailable on large disk number machines

without comments

We did a minor kernel update on a large storage machine here today which runs FreeBSD 8.2 and to our surprise it failed to boot at the loader with “ZFS: i/o error – all block copies unavailable”.

After some digging we discovered that this was likely due to the fact that the BIOS only enumerates the first 12 disks and this machine has more than that in the root zpool which was a striped raidz2 volume. This in turn means that the bootcode cant complete and hence the machine can’t boot.

Our solution was to migrate the root fs off the raidz2 volume and to a mirrored volume which was on two disks which where accessible from the BIOS.
To do this we created a new zfs pool manually, copied the data using zfs send … | zfs restore .. then fixed the cache file by importing the pools with the following commands from a mfsbsd cdrom.

zpool import -R /mnt -o cachefile=/boot/zfs/zpool.cache tank
zpool import -R /mnt2 -o cachefile=/boot/zfs/zpool.cache tank2
cp /boot/zfs/zpool.cache /mnt/boot/zfs/zpool.cache
zpool set bootfs=tank/root tank

It would of course be nice if zfs warned or even prevented this.

Written by Dilbert

January 23rd, 2012 at 5:01 pm

Posted in FreeBSD

Tagged with ,

Updated contextual help in WordPress

without comments

If you’re like me and you try to be a good citizen when it comes to writing wordpress plugins, then you’ll write some contextual help/documentation for them that shows up in the appropriate places of the wordpress admin interface.

Since the wordpress 3.3.1 update however, the previous method I used of doing this resulted in the help permanently appearing on the pages in question. When you have a lot of plugins and a lot of help text, that can result in the actual admin interface being several full page scrolls away, which can be pretty annoying.

As such, I recently worked out how to quickly adapt the old simple style of adding contextual help to make use of the newer system.

Before:

// add some contextual help in for add/edit post admin pages
add_action('load-post-new.php', 'myplugin_help');
add_action('load-post.php', 'myplugin_help');
 
function myplugin_help() {
   add_filter('contextual_help','load_myplugin_help');
}
 
function load_myplugin_help($help) {
    echo $help;
    echo "My custom plugin help";
}

After:

// add some contextual help in for add/edit post admin pages
add_action('load-post-new.php', 'myplugin_help');
add_action('load-post.php', 'myplugin_help');
 
function myplugin_help() {
   add_filter('contextual_help','load_myplugin_help');
}
 
function load_myplugin_help($help) {
    get_current_screen()->add_help_tab( array(
        'id'        => 'myplugin-help',
        'title'     => __('My Plugin Help'),
        'content'   => "Help for my plugin"
    ) );
}

The benefit of this new way is that the new system nicely sorts all the help into little menus, so rather than having all of your help on one massive page, the help dropdown at the top of the admin interface provides a menu for each plugin, allowing the help section to take up less space and generally be more usable.

Written by Andrew Montgomery-Hurrell

January 16th, 2012 at 2:56 pm

Posted in Code,PHP,Wordpress

Tagged with