I suppose this isn't a best practice, but I find myself in a situation where I have zfs filesystems mounted on other zfs filesystems. For example:

zfs list:

...

storage/jayd

storage/jayd/home

The problem I have encountered is that on reboot, the zfs filesystems sometimes mount out of order, and I get an error message similar to:

cannot mount /storage/jayd: directory not empty.

Which indicates that the storage/jayd/home filesystem was mounted before the storage/jayd filesystem.

If you find yourself in a similar situation, the following script may be of use. Disclaimer - make sure you understand what this script does and before attempting to use it ! I take no responsibility for any loss of data that may occur. That being said, I find this script to be useful for sorting through mount issues associated with large numbers of zfs datasets. Note that the script uses 'echo' to display the recommended commands to be executed, but does not actually perform the umount/rmdir commands.

#!/bin/sh
#
# ZFS mount cleanup script.
# Author: Jay Danielsen
#
# Notice: No guarantees - Use at own risk!
#
# Build list of filesystems that cannot be mounted.
for i in `zfs mount -a 2>&1 | grep "^cannot" | \
  awk '{print $3}' | \
  sed -e "s;':;;" -e "s;';;"`; do
  echo $i
  echo cleanup for filesystem $i
  echo "Please verify the safety of the following umount/rmdir commands before executing:"
  # Unmount and rmdir all subdirs
  for f in $i/*; do
    echo umount $f
    echo rmdir $f
  done
  echo ""
done
echo zfs mount -a


Comments:

I would have thought that the automatic mounting of ZFS file system out of order would be be a bug.

Posted by Brian Utterback on December 08, 2008 at 03:54 PM EST #

it is since last year... http://bugs.opensolaris.org/view_bug.do?bug_id=6612218

Posted by Jonas on December 23, 2008 at 07:39 AM EST #

God bless a hacker

Hi my name is osman bah black african with the hope to make freindship with you,are you a hacker?is it true that a hacker can survive our nowadays crisis?I belive it is not a crime for me to have a hacker as a freind but the last time I have one he stole my password of my mail box.

my intention is to be your freind and learn some simple tricks that can help me survive with my family and I prefer this rather than scamming in internet.

please accept my freindship

thanks

Osman Bah

00225 47 64 92 93

Posted by osman bah on June 19, 2009 at 02:28 PM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Jay Danielsen