Re: How to relocate $HOME directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Jan 31, 2011 at 06:07:27AM +0900, Soo-Hyun Choi wrote:

> Hi there,
> 
> As you know, $HOME is generally located at "/home/$username" by default.
> 
> I would like to re-locate all users' $HOME directories to something like
> "/export/home/$username" without having a hassle/trouble.
> 
> Initially, I've thought of just copying them to the new directory (under
> /export/home/xxx), but guessed it might trouble for the normal use (I'm
> pretty new to CentOS, although many experiences with Debian/Ubuntu).
> 
> Is there any good tricks (or caveats) when moving users' home directory
> cleanly with CentOS? (I'm with CentOS 5.5 x86_64)

It depends on if /export is in the same file system as /home currently is.
If the file systems are different, then make the new '/export' space.  
Then use a tar-to-tar to copy the old home to the new place.   

First, create the new directory situation.

If the file systems are different

  mount /export     (or whatever you have to do to create the new one)
  cd /export
  tar -cpf - /home | tar xpf -

If it is the same file system, just do:

  mkdir /export    (or whatever it takes to create the new one)
  mv /home /export/.   

(NOTE: Some versions of mv(1) (FreeBSD for example) will actually do a cp(1)
 for you if they are not in the same file system so you can cheat a little)

Next you would have to modify each user's entry in the /etc/passwd
file  to be  /export/home/userid
rather than /home/userid

you can use vipw(8) to insert the export/ string in between the first '/'
and 'home'    eg search for home and then insert 'export/'
  
By the way, I'd suggest not using the name /export.  It gets used 
in too many places to mean specific things and it could get confusing
some time later.  Pick some other name.

////jerry


> 
> Cheers,
> Soo-Hyun
> 
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux