I have a machine that is set up in such a way that /home is a symlink to a directory on an NFS volume (something like /nfsvol/some/other/path/home). I need to move this back on to the machine's own filesystem, but I'm not sure what's the safest way to do this:

  1. Simply copy the contents of /home to /new_home then remove /home and rename /new_home to /home
  2. Use usermod -d -m /new_home/$USERNAME $USERNAME and then rename /new_home to /home - but if I rename /new_home to /home after running usermod -d -m, will that cause any problems? Would any part of the system still think that home directories are in /new_home
  3. Is there a better way?

Also, if I use usermod, do I need to consider locking the user's account until the move operation is complete? Some users have very large home directories (>100GB) so it may take several minutes.

  • 3
    You can decrease the move operation time by doing a pre-copy with rsync and then come migration time do a final rsync (which should be faster as it should only need to move the delta from the pre-copy run).
    – thrig
    Commented Sep 9, 2016 at 19:20
  • If some users have home dirs greater than 100GB, and you're moving them local are you going to have enough space? Sounds like the sort of scenario that you WANT nfs home dirs.
    – Centimane
    Commented Sep 9, 2016 at 19:22
  • I'm not sure locking the account would do anything about sessions already in progress. (IMO, you might as well announce downtime and go into the equivalent of single-user mode for this.) Commented Sep 9, 2016 at 19:22
  • 1
    @Centimane: Yes, I have already checked and there is enough space to copy everyone :) . It's only a few users - most have home directories < 100 MB :) Commented Sep 9, 2016 at 19:25
  • 1
    ldapsearch -x should tell you if there are ldap accounts. In a secure ldap setup root can't make any changes to the users (you have to use ldapmodify instead)
    – Centimane
    Commented Sep 9, 2016 at 19:29

1 Answer 1


If you use rsync, you can safely copy data while users are using the system. Then you can in a short period of time, make a final update and finish the change.

mkdir /home1
chmod 755 /home1
rsync -avz /nfsvol/some/other/path/home/ /home1

Then schedule an outage with users. Make sure everyone is logged off and prevent any logins if necessary. Then do a final sync and change.

rsync -avz /nfsvol/some/other/path/home/ /home1
rm /home
mv /home1 /home

As has been mentioned, make sure you have enough local disk space to host all of the data currently on your nfs volume. Make sure there is also enough space for growth of /home without affecting the rest of the local disk.

If may be preferrable to have /home be a separate partition from / to minimize your risk.

  • You should explain your commands in your answer. This also doesn't really address the question itself, which seems to be: "how do I safely change the user's home directory?" rather than: "how do I copy data from one place to another?"
    – Centimane
    Commented Sep 9, 2016 at 19:23
  • @Christopher ACH! you're right
    – Centimane
    Commented Sep 9, 2016 at 19:27
  • Very good point with a new partition instead of /. If / fills up most often things start to crash quite gloriously, whereas if additional disk partitions fill you often just can't write to them.
    – Centimane
    Commented Sep 9, 2016 at 19:31
  • Also I think if a user were to login before the sync was finished all that would happen is /etc/skel would get copied into their home dir, which would later be overwritten by the sync. This would mean that their files would be missing during that time, and their .bash_profile, .bashrc and other similar scripts would be different for that session, but the system would still be usable to them.
    – Centimane
    Commented Sep 9, 2016 at 19:34
  • I 'd recommend not doing the rsync over NFS. Do a direct rsync between the NFS server and client, preferably over a dedicated line (as in: not the same that's used to establish the NFS connection)
    – GnP
    Commented Sep 10, 2016 at 1:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .