Is there any easy way to mount a ZFS Volume in External device

In a nutshell :
I am testing ZFS filesystem in External USB volume ...

But after each reboot I get ZFS pool cache error if the volume is not present ;
Sometimes I connect the ZFS volume in a different USB port or even controller ...

I have no problem in adding the volumes in the terminal but after several edits it starts to fill the ZFS cache service files with too many and different values.
So each time I have to cleanup the previous configuration and add a complete new one ...

Is there any way to solve this kind of detail ?

You can always set the mountpoint to "legacy". With that setting you would mount zfs volumes as you would the volumes for any other filesystem.

Just make sure you use the appropriate systemd requires directives to make sure things don't get mounted in the wrong order.

That makes no sense to me. I do not understand what you are doing.

What you should do is:

  1. zpool create .... create the pool for the usb drive
  2. zfs create .... = create the datasets you want to have on the usb drive
  3. zpool import .... = import the pool incl. mounting the datasets
  4. zpool export .... = export the pool before you unplug the usb drive

Some words about zpool import/export:

If you import a pool, zfs writes information about the pool and the datasets to the cache file: /etc/zfs/zpool.cache

Next time when you boot the PC and the zfs services are started, zfs reads the cache file and tries to import the pools and mount the datasets named in the cache file. If your usb drive is disconnected at that time zfs will not be able to do the automatic import and it gives you a warning. But that is not a big deal.

When you work with removable drives you should export the pool before removing the device. The export removes the info from the cache file.

Ah ... Thanks for the last piece of info ...

I never exported the pool before I removed the external device....

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by