zfsonlinux / pkg-zfs

Native ZFS packaging for Debian and Ubuntu
https://launchpad.net/~zfs-native/+archive/daily
308 stars 55 forks source link

Mounts datasets too late in boot process #101

Open jgoerzen opened 10 years ago

jgoerzen commented 10 years ago

This is on Debian wheezy.

I have datasets like so:

NAME                                                USED  AVAIL  REFER  MOUNTPOINT
rpool/minerva-1/ROOT                                657M  6.05G   584M  /
rpool/minerva-1/usr                                6.70G  3.30G  4.43G  /usr
rpool/minerva-1/var                                 732M  4.29G   450M  /var

When the system boots, /etc/init.d/zfs-mount is running too late. Other things are running first, such as syslog, LVM, etc. They are creating directories under /var. When zfs-mount runs, /var is no longer empty, and it refuses to mount it. This results in a non-working system.

The workaround I have documented at http://wiki.complete.org/ConvertingToZFS#zfs_mounting_workaround_.28for_separate_.2BAC8-usr.2C_.2BAC8-var.29 is:

Edit /etc/insserv.conf, and at the end of the $local_fs line, add zfs-mount (without a plus).

And, edit /etc/init.d/zfs-mount and change the three lines near the top to:

 # Required-Start:
 # Required-Stop:
 # Default-Start: S

Additionally, for people that have a zpool atop dm-crypt, this will not work well. They need to set Required-Start: cryptdisks-early and add zpool import -a one line before zpool mount -a in /etc/init.d/zfs-mount. They also must edit mountall-bootclean.sh to set "Required-Start: mountall zfs-mount".

These are probably not the correct fixes for going in this package, but I am documenting them here as a starting point anyhow.

jonathonf commented 10 years ago

@jgoerzen Any idea how can this be accomplished with systemd?

sanmadjack commented 10 years ago

I have this issue on Ubuntu as well. I have to restart most of my services after boot, since they failed to start due to their ZFS partitions not being mounted yet.

dajhorn commented 9 years ago

I have this issue on Ubuntu as well.

The packages for Utopic now have a /etc/init/zpool-import.conf enhancement that should generally resolve this kind of issue on Ubuntu. Feedback would be appreciated, especially with nested block device configurations like DM or LUKS.

FransUrbo commented 9 years ago

In my dailies (0.6.3+) I added the ZFS_INITRD_ADDITIONAL_DATASETS to mount, in the initrd, any filesystem other than the root fs.

# List of additional datasets to mount after the root                    
# dataset is mounted.
# The init script will use the mountpoint specified in
# the 'mountpoint' property value in the dataset to
# determine where it should be mounted.
#ZFS_INITRD_ADDITIONAL_DATASETS="rpool/ROOT/usr_local"

This is also part of my #2087 pull request.