2

I'm running ZFS on ubuntu 16.04.

I have two ZFS pools, each with 7 drives in RaidZ2.

Upon boot, only one of the two pools is mounted. I can mount the second one manually using

sudo zpool import vol2

At this point the second pool is mounted just fine.

How can I make sure that the first pool mounts upon boot?

  • I assume you are not running root on ZFS? Which ZFS related systemd units are enabled; i.e zfs-mount.service, zfs.target, zed.service (or zfs-zed.service) etc. – airhuff Jan 18 '17 at 10:15
  • root is not zfs. How can i find out which systemd units are enabled? – muzzamo Jan 19 '17 at 1:53
1

You should enable several services as follows:

sudo systemctl enable zfs-import-cache.service
sudo systemctl enable zfs-import-scan.service
sudo systemctl enable zfs-mount.service
sudo systemctl enable zfs-share.service
sudo systemctl enable zfs-zed.service (depending on version may be zed.service)

and also:

sudo systemctl enable zfs.target

Reboot and see what happens. Because of different versions and distributions, these may not all exist on you system. Any that do should be enabled.

EDIT1:
To see if these services were properly enabled, execute the following command:

ls -oR /etc/systemd/ |grep zfs

The output should look something like:

drwxr-xr-x 2 root 4096 22.01.2017 17:31 zfs-mount.service.wants/  
drwxr-xr-x 2 root 4096 22.01.2017 17:31 zfs-share.service.wants/  
drwxr-xr-x 2 root 4096 22.01.2017 17:31 zfs.target.wants/  
lrwxrwxrwx 1 root   39 22.01.2017 17:31 zed.service -> /usr/lib/systemd/system/zfs-zed.service  
lrwxrwxrwx 1 root 34 22.01.2017 17:32 zfs.target -> /usr/lib/systemd/system/zfs.target  
/etc/systemd/system/zfs-mount.service.wants:  
lrwxrwxrwx 1 root 48 22.01.2017 17:31 zfs-import-cache.service -> /usr/lib/systemd/system/zfs-import-cache.service  
lrwxrwxrwx 1 root 47 22.01.2017 17:31 zfs-import-scan.service -> /usr/lib/systemd/system/zfs-import-scan.service  
/etc/systemd/system/zfs-share.service.wants:  
lrwxrwxrwx 1 root 41 22.01.2017 17:31 zfs-mount.service -> /usr/lib/systemd/system/zfs-mount.service  
/etc/systemd/system/zfs.target.wants:  
lrwxrwxrwx 1 root 48 22.01.2017 17:31 zfs-import-cache.service -> /usr/lib/systemd/system/zfs-import-cache.service  
lrwxrwxrwx 1 root 47 22.01.2017 17:31 zfs-import-scan.service -> /usr/lib/systemd/system/zfs-import-scan.service  
lrwxrwxrwx 1 root 41 22.01.2017 17:31 zfs-mount.service -> /usr/lib/systemd/system/zfs-mount.service  
lrwxrwxrwx 1 root 41 22.01.2017 17:31 zfs-share.service -> /usr/lib/systemd/system/zfs-share.service  
lrwxrwxrwx 1 root 39 22.01.2017 17:31 zfs-zed.service -> /usr/lib/systemd/system/zfs-zed.service  

This will enable you to definitively determine whether the services were enabled even if you forgot the output when you enabled them or if you don't have access to the logs.

  • Thanks. I have tried all this and still have the same problem. Only one of my zpools is mounted automatically upon reboot. – muzzamo Jan 20 '17 at 9:52
  • Wow, I really thought that was it. I'll keep thinking about this though. When you entered those commands did you get any error messages, any no-response-at-all, or did they all say "created a symlink in /etc/systemd/... etc."? – airhuff Jan 20 '17 at 9:59
  • I don't have a the log anymore as I closed the session - sorry :-( – muzzamo Jan 20 '17 at 10:03
  • @muzzamo, I edited my question to include instructions for definitively determining whether those services are enabled or not. But, I just saw that you solved your problem so I guess this is pointless! – airhuff Jan 23 '17 at 0:52
  • 1
    Ok, lets try it manually, though I'm concerned as to why the enable command didn't work. First, try ln -s /usr/lib/systemd/system/zfs-zed.service /etc/systemd/system/zed.service and ln -s /usr/lib/systemd/system/zfs-import-scan.service /etc/systemd/system/zfs-import-scan.service and then the same thing for zfs-import-cache.service. After those 3 commands, assuming there are no errors, try rebooting. – airhuff Jan 24 '17 at 20:17

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.