Automount ZFS zpool in Ubuntu 12.04

4

1

So, I've been told that ZFS for Linux has the ability to automatically mount a zpool on system startup in Ubuntu 12.04, but it doesn't work for me and I can't find any documentation on how to make it work.

I have a 5 disk raidz zpool mounted at /zstorage. Currently, when my server starts, I have to type sudo zfs mount zstorage in order to get it to be accessible, which is a bit of an issue as I have a number of programs that start automatically and look for folders in there.

In the case of on, SabNZBD+, if it doesn't find the folders it needs it will revert to the default. This is especially a problem as the default folder is in a tiny SSD which is meant for nothing but as a boot volume.

dougoftheabaci

Posted 2012-08-07T06:04:26.227

Reputation: 502

Answers

5

If you are using zfs-fuse, just running the zfs-fuse init script on startup should do it. I have several computers with zpools on external disks and they are all mounted automatically on boot with zfs-fuse.

In particular, the init script contains the line

zfs mount -a

which mounts all available zfs filesystems. You could add this line to any zfs init scripts you have or put this line into the local init script.

Lars Kotthoff

Posted 2012-08-07T06:04:26.227

Reputation: 1 447

I'm using 'ZFS on Linux': http://zfsonlinux.org/

– dougoftheabaci – 2012-08-08T17:26:18.937

1Have you tried running zfs mount -a on startup? – Lars Kotthoff – 2012-08-08T17:29:13.717

I imagine that would work but how do I automate it? Sorry, I should clarify, this is my first real experience with Ubuntu and I may have just dived in at the deep end. – dougoftheabaci – 2012-08-09T18:05:21.550

The easiest way is probably to add the command to /etc/rc.local. Also see http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown

– Lars Kotthoff – 2012-08-09T18:21:50.283

Finally had a chance to give this a try. Works great. Thanks! – dougoftheabaci – 2012-09-11T03:10:30.407

4

If you go to /etc/default/zfs that is where you'd set the flag to normally mount the ZFS volumes on startup but not anymore. As it states in the config-file mentioned above, what you could try is installing zfs-mountall with apt-get:

sudo apt-get install zfs-mountall

This should work, provided you have installed native ZFS and not zfs-fuse. More information is provided here: http://zfsonlinux.org/faq.html

Henric

Posted 2012-08-07T06:04:26.227

Reputation: 91

Reading package lists... Done Building dependency tree
Reading state information... Done Note, selecting 'mountall' instead of 'zfs-mountall' mountall is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
– dougoftheabaci – 2012-08-15T04:30:30.530

Any progress on this for you? I've just installed Ubuntu 11.10 instead (didn't like 12.04) and what I did was install zfs, create the mountpoint, change permissions on the mountpoint to 777, import my zpool, checked that it mounted correctly with sudo zfs mount -a, rebooted and ran sudo apt-get update && sudo apt-get upgrade. The mountall package was then updated with zfs and my zpool now mounts on startup. I don't know why it doesn't work for you, but the process above worked for me. – Henric – 2012-09-02T14:53:33.880

It might be a 12.04 issue. What are the benefits of using 11.10 vs. 12.04? I could possibly reinstall 11.10 instead of 12.04 (seems things support it a bit better right now) but it's a bit of a whole to-do as I'd need to borrow a screen from work. – dougoftheabaci – 2012-09-04T17:41:54.213

There was a couple of reasons why I chose to install 11.10 instead but the main one is that I simply couldn't get unity-2d to work which I need for VNC (unity 3d doesn't update over VNC). Since my machine is headless it's something I really need. I also found 11.10 to be a lot faster for what I use it for (iTunes server in Windows XP virtualbox, file server, web server etc.). I can't point to any specific benefits as this is just what I experienced. I do think that support is better for 11.10 so that might be a reason to change. – Henric – 2012-09-04T20:31:38.407

3

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.

Nick Grealy

Posted 2012-08-07T06:04:26.227

Reputation: 278