Imported pool mounting in wrong location after upgrade (/mnt/mnt/spinpool)

When I installed 25.04.2.3 (my first ever install) I noticed that the pool I imported was mounted as /mnt/mnt/spinpool. I followed another post in these forums to fix that and it worked nicely across reboots. (properly mounting at /mnt/spinpool)

But after the upgrade to 25.04.2.4 the pool was again mounted at /mnt/mnt/spinpool instead of /mnt/spinpool.
I had to manually fix that again.

Is that expected? A bug? Some lingering config somewhere?
An how can I fix that?

P.S.: The post I followed to fix it initially was this one: Mountpoint /mnt/mnt/pool after import

1 Like

Thanks for starting the thread.

Can you describe your pool and datasets.

Are you sharing the pool directly… or a dataset?

The pool was created on FreeBSD 14.2 and then exported/imported into TrueNAS.


Only a couple of the datasets are used by Samba (a home-share for various users, and a media share)

That was unfortunately bad advice.
The right way to manually import would have been to use the -R /mnt flag.

I am not sure what the best path out of the improper mount hole you’ve ended up in is.

well… since I’ve done the export/import dance twice now…
maybe I should do it a third time, but this time with the -R /mnt flag?

Hmm… spinpool comes from a FreeBSD manual setup, so I really don’t care about its name and I just have 2 samba shares at the moment that I can easily set up again. No apps yet or any other special things (I’m new to TrueNAS).

Assumption: On the FreeBSD system the mountpoint for spinpool was originally… /mnt/spinpool so that might have caused TrueNAS UI to get confused at import (which was done from the UI).

After reading up a bit, here’s my current thinking for a recovery strategy:

  1. export spinpool from the TrueNAS UI
    This should cleanly disconnect it.

  2. Then from the command line, as root:
    mkdir /someplace
    zpool import -R /someplace spinpool newpool
    zfs set mountpoint=/someplace newpool
    zfs destroy -r newpool/ix-apps
    zfs destroy -r newpool/.ix-virt
    zpool export newpool

  3. after checking newpool is no longer mounted, for good measure: rm -rf /someplace

  4. I should now have a clean newpool with all data intact
    (assumption/hope :wink: )

  5. Now import newpool from the UI which should take care of a clean import

How does that sound?

It makes sense at the zfs level.

At the TrueNAS level it is uncharted and untested territory…

The TrueNAS configuration database will not accurately reflect the status of the zpool. Its hard to predict the behavior.

So it might be better to do a fresh install of TrueNAS and then import the pool…

1 Like

Wish me luck, I’m going in… :sweat_smile:

1 Like

Rrrright…

I came back from uncharted territory… and it became just a bit more tested than before :wink:

Actually that went surprisingly well. The procedure above worked, after some minor modifications:

First I exported from the UI.

Then from the command-line as root:

mkdir /someplace didn’t work as the / file-system is read-only. So I created my folder below /tmp:
mkdir /tmp/someplace

and then:
zpool import -R /tmp/someplace spinpool newpool

zfs set mountpoint=/tmp/someplace newpool
also had a strange effect… the pool actually got mounted to /tmp/someplace/tmp/someplace :thinking:

So I decided to modify that to:
zfs set mountpoint=/newpool newpool

which mounted it where I expected/hoped: /tmp/someplace/newpool

So then, clean up the left-overs from before:
zfs destroy -r newpool/ix-apps
zfs destroy -r newpool/.ix-virt

Export the pool:
zpool export newpool

And then back to the UI to import it… grrrrreat success!

newpool is now properly mounted at /mnt/newpool
A couple of clicks later my home & media shares are back.

I rebooted to see if what I did sticked… and apparently it does :slight_smile:

So my preliminary conclusion for importing a pool from another system:
Apparently the TrueNAS UI does a zpool import -R /mnt behind the scenes, which mounts imported pools below /mnt. So the mountpoint on the imported pool gets prefixed with /mnt by TN.

To prepare for importing your myPool from another system, first import from command-line to a temporary location, set the mountpoint for the pool to /myPool, export it again and only then import it from the UI.

Disclaimer: IANATNE (I am not a TrueNAS expert) :wink:

3 Likes

Further digging (I actually went looking at the TN code).

When you import a pool from the UI, the TN middleware will pass some options to libzfs. During import libzfs sets these options on your pool.

One of these options is altroot with the value /mnt:

That means that whatever your mountpoint of the pool is, it gets prefixed by the altroot.

See:
https://openzfs.github.io/openzfs-docs/man/master/7/zpoolprops.7.html#altroot

…and that concludes this excursion :wink:

1 Like