4

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?

2
  • 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
    Commented Jan 18, 2017 at 10:15
  • root is not zfs. How can i find out which systemd units are enabled?
    – muzzamo
    Commented Jan 19, 2017 at 1:53

1 Answer 1

2

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.

9
  • Thanks. I have tried all this and still have the same problem. Only one of my zpools is mounted automatically upon reboot.
    – muzzamo
    Commented Jan 20, 2017 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
    Commented Jan 20, 2017 at 9:59
  • I don't have a the log anymore as I closed the session - sorry :-(
    – muzzamo
    Commented Jan 20, 2017 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
    Commented Jan 23, 2017 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
    Commented Jan 24, 2017 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .