4

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.

3 Answers 3

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.

5
  • I'm using 'ZFS on Linux': zfsonlinux.org Aug 8, 2012 at 17:26
  • 1
    Have you tried running zfs mount -a on startup? Aug 8, 2012 at 17:29
  • 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. Aug 9, 2012 at 18:05
  • The easiest way is probably to add the command to /etc/rc.local. Also see en.kioskea.net/faq/… Aug 9, 2012 at 18:21
  • Finally had a chance to give this a try. Works great. Thanks! Sep 11, 2012 at 3:10
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

4
  • 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. Aug 15, 2012 at 4:30
  • 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
    Sep 2, 2012 at 14:53
  • 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. Sep 4, 2012 at 17:41
  • 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
    Sep 4, 2012 at 20:31
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.

You must log in to answer this question.

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