2

My thoughts are, after creating the directory structure for the user on /dev/sdb I should mount that directory to the user directory for that user from within fstab. But this likely isn't the best method and I have no idea how I would handle the permissions. Can I please have some direction as to how to go about doing this?

4
  • fstab should allow mounting filesystem with owner and/or uid options perfectly fine. I've done that long ago. But your question could use a bit of clarification as to what exactly you're trying to do. Mount filesystem as user's home during boot ?or mount it whenever ? Jun 25, 2019 at 7:39
  • Hello Sergiy. Thank you for the reply. Sorry about my poor wording. I'll try to better clarify what I am attempting to do. I'm trying to create a specific user home on a seperate drive (/dev/sdb1/usr) under a specific directory. OR I'm trying to mount that specific directory on the drive (/dev/sdb1/usr) within the user directory on the main disk (/dev/sda2/home/usr). I am not sure which method would be better, or how to do method 1. Also not sure about what changes to permissions I will need to make in either case. Jun 25, 2019 at 8:29
  • I think this may help askubuntu.com/q/21321/295286 If that user does not yet exist, I think it would be even easier - simply set that filesystem to mount at boot in fstab and set home there when creating the user. Note also that it would be path to directory like /mnt/userhome. Typically /dev is for device files and not anything user related. The link I added above should help. Let me know if it does or not. I dont post as many answers lately but others should be able to help if there are other concerns Jun 25, 2019 at 8:39
  • You should edit your answer to include the clarification. There is no benefit in having to read the comments to fully understand the question. You may just work with a symbolic link in your /home folder to the user's home folder on the other disk. Setting the permissions correctly is independent from that. You need to make the user owner of his home folder on the other disk.
    – vanadium
    Jun 25, 2019 at 10:32

1 Answer 1

0

In principle, you can proceed as following. The details depend on where your other drive is mounted, the specific user name, etc. Anything you do at this level obviously requires administration privileges ("root rights" in linux speak).

1. Create the new account -The easiest way to create a new user and then have the home folder of the user on another disk, would be to first create the account using the GUI (Settings - Users). Then, a full default home will be created for the user in the /home folder, with proper permissions set and all default Ubuntu configuration in place. Let us assume the login of the new user is user. Then, a new folder /home/user will be created.

2. Move the newly created user home folder to the other drive - Then you want to move that folder user out to the other disk. A move will preserve all permissions and properties. To move with administrator privileges, precede the command with sudo.

3. Link to the moved folder in the /home directory - Then, you can create a symbolic link, also named user under the \home folder. That symbolic link redirects to the real user folder on the other disk. The terminal command is ln, so it will be something like sudo ln -s /<path_to_your_second_drive>/user /home/user. First argument is the target of the link, i.e. your user folder on the other drive, second argument is the name of the link, i.e. user under your /home.

Using symbolic links is by far the simplest approach. However, another approach would be a "mount bind". This requires an extra line in the configuration file /etc/fstab, where the folder user on the other drive is mount-bound to an (can be empty, otherwise you just loose the space) folder user under /home.

1
  • 1
    @PerlDuck Thank you, corrected
    – vanadium
    Jun 25, 2019 at 11:58

You must log in to answer this question.

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