How to integrate /home from a separate partition into existing filesystem?
How to integrate /home from separate partitions or devices into existing filesystem?
Scenario: 1) Have one or more separate partitions for /home. And each partition contains one or more user directory. E.g. In sda10, /home with /user10-1, /user10-2, .... In sda11, /home with /user11-1, /user11-2, .... 2) We have a root filesytem, on a new installed or an existing OS. Obviously this OS already has a /home folder. Questions: a) If I mount sda10 and sda11 to root filesystem's /home directory, I would have conflicts. So I would just mount each subdrectories (/user10-1, /user10-2, .... ) from sda10 and sda11 to root filesystem's /home directory. Meaning create mount points of same names and mount those subdirectories from separate partitions under /home/<user_name>. Is there a better way to do this? b) Have done part a) above, the OS still does not know those newly mounted user directories in /home/<user_name> belongs to specific users. So next I would create account for these user sub directories with same user account names. When I create user accounts, I would expect OS to possibly delete those existing same name user subdirectories when the OS tried to create same directories for the new user account? Is this likely and how do I deal with this deletion scenario? How to configure OS to recognize such user subdirectories as belonging to corresponding user such that when user signs in, that subfolder would be automatically assigned to the appropriate user? Thank you. |
First set your partition mountpoint in /etc/fstab eg:
Code:
/dev/sda10 /home1 ext4 defaults 1 Code:
mkdir /home1 /home2 then when adding new users, you use the -b option for useradd Code:
useradd -b /home1 -g <group> -u <uid> user10-1 It's possible to use bind mount also Code:
mkdir -p /srv/hd1 Code:
/dev/sda10 /srv/hd1 ext4 defaults 1 |
@keefaz:
Thank you! |
I was going to suggest the bind mount option, but I'm happy to learn about the other method!
I will note one thing that does NOT work. If you try to use symbolic links (instead of bind mounts) in /home, then the symlink to a user's home directory at another location will NOT work. I don't know exactly why, I just know that when I tried it before it failed miserably...at least when trying to log in to a GUI. |
@IsaacKuo:
What is Yahoo mechdan? |
Quote:
|
In big environments you want every user as /home/user in the passwd.
If your physical storage path is different you need a mapping. Having bind mounts in fstab is one solution. The Sun Microsystems solution was automounter, using an auto.home (later auto_home) map. Code:
# cat /etc/auto.master The auto.home map (and even the auto.master) can be in NIS (or NIS+ or LDAP), as a means to centralize the administration of auto.home. Otherwise another configuration management must provide the identical /etc/auto.home files. If only used locally, the NFS is some overhead: the server1 is the local host. In Solaris the automounter detects that and automatically uses an efficient bind mount (in Solaris implemented as another mount type: lofs). I tell you this because it is THE traditional enterprise standard. Linux has re-engineered (and other commercial Unix have licenced) NFS, autofs/automounter, NIS. And all have implemented openldap. |
All times are GMT -5. The time now is 09:02 AM. |