Change mount options (permissions) on USB hard drive

I’m running Opensuse 11.2 and am using a couple of USB hard drives to store large data. One of these drives is formatted with FAT32 and one with NTFS.

When I plug-in a USB device KDE4 shows me a little pop-up asking what I want to do with it, I select to open it in Dolphin which of course automatically mounts it.

My question is what if I want to change some of the mount options - is this possible without reverting to manual mounting? And second question is what system does it use to automount - Fedora, Debian and Ubuntu are all deprecating HAL in favour of pure udev, is this the case in Opensuse too?

HALRemoval - Debian Wiki
https://wiki.ubuntu.com/Halsectomy
Features/HalRemoval - FedoraProject

All external hard drives that you leave connected can just be added to fstab, a text file located in the folder /etc. You can use the Partitioner program to place an entry into your fstab file for you that will allow your hard drive to be mounted for you automatically each time you start/restart your PC.

First, plug in your USB hard drive(s) before taking the next step and do not open them in Dolphin. To add a mount entry for you in fstab do this: start YaST and enter the root password. Next select System > Partitioner. Press the Yes button to the warning that you get.

On the top left your Linux computer name will be selected and on the right will be a list of all connected hard drive partitions. Find your external hard drive(s) on the left, they will indicate the file type as being FAT32 or NTFS. Right click on a partition you want to mount and pick Edit. A screen will be presented to you with Formatting Options and Mounting Options. By default, Do Not Format will be selected, do not change this option. On the Mounting options select the Mount Partition Bullet with your mouse. You must enter a location for it to be mounted. I suggest a folder out from root such as /Windows or /Windows/C or /Software or /USB/MyDrive1 and so forth. The folder name must start with a “/” and will be created for you if it does not exist. Next, for using FAT32 or NTFS partitions with full Read/Write support for all Linux users, but which does not honor Linux user login rights, select the fstab option button and enter the single option: Defaults. Erase all other entries if they exist. You can do this later if you want to try the Partition Defaults which attempt to enforce Linux user rights which often do not give you full user writing rights. You would NEVER do this for any standard Linux partition type like EXT2, EXT3 or EXT4. Press the Finish Button. Do the same for a second drive if connected. When completely done, press Finish one more time and your mounts will be made for you automatically each time you start Linux.

A couple of things to remember, once you place more than one external USB drive is fstab for automatically mounting, continue to plug them into the very same USB port, this keeps device names like sda and sdb in the same order and life will be more simple. If you should not have a drive turned on or plugged into your computer at boot time, plugging it in later will not hurt, but it will act just like they do right now with no change. But, if you restart your computer with in plugged in and turned on, it will be automatically mounted for you.

Thank You,

Or mount by partition ID instead of device path.

Thanks, so you guys are saying the only way to change the options is to add an fstab entry? I was hoping that there was some way in the automounting system to do it, it seems like it’s a bit of a black box.

Does anyone know the answer my 2nd question then, ie. what is the automounting system currently and is it being replaced by the new pure udev system like Fedora, Ubuntu and Debian are doing?

It is simple, when devices are connected allways use /etc/fstab. That is true if they are, what some people call, “internal” or “external”, ATI, SAT or USB. It is not the harware technique, but the usage.
And yes, in /etc/fstab use one of the /dev/disk-by/… possibilities instaed of /dev/sd… for consistent mounting.

Your last question. IMHO it is no longer HAL that is responsible for on the flight mounting of devices. It seems that DeviceKit (disks) is part of the replacement. But the whole process is to me ass vague as it was before.
Nevertheless the results are about the same. You can read more about it (and about mount by ID, Label, etc) in SDB:Basics of partitions, filesystems, mount points - openSUSE

Dynamically mounted devices are what I’m asking about as at least one of my USB disks will definitely not always be mounted (it’s for backups), not to mention the USB sticks, camera and smartphone I regularly use with my computer. It seems to me that creating fstab entries might work but would mean giving up using automatic mounting.

Your last question. IMHO it is no longer HAL that is responsible for on the flight mounting of devices. It seems that DeviceKit (disks) is part of the replacement. But the whole process is to me ass vague as it was before.
Nevertheless the results are about the same. You can read more about it (and about mount by ID, Label, etc) in SDB:Basics of partitions, filesystems, mount points - openSUSE

This article seems to suggest that HAL is not configurable, suggesting there probably isn’t a way to change mount options and still be able to use automatic mounting :frowning:

Yes, when dynamic, do not use /etc/fstab.

And again yes. The article (which btw was mainly written by me as the result of a long discussion here on the forums) point to the fact that we could not find a way to configure HAL. At least with respect to the mount point. But as we did not find any config file, I think that aso holds true for mount paramters. This may be academic now because HAL does not do the mounting anymore. But until now I was not able to get hold of the new process and how configurable that is.

In any case udev is more configurable. So you could try to do there what you want (you never mentioned which parameters you want to change, thus I can not comment on that). When you want to venture into udev rules: Writing udev rules. Some searching on this forums might also reveal practical solutions (I remember there were some), maybe in your area.

And as an aftherhought, reading your post again. You seem to have different usage of the dynamic devices (rather normal :slight_smile: ).

For the backup disk (I suppose with one or more partitions with ext3/4 filesytems or the like), I personaly could see a solution in having it in /etc/fstab with the noauto option (thus at boot there will be no complaints). When it is in /etc/fstab HAL will (would) not do anything with it and I suppose DeviceKit will do likewise. Then I would do the mount as part of the backup script, which you will run in any case because of the purpose of the disk.

For USB stick, etc. I would just let DeviceKit and the Desktop do what they want and handle it as “Media” because that is where they are designed for. Never felt the need to influence the mount parameters.

Yeah it was more out of interest as to how I’d change the permissions masks or faked user and group ‘ownership’ of files mounted from FAT and NTFS USB disks. I’ve managed to get it all working now.

I’ve read through that udev rules article before but it only covers udev’s normal functionality of creating and changing attributes on device nodes under /dev. I still haven’t seen any documentation around about the replacement of HAL by udev and the integration of DeviceKit into udev (DeviceKit-disks renamed to udisks), which would presumably bring the dynamic mounting of disks into the scope of udev rules.

Thanks for the article.

It must be possible to mount using udev rules because you can define in the rules to let a command/script execute. But I admit I did not try this.

The whole area is a bit vague, not in the least because there are several contradicting wishes to satisfy. The most important imho the whish doing things ‘automatic’ (because end-users expect this) where there are a lot of unknown parameters to fill in. An illustration of this is the case of many users loged in and an USB stack is then connected. Who will be the (faked because of non Linux fs) owner? But there are many more. In other words HAL was not aware of the multi user functionality of Linux and this may be seen as a severe and obvious brake of security.

Looks like removing HAL might be done for OpenSuse 11.3:

[openFATE 308980] Remove HAL support from libzypp and YaST](http://lists.opensuse.org/opensuse-features/2010-04/msg00157.html)

If you wanted to manage the mount options yourself, rather than as suggested alllow the automounting under /media to control this is may consider the automount server.

/etc/init.d/autofs

Check the files /etc/auto.master and /etc/auto.misc for ideas.

When a directory is accessed the is mounted to the path specified with the options you set.

https://www.youtube.com/watch?v=ZOQdW2wdVfw) is simple video outlining autofs