Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi everybody,
I've learnt the hard way never mark as solved until u've tested it.
Say my user name is bill and I'm trying to mount sdb1 to /home/bill/data and I have typed "mkdir /home/bill/data" while logged in as bill and then typed "sudo mount dev/sdb1 /home/bill/data" shouldn't bill be able to access the folder "data"?
I've tried to add /home/bill/data to fstab and it just boots in to emergency mode. The only thing I can't think of is because bill can't access data would that be correct? How do I make bill able to access this mount point?
Depends on the ownership specified within the filesystem.
Normally, users do not have mountpoints within their directory - it can cause issues:
First, most filesystems have "lost+found" directory owned by root, group root.
Second, the root directory is by default owned by root, group root.
This is so that filesystem repair can be done when systems crash. It IS possible to give the root directory to a user... But doing so tends to cause repair problems when/if the lost+found directory is removed/renamed. But to do so first requires the filesystem to be mounted, then the ownership changed.
The usual method of mounting users directories is to mount /home. Then create a directory in the mounted filesystem for the user that is owned by the user and has the users default group access.
Usually works - depends on the filesystem as to what you actually get. Not sure with Fat16/32/NTFS since there is no owner/access specifications.
what you were describing was a /home/user/data as mountpoint. Based on that you would get /home/user/data/.lost+found after mounting.
If you are referring to a /home mount what you get instead is a /home/.lost+found (with possible other directories - usually the users home directory).
I've tried to add /home/bill/data to fstab and it just boots in to emergency mode.
Someone might be able to suggest a solution if you posted the actual entry you have in the /etc/fstab file.
If you open a terminal and run: ls -ld /home/bill/data it will show the owner:group and permissions for that mount point.
Generally, additional disk partitions are mounted under /mnt or /media directories and then to give a user access use the chown command.
Say my user name is bill and I'm trying to mount sdb1 to /home/bill/data and I have typed "mkdir /home/bill/data" while logged in as bill and then typed "sudo mount dev/sdb1 /home/bill/data" shouldn't bill be able to access the folder "data"?
I've tried to add /home/bill/data to fstab and it just boots in to emergency mode. The only thing I can't think of is because bill can't access data would that be correct? How do I make bill able to access this mount point?
OK, let me describe how I am doing it, which is virtually identical to what you want to do.
I created the mount point with "mkdir /home/dan/sdb2_data" - yours is "/home/bill/data" - no problem.
You did mention that you were logged in as bill, so ownership of the mount point is no problem...
I list the UUID's of my partitions with "sudo blkid -o list"
Then I enter the mount lines in /etc/fstab:
Code:
# mount sdb2 on /home/dan/sdb2_data
UUID=a299e544-0371-4856-912b-70458aa37ee1 /home/dan/sdb2_data ext4 defaults,noatime 0 2
I make sure the partition is not mounted with "sudo umount /dev/sdb2"
Then run the fstab commands with "sudo mount -a"
Is your sdb1 ext format or NTFS?
Quote:
Originally Posted by jpollard
Normally, users do not have mountpoints within their directory - it can cause issues:
Please clarify. I have had my mount point in /home/dan for more than 10 years, and have not encountered issues.
OK, let me describe how I am doing it, which is virtually identical to what you want to do.
I created the mount point with "mkdir /home/dan/sdb2_data" - yours is "/home/bill/data" - no problem.
You did mention that you were logged in as bill, so ownership of the mount point is no problem...
I list the UUID's of my partitions with "sudo blkid -o list"
Then I enter the mount lines in /etc/fstab:
Code:
# mount sdb2 on /home/dan/sdb2_data
UUID=a299e544-0371-4856-912b-70458aa37ee1 /home/dan/sdb2_data ext4 defaults,noatime 0 2
I make sure the partition is not mounted with "sudo umount /dev/sdb2"
Then run the fstab commands with "sudo mount -a"
Is your sdb1 ext format or NTFS?
Please clarify. I have had my mount point in /home/dan for more than 10 years, and have not encountered issues.
I listed some of the problems that can happen. filesystem repair can fail when the lost+found directory gets monkeyed with. Some don't even like the root filesystem not owned by root...
Can it work? sure. Can the be additional problems? sure. They may rarely happen though - it depends on the knowlege of the admin and user.
Ownership of the mount point directory is irrelevant**. That inode gets overlaid by the root inode of the mounted filesystem. For filesystems like FAT and NTFS that do not support Unix permissions and ownership, that is a simulated inode built from mount options, but it still replaces the ownership and permissions of that mount point directory.
If you are mounting a Linux native filesystem and want your non-root UID to have permissions there, you need to go in (as root) while the filesystem is mounted and set those the way you want them. That change will be permanent in that filesystem.
** There could be some issues with the mount point's SELinux context allowing a mount there, but once the mount succeeds you are past that point.
filesystem repair can fail when the lost+found directory gets monkeyed with.
Actually, there is a lost+found directory on sdb2 and it is owned by root.
Why would that not be the case?
Maybe you are thinking of the case where someone creates a mount point and then does "sudo chown -R $USER:$USER /mountpoint" ?
THAT would change the ownership of lost+found, true. But that is not what is being done here.
Actually, there is a lost+found directory on sdb2 and it is owned by root.
Why would that not be the case?
Maybe you are thinking of the case where someone creates a mount point and then does "sudo chown -R $USER:$USER /mountpoint" ?
THAT would change the ownership of lost+found, true. But that is not what is being done here.
True - but it can also be renamed and moved around... and deleted if the root directory is owned by the user.
Ok maybe I should clarify what I'm trying to do.
At the Moment I have a partition entirely devoted to /home. It is running low on hard drive space so I want to mount sdb1 so I can use this for my data files. In another thread I was told to mount sdb1 and create the folder "data" on sdb1 and mount it to /home/bill/data . Is this the best way of doing this?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.