auto mount ntfs partitions on login (fstab edit I presume)

Hello,

I have a few shared ntfs partitions that I always want to mount when I log into opensuse and I am looking for advice on the best method to get that working. I found a few threads on this but all of them asked for specific information to taylor a solution.

This is the output from cat /etc/fstab,


/dev/disk/by-id/ata-Samsung_SSD_840_PRO_Series_S1ANNEAD631613W-part2 swap                 swap       defaults              0 0
/dev/disk/by-id/ata-Samsung_SSD_840_PRO_Series_S1ANNEAD631613W-part3 /                    ext4       acl,user_xattr        1 1
/dev/disk/by-id/ata-Samsung_SSD_840_PRO_Series_S1ANNEAD631613W-part4 /home                ext4       defaults              1 2
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

This is the output of df -aTh,


Filesystem     Type        Size  Used Avail Use% Mounted on
rootfs         rootfs       15G  6.1G  7.7G  45% /
devtmpfs       devtmpfs    7.7G  4.0K  7.7G   1% /dev
tmpfs          tmpfs       7.8G   80K  7.8G   1% /dev/shm
tmpfs          tmpfs       7.8G  5.8M  7.7G   1% /run
devpts         devpts         0     0     0    - /dev/pts
/dev/sda3      ext4         15G  6.1G  7.7G  45% /
proc           proc           0     0     0    - /proc
sysfs          sysfs          0     0     0    - /sys
securityfs     securityfs     0     0     0    - /sys/kernel/security
tmpfs          tmpfs       7.8G     0  7.8G   0% /sys/fs/cgroup
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/systemd
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/cpuset
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/cpu,cpuacct
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/memory
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/devices
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/freezer
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/net_cls
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/blkio
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/perf_event
cgroup         cgroup         0     0     0    - /sys/fs/cgroup/hugetlb
systemd-1      autofs         0     0     0    - /proc/sys/fs/binfmt_misc
mqueue         mqueue         0     0     0    - /dev/mqueue
hugetlbfs      hugetlbfs      0     0     0    - /dev/hugepages
tmpfs          tmpfs       7.8G  5.8M  7.7G   1% /var/lock
debugfs        debugfs        0     0     0    - /sys/kernel/debug
tmpfs          tmpfs       7.8G  5.8M  7.7G   1% /var/run
/dev/sda4      ext4        9.7G  4.9G  4.4G  53% /home                                           
fusectl        fusectl        0     0     0    - /sys/fs/fuse/connections
/dev/sdc3      fuseblk     196G  151G   46G  77% /run/media/user1/shared_volume
/dev/sdc3      fuseblk     196G  151G   46G  77% /var/run/media/user1/shared_volume
/dev/sdc1      fuseblk      49G  8.1G   41G  17% /run/media/user1/applications
/dev/sdc1      fuseblk      49G  8.1G   41G  17% /var/run/media/user1/applications

This is the output of ls -l /dev/disk/by-uuid,


total 0
lrwxrwxrwx 1 root root 10 Mar 30 14:45 01CE98257CAD7F00 -> ../../sdd2
lrwxrwxrwx 1 root root 10 Mar 30 14:45 01CE9881DE56B2B0 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Mar 30 14:45 01CE9881EC6DE030 -> ../../sdc3
lrwxrwxrwx 1 root root 10 Mar 30 14:45 01CE9A7F4C3D4150 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Mar 30 14:45 01CE9B8721B085B0 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Mar 30 14:45 01CF9645B46C25D0 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Mar 30 14:45 1cda508e-b349-4ae8-aca8-df7898747c0d -> ../../sda4
lrwxrwxrwx 1 root root 10 Mar 30 14:45 2A7F-DB22 -> ../../sdi1
lrwxrwxrwx 1 root root 10 Mar 30 14:45 736afcc6-c69c-4fe4-99e2-bcb3d175a41b -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 30 14:45 9A6415BD64159CD7 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 30 14:45 f616941d-3d40-4a3a-a959-e16e28ff1216 -> ../../sda3

The entries in red and those that I need to auto mount. I manually mounted these before running df. Please let me know if there is any other information that is necessary, the above is all I could think of.

This is opensuse 12.3

Thanks for the help,

LMHmedchem

You talk about mounting when you log in.

Aren’t these file systems always available to the system (that is not connected and deconnected during the system running)? Then why do you not want them to be mounted at boot?

This is a multi-boot box and these partitions are shared with other OSs. One of them contains my email and web apps and the other contains data that I always will need when I am in opensuse. At this point, I have to boot into suse and then manualy mount these partitions by doing something like clicking on the partition in dolphin and then entering the root password. This is not the end of the world to have to do, but since I will need to do this every time I boot into suse, I think it makes sense to automate the process. I also have a virtual machines partition that I will need to mount at some point a well.

Let me know if you dissagree.

LMHmedchem

When you want partitions to be mounted at boot, use YaST > System > Partition manager. It will create the mount point you define for you and the fstab entry. The most important thing there is NOT to format! The rest must be quite clear. Ask if you hesitate.

There is no application called exactly, “partition manager”. There is an application called, “expert partitioner”. If I “edit” one of the partitions I need to auto mount, there are options for mount point.

The options for mount point are,

/srv
/tmp
/usr/local

I would have expected to mount these in

/var/run/media/user1/

where partitions appear when I mount them through dolphin, or perhaps somewhere under /dev. It looks like I can type in a path for the mount location. Does it make any difference where I mount the partition? Should I use one of the locations in the list or try typing in my own location?

I may be over thinking this but I think that partition management is on of those tasks where it is better to ask more questions up front and fewer later on trying to fix the mess you made when you didn’t know what you were doing.

It seems like it would be straightforward to manually enter,

/var/run/media/user1/

as the mount point. That would mount the partition where they are being mounted now thorught dolphin. Does that seem like a reasonable approach?

LMHmedchem

You can choose the mountpoint within reason. However, note that /var/run/media/$USER/ (symlinked to /run/…) is for DE auto-mounting of removable media via udisks2, and best avoided.

Just in case you’re not already aware of this , mountpoints should always be empty directories, otherwise any mounting done there will prevent access to the original filesystem already living there.

As explained above, those are (often used) suggestions. You can type there at will.

And as explained also, do not use mount points inside /var, /run or /media. A directory special “designed” to take mount points is /mnt. So something like /mnt/music is perfect. But when this is to be used by only one user, you can also mount inside that users home directory e.g. /home/<username>/music.

An alternate way of handling thisis mount at /mnt/music and then make a symlinkl

ln -s /mnt/music /home/<username>/music

It all depends on the usage (and of course music is just an example).

I created a new directory insde of /mnt for one of the partitions I need to auto-mount, /mnt/shared_data. I did this by changing to root (su), navigating to /mnt and doing mkdir. Is there anything I should know about as far as ownership or permissions for /mnt/shared_data?

LMHmedchem

The main reason I ask about permissions is that thought my partitions appear to be mounted (the content appears in dolphin), the applications that are reading profiles from that location can’t seem to open the profiles. Before, when I mounted the partitions by clicking on the partition in dolphin and entering the root password, I could then use the applications that were reading their profiles from the partition. Now, the application is acting like the profile is busy.

I suspect the issue is that I created the folder /mnt/applications as su and my <username> doesn’t have the right permissions for the /mnt folder. Do I need to add my user to a group for /mnt/applications or something like that or is the problem something else?

LMHmedchem

As I explained earlier, when you use YaST, it will create the mountpoint for you and of course with the correct owner and permissions.
Only thing might be that we have to adapt a few options (and maybe ownership of the mountpoint) later because I guess it is a non–Linux file system.

But use YaST first to have a good starting point.

We are now crisscrossing our posts.

But yes, because NTFS dos not support ownership by UID/GID and no permissions, they are faked. The info for the faking comes from the options in the mount statement (in our case the fstab).

So please post what YaST made:

ls -ld /mnt/shared_data
grep shared_data /etc/fstab

Here is the output,

user1@linux-l2ng:~> ls -ld /mnt/shared_volume/
drwxr-xr-x 1 root users 8192 Mar 30 19:56 /mnt/shared_volume/

user1@linux-l2ng:~> grep shared_volume /etc/fstab
/dev/disk/by-id/ata-ST2000DM001-1CH164_W241J8L7-part3 /mnt/shared_volume   ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

In Yast partition manager, there are some “fstab options” under the mounting options section. I don’t see anything there like assigning the user who owns the mount point. There is a variable value for “Arbitrary Option Value” that has the same value as the output from grep shared_volume /etc/fstab listed above. I guess that value can be edited from the partition manager.

LMHmedchem

OK, I guess the only thing we have to change is the following.

In the fstab entry you see the option gid=users. Add there (before or after does not matter)

,uid=user1

(asuming that user1 is the user that should own the files) (the , should be in the correct place to function as separator of course)
Then umount and mount (or reboot) and check if it helps.
Report back if you have still problems.

It looks like I have it sorted now. Adding the user id didn’t fix the issue, so I looked at some other things and realized that my application was looking for the profile folder in the path from the old mount point in /var/run/media/ where the partition was mounted from dolphin. I changed the path in the application and now everything works. I can access all of the files in the partition with apps like kate, so I don’t think there are any permission issues. I don’t know if the uid fstab entry is necessary or not, but I guess it doesn’t do any harm.

Thanks again for the help, it is always nice to read posts from someone who takes the time to explain the rational behind the technique.

Is there a way to mark the thread as solved?

LMHmedchem

Congratulations.

You saying that it is solved in a post, at the same time explaining how (as you did) is sufficient. It might help others.

Enjoy openSUSE.