13

Running ubuntu 13.10 server. Installed and setup zfs from the ubuntu ppa. All appears to work fine after a reboot if I manaully do a 'sudo zfs mount -a', but reading the FAQ on zfsonlinux.org it appears I should expect it to automatically mount. Not sure where to look to debug. I don't see any errors in /var/log/syslog related to zfs or mounting.

$ sudo zfs get all zp
NAME  PROPERTY              VALUE                  SOURCE
zp    type                  filesystem             -
zp    creation              Sat Mar 16 17:14 2013  -
zp    used                  464G                   -
zp    available             449G                   -
zp    referenced            13.3M                  -
zp    compressratio         1.00x                  -
zp    mounted               no                     -
zp    quota                 none                   default
zp    reservation           none                   default
zp    recordsize            128K                   default
zp    mountpoint            /zp                    default
zp    sharenfs              off                    default
zp    checksum              on                     default
zp    compression           off                    default
zp    atime                 on                     default
zp    devices               on                     default
zp    exec                  on                     default
zp    setuid                on                     default
zp    readonly              off                    default
zp    zoned                 off                    default
zp    snapdir               hidden                 default
zp    aclinherit            restricted             default
zp    canmount              on                     default
zp    xattr                 on                     default
zp    copies                1                      default
zp    version               5                      -
zp    utf8only              off                    -
zp    normalization         none                   -
zp    casesensitivity       sensitive              -
zp    vscan                 off                    default
zp    nbmand                off                    default
zp    sharesmb              on                     local
zp    refquota              none                   default
zp    refreservation        none                   default
zp    primarycache          all                    default
zp    secondarycache        all                    default
zp    usedbysnapshots       25.3K                  -
zp    usedbydataset         13.3M                  -
zp    usedbychildren        464G                   -
zp    usedbyrefreservation  0                      -
zp    logbias               latency                default
zp    dedup                 off                    default
zp    mlslabel              none                   default
zp    sync                  standard               default
zp    refcompressratio      1.00x                  -
zp    written               13.3M                  -
zp    snapdev               hidden                 default
9

You need to edit the file /etc/default/zfs with your favourite editor, eg: nano, vim or something else, and change the lines

ZFS_MOUNT='no'
ZFS_UNMOUNT='no'

to

ZFS_MOUNT='yes'
ZFS_UNMOUNT='yes'

The other option is to install mountall (apt-get install mountall) from the ZFS Stable PPA, it takes care of that for you. The first option is preferable and faster.

  • 2
    mountall seems to be the officially supported way of doing this in ubuntu now. There are no ZFS_MOUNT options in the /default/zfs file and adding them was not sufficient to get my pool mounted – Russell Fulton Nov 5 '15 at 19:47
6

For me on Ubuntu 14.04 LTS, I had to set the following

To automatically import the zpools, change the value from 1 to 0:

File: /etc/init/zpool-import.conf

modprobe zfs zfs_autoimport_disable=0

To automatically mount the zfs mounts, add the following line:

File: /etc/rc.local

zfs mount -a

Restarted, and the zpool ZFS mounts were mounted automatically.

  • 1
    I had the same problem (auto import not working at boot time) with a fresh Ubuntu 14.04 LTS installation and your solution solved it. – masgo Nov 18 '15 at 0:16
  • Good to hear! :) – Nick Grealy Apr 23 '16 at 0:48
  • 1
    /etc/init/zpool-import.conf doesn't appear to exist on Ubuntu 16.04, even after switching back from systemd to upstart. – GDorn May 25 '16 at 0:23
  • @GDorn, have you tried this solution? - askubuntu.com/questions/768179/zfs-pools-not-mounted-16-04 – Nick Grealy May 25 '16 at 4:58
2

I had the same problem on a clean install on 16.04 LTS.

After a restart, no pools were present (zpool status showed no pools), but a zpool import <poolName> would restore my pool.

Turned out to be fixed by the answers to ZFS Pools not mounted 16.04. Reproducing the working answer here:

sudo apt remove zfs.doc
sudo apt install zfsutils-linux

This

1

I've found that even with mountall it just doesn't work right sometimes. I literally built two identical servers, placed identical model HDs in each one and installed Ubuntu and the ZFS PPA at the same time from the same sources. One would automount, the other wouldn't. Even following the extra FAQ instructions about adding a sleep in the mountall.conf file, etc., it never would mount at boot. I ended up putting a mountall command in /etc/rc.local.

1

Using Ubuntu 16.04 zfs, there is something I found that fixes mounting zfs shares at boot without creating rc.local or systemd scripts, and without manually running zfs set sharesmb=on after each boot.

To sum up: zfs mount -a and zfs share -a do not work, but using zfs set sharesmb=on does work. Running sudo /etc/init.d/zfs-share restart works too. Also, the mountall program in 16.04 does not support zfs, for whatever reason.

I think the problem is that when you set sharesmb=on, it creates a share name based on poolname/sharename like so: poolname_sharename

But it seems that this share name can be too long. I've read that you should limit netbios names to 14 characters or less, and also limit the number of characters in the Comments field too.

So, I created a new filesystem with a combined length of less than 14 characters, including the underscore:

sudo zfs create -o casesensitivity=mixed -o nbmand=on pool/share

Then edit /etc/default/zfs, and disable smb mounting/sharing: (I think one is for NFS, but I disable it all)

ZFS_MOUNT='no'
ZFS_UNMOUNT='no'
ZFS_SHARE='no'
ZFS_UNSHARE='no'

Finally, enable sharesmb for the new filesystem:

sudo zfs set sharesmb=on pool/share

I also made sure the /ect/hostid file exists. (google how to create one)

Now when I reboot, I run this command without having to do anything else, and my share appears:

smbclient -U guest -N -L localhost  (or use smbclient -L localhost)

Sharename       Type      Comment
---------       ----      -------
print$          Disk      Printer Drivers
IPC$            IPC       IPC Service (my server (Samba, Ubuntu))
pool_share      Disk      Comment: /pool/share

And yes, I know that samba supports names longer than 14 characters, but it seems to screw up mounting zfs shares at boot.

I'd love to know if this works for anyone else, or if its just some quirk on my system...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.