[zfs-discuss] Howto zpool import/export automatically?

Fajar A. Nugraha list at fajar.net
Wed Jun 29 12:11:34 EDT 2011

On Wed, Jun 29, 2011 at 11:02 PM, UbuntuNewbie
<chessdoter at googlemail.com> wrote:
> Hey, i am happy again! Since i gave up on the root pool (as suggested
> here), zfs seems to be doing fine.
> The only drawback for now is: i do have to manually import the pools
> each time after system start (unfortunately there are 2 pools for now)
> to have them ready for use
> And before shutting down, i issue the zpool export command - just in
> case.

Why? There's no need to

> When i tried to find the right place to have this done automatically,
> i ran across init.d/zfs, which tries to mount the zfs filesystems. But
> the pool isnt available at that time.

IIRC the init script should be sufficient for most needs:
- you need to import the pool once, manually
- let the init script start at boot, which will basically just run
"zfs mount -a" (when you run zfs/zpool command, it will automatically
load the kernel module)
- during shutdown time, the init script will try "zfs umount -a" (on
Ubuntu) or simply do a sync (on RHEL/Fedora). Regardless, it does NOT
export the pool.

The last part is important. If you don't export the pool, it will be
automatically available next time you load zfs module. But if you
MANUALLY export the pool, then you have to manually import it later

This is also the same in Solaris btw, you don't need to export the
pool before shutting down.


More information about the zfs-discuss mailing list