Automount ZFS zpool in Ubuntu 12.04
Solution 1
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.
Solution 2
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
Solution 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.
Related videos on Youtube
Comments
-
dougoftheabaci almost 2 years
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.
-
Lars Kotthoff almost 12 yearsHave you tried running
zfs mount -a
on startup? -
dougoftheabaci almost 12 yearsI 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.
-
Lars Kotthoff almost 12 yearsThe easiest way is probably to add the command to
/etc/rc.local
. Also see en.kioskea.net/faq/… -
dougoftheabaci almost 12 yearsReading 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.
-
Henric almost 12 yearsAny 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.
-
dougoftheabaci almost 12 yearsIt 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.
-
Henric almost 12 yearsThere 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.
-
dougoftheabaci almost 12 yearsFinally had a chance to give this a try. Works great. Thanks!