storaged-project / udisks

The UDisks project provides a daemon, tools and libraries to access and manipulate disks, storage devices and technologies.
https://storaged.org/doc/udisks2-api/latest/
Other
347 stars 142 forks source link

"windows_names" option for mount.ntfs #713

Closed atom-smasher closed 4 years ago

atom-smasher commented 4 years ago

Apologies, as I may be in the wrong place. I was trying to find a config file that specifies windows_names, but all I found was the compiled binary, /usr/lib/udisks2/udisksd. If I'm in the right place, then this may be a bug (apparent inability to exclude this mount option) or feature request (I'd like the ability to not have this mount option, eg by editing a config file).

If I plug in an NTFS drive via USB, it mostly works, but the character-set for creating files is limited, ie I can't create files that contain certain characters. If I manually un-mount and re-mount the drive, it works fine:

mount.ntfs-3g /dev/sdd1 /tmp/ntfs-mount

Digging into the problem, I found that letting the system automagically mount the drive adds the windows_names option to the mount.ntfs command. ps shows:

 3089 ?        Ss     2:44 /sbin/mount.ntfs /dev/sdd1 /media/xxxx/4t-drive -o rw,nodev,nosuid,windows_names,uid=1000,gid=1000,uhelp

From the mount.ntfs man page:

       windows_names
          This  option  prevents files, directories and extended at‐
          tributes to be created with a name not allowed by windows,
          because

                 - it contains some not allowed character,
                 - or the last character is a space or a dot,
                 - or the name is reserved.

          The forbidden characters are the nine characters " * / : <
          > ? \ | and those whose code is less than  0x20,  and  the
          reserved   names  are  CON,  PRN,  AUX,  NUL,  COM1..COM9,
          LPT1..LPT9, with no suffix or followed by a dot.

          Existing such files can still be read (and renamed).

• Why is that windows_names option being used?

• And more importantly, how can I get rid of it?

nb If it was possible to use ext4 instead of NTFS, I'd be doing that. NTFS with a POSIX namespace is the best available option, under the circumstances. I'm not looking for "answers" that just point out the inferiority of NTFS. I would like to know how to automagically have Ubuntu mount an NTFS drive without the windows_names option.

I'd like to think the windows_names option is specified in a config file, and can be edited, but as yet I've been unable to find such a file.

This is on Ubuntu 19.04

tbzatek commented 4 years ago

This was an intention, the _windowsnames mount option has been introduced in udisks-2.8.2. As long as one of the primary use cases for UDisks is plug&play style of mounting removable devices while keeping cross-OS interoperability in mind, this was a logical safe option to avoid issues when plugged back to other non-POSIX OS.

What you want is https://github.com/storaged-project/udisks/projects/1, currently not yet implemented.

atom-smasher commented 4 years ago

What you want is https://github.com/storaged-project/udisks/projects/1, currently not yet implemented.

So it's not currently possible to edit a config file, or make other simple changes, to tune the options that are used to auto-mount a disk?

The only way to do this is to manually unmount it, then manually mount it with (or without) the options I want (or don't want)?

tbzatek commented 4 years ago

So it's not currently possible to edit a config file, or make other simple changes, to tune the options that are used to auto-mount a disk?

Not at the moment. UDisks clients still have an option to specify extra mount options from a (limited) set of allowed mount options, no way to currently remove any from the daemon default ones however.