0

We have to migrate a Linux NFS server. We want to use the same production IP addresses. There is a bin/ shared folder and so many servers in production using it...

All the data is already replicated. All the /etc/exports already configured.

/var/lib/nfs could be copied if necessary.

I just have to stop the nfs service, erase the IP from old server, put same IP in the new server, start nfs service.

Is there a way to do this without the clients noticing it?

uDalillu
  • 105
  • 3

3 Answers3

2

In addition to the answer below you probably want to make sure that the fsid is identical on the new server so that your clients will think they're connecting to the same share, rather than a new one which will cause some headache.

user2108948
  • 111
  • 7
1

That is a pretty complicated thing to try, which is best tested in advance with other systems.

I know from experience that the timeo NFS mount option might need to be set lower and hard should be set.

timeo=50 - retry NFS requests after 5 seconds (specified in 10ths of a second)

hard - cause processes accessing the NFS share to block for ever when it becomes unavailable unless killed with SIGKILL

That way the clients will lock up, and wait until the new system is up. They will retry often because of timeo.

Ryan Babchishin
  • 6,260
  • 2
  • 17
  • 37
1

That plan will probably work. Make sure you have a way into both machines that isn't an interface like em0:1 (so no aliased interfaces). IPMI or a drac is even better. As soon as the new ip comes up run arping on the new machine to update the router and switches.

If you want to absolutely ensure this goes smoothly you should have a plan to remount the NFS mount on all the clients. Automating this sort of thing is generally really easy. Try using sshpass and ssh-agent. I'm not saying you're definitely going to have to do that, but its a very real possibility. I would also not use hard errors on an NFS mount, they make software lock up.

There's an alternate way of doing things. If you've figured out how to run a mount -o remount on all the clients, then you might as well consider changing the ip on all the clients. Its worth figuring out if it'll be smoother that way. The steps would be to stop any software using the directory with the NFS mount, change the ip in /etc/fstab, run mount -o remount /path/from/fstab, and if it mounts correctly restart the software. It'll take way longer that way, but your chances of failing to notice that one system is handling the change badly are way lower.

Some Linux Nerd
  • 3,327
  • 3
  • 19
  • 22