Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (â‹®) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Why do I need "zfs import -f ..." (and how do I do it with the GUI)?

Featured Replies

  • Community Expert

The title contains it all 🙂

I wonder why I always need "-f" to mount a "foreign" zfs pool and I cannot find a way to do it from the GUI.

I'm just playing around with an external USB disk I can use to transfer files among all kinds of *IX Systems. FreeBSD, Raspbian (Ubuntu) and UNRAID.

All of them can use this disk, but all need that evil "-f" flag each time the disk has been used elsewhere.

Thats not really user friendly and I am looking for away to either avoid it or to make it automatic.

 

Any ideas?

 

Solved by JorgeB

  • Community Expert
  • Solution
2 hours ago, MAM59 said:

I wonder why I always need "-f" to mount a "foreign" zfs pool

That happens if the previous OS the pool was imported with, doesn't do a zpool export on shutdown/unmount, e.g., TrueNAS.

 

2 hours ago, MAM59 said:

I cannot find a way to do it from the GUI.

7.x always uses -f to import any pool, unless you are using it unassigned.

  • Author
  • Community Expert
1 hour ago, JorgeB said:

7.x always uses -f to import any pool, unless you are using it unassigned.

Sure I'm using it unassigned, its meant to be mobile, so a fixed pool does not make sense for me.

One should consider "unassigned devices" to use "-f" too. For now it just shows "MOUNT FAILED (look into the syslog for details)".

The details then tell you about the missing "-f".

I'm sure that the simple user will have problems overcoming this confusing situation.

1 hour ago, JorgeB said:

doesn't do a zpool export on shutdown/unmount,

Really "export"? a simple "unmount" is not sufficient?

The zfs versions I am aware of do not know how to "export"... is this specific to unraid? (it does not show it either in the zfs command list...)

 

 

 

  • Community Expert
1 hour ago, MAM59 said:

a simple "unmount" is not sufficient?

Nope.

 

1 hour ago, MAM59 said:

The zfs versions I am aware of do not know how to "export"... is this specific to unraid?

No, just type

 

zpool export <pool name>

 

  • Author
  • Community Expert
39 minutes ago, JorgeB said:

No, just type

tnx, did not know that... but that should do it I think... or is there a way to flag a pool "always portable" (so the disk can be moved around freely) ?

 

  • Community Expert
15 minutes ago, MAM59 said:

or is there a way to flag a pool "always portable" (so the disk can be moved around freely) ?

Not that I'm aware of.

  • Author
  • Community Expert

@JorgeB: just FYI:

 

root@Pihole1:/home/mam# zpool import mobil
cannot import 'mobil': pool was previously in use from another system.
Last accessed by Windows (hostid=acee055) at Wed Apr 30 07:36:43 2025
The pool can be imported, use 'zpool import -f' to import the pool.
root@Pihole1:/home/mam# zpool import -f mobil

"zpool export..." does NOT work! It claims to export and it unmounts the drive, but still the -f Flag is needed for the next mount elsewhere.

I guess it is not really a "dirty flag" somewhere, it just compares the "last used entry (hostid)" with the current system and if it is different, it demands the use of -f

 

(above example was taken after a clean "zpool export..." on the last computer (in this case a windows box) )

 

Anyway its good to know that the filesystem can be mounted and used almost everywhere in the Linux / BSD / Raspberry (*) and Windows (*) enviroments. A sure benefit.

 

(*) = additional software needs to be installed before it can be used

  • Community Expert
33 minutes ago, MAM59 said:

I guess it is not really a "dirty flag" somewhere, it just compares the "last used entry (hostid)" with the current system and if it is different, it demands the use of -f

That should not happen after a successful zpool export.

  • Author
  • Community Expert
3 minutes ago, JorgeB said:

That should not happen after a successful zpool export.

Obviously (and reproducablely) it happens. 

What is a "successful export" ? after the export the pool is unmounted and exit code is 0, what else should be checked for success?

 

But maybe there is a version difference between all the OSs I have tried. I just look for an "universal file system" and if "-f" is needed all the time, I can live with it (although unassigned devices should offer it too, its a bit clumsy to always need to open up a shell for a successful import).

At least all OS were able to import/mount, read/write data and finally export/unmount. Thats fine.

 

This for now was a simple single disk... Next I will try RAIDZ arrays and check their compatibility... (should work too)

 

 

  • Author
  • Community Expert
Preparing for ZFS Storage Pool Migration

Storage pools should be explicitly exported to indicate that they are ready to be migrated. This operation flushes any unwritten data to disk, writes data to the disk indicating that the export was done, and removes all information about the pool from the system.

This does not mean that the other system will take the pool uncommented, or needed to be pushed by -f.

It just ensures that the data is synced to disk and the info about the pool is flushed from the old system.

 

But again, its not important, just need to be remembered.

 

If the pool was not cleanly exported, ZFS requires the -f flag to prevent users from accidentally importing a pool that is still in use on another system. For example:

But I agree, it SHOULD work, maybe a bug somewhere...

 

Still, nothing lethal 🙂

  • Community Expert
1 hour ago, MAM59 said:

This does not mean that the other system will take the pool uncommented, or needed to be pushed by -f.

It should, like mentioned, if you have a TrueNAS pool and just shutdown TrueNAS, boot Unraid with the same disks on another server and try to import the pool, you will need to use -f, if before shutting down TrueNAS, you do a zpool export, -f will no longer be needed.

  • Author
  • Community Expert

I don't have any TrueNAS to test here, just "real" FreeBSD.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.