Migrate a NFS share to a new dataset

gronax

Cadet
Joined
Apr 22, 2020
Messages
6
Hi All,

I need to move several datasets to a new pool on the same server that are currently being accessed via NFS shares.

I was planning to setup a replication task to the new pool/dataset and then perform a cold cutover once the data has copied.

My question: Can I remap the NFS shares on TrueNAS to the new pool/dataset for cutover? I have previously achieved a similar thing with SMB shares as I could edit the directory that the SMB share points to. I'm assuming that this can't be done for NFS shares which implies that I need to change the NFS mounts on every NFS client as opposed to doing it once on the TrueNAS machine :(

EDIT: The only way I can think to do this is to symlink the new pool/dataset to the old pool/dataset assuming that you can rename the old pool/dataset. Doesn't feel like a good option.

Cheers,
Simon.
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
As you correctly identified, SMB sharing works differently to NFS sharing in that the "share Name" matters to SMB, but not to NFS.

If you have so many clients which would need to be changed that it feels beyond your capacity to do so manually, you should probably acquire/create a solution which automates the editing of fstab on all your clients. (a script using something like sed to alter the existing line in the fstab file on each client would probably be enough).
 

Kailee71

Contributor
Joined
Jul 8, 2018
Messages
110
Why not rename the old dataset and give the new dataset the name of the old one once migration is complete? Even on pool level this is possible, just requires an export/import...
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Why not rename the old dataset and give the new dataset the name of the old one once migration is complete? Even on pool level this is possible, just requires an export/import...
If we drop the assumption that the old pool will stay, that could work... but I expect the answer is it will stay in parallel to the new one, so the path can't be the same.

If we're in that territory, you could also consider instead moving off the other contents of the pool to the new one and leaving the NFS-shared files on the old pool... maybe that's an option.

I would still stick with my original suggestion of getting proper control of your clients so you can do whatever you want now and later.
 

gronax

Cadet
Joined
Apr 22, 2020
Messages
6
Thanks for confirming what I thought was the case. Looks like some Ansible is required here. Not that it's a TrueNAS feature, but I'm surprised that NFS doesn't support the concept of decoupling paths from share names to give storage maintenance more flexibility and better control (i.e. simpler and less risky to change one server vs changing the server and all the clients at one time, also rollback is more complex).
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
NFS at the protocol level does not support this directly. It is an ancient protocol, dating from 1984, and there was a need for relative simplicity back in the days when a UNIX host might only have 1MB (one megabyte) of RAM.

If you want NFS to support decoupled paths, there is of course the very UNIXy solution of the automounter, amd, which is easily able to decouple paths in ways that still make other filesharing systems jealous.
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
One of the ZFS dataset properties is "mountpoint". You should (in theory!) be able to create a dataset, and set it's mountpoint outside the pool tree and then swap it out without touching the clients in the future.

So you could have:
/tank/pool/dataset

mount at:
/mycoolnfsshare

Then swap out to:
/tank/pool2/newdataset

and still have it mount to:
/mycoolnfsshare

At least that's how Solaris 10 did it back in the day. Not sure how TrueNAS will handle this. I've been meaning to try it.
 
Top