Как записывать на NTFS файлы с "запрещёнными а Windows" именами?

Любые разговоры которые хоть как-то связаны с тематикой форума

Модератор: Модераторы разделов

Ответить
MiK13
Сообщения: 1164
ОС: Linux Debian

Как записывать на NTFS файлы с "запрещёнными а Windows" именами?

Сообщение MiK13 »

Раньше, в том числе и в Debian 10 я мог записывать на раздел NTFS файлы с любыми именами. В том числе и с такими, в имени которых есть кавычки (") и двоеточие (:). Windows, правда, такие файлы открыть не мог, но телевизор фильмы с подобными именами показывал без проблем.
И вот в Bullseye (Debian 11) оказалось, что я не могу записать такой файл на раздел NTFS на внешнем USB диске.
man ntfs-3g показал, что

Код: Выделить всё

Windows Filename Compatibility
    NTFS supports several filename namespaces: DOS, Win32 and POSIX.  While
    the  ntfs-3g driver handles all of them, it always creates new files in
    the POSIX namespace for maximum portability and  interoperability  rea‐
    sons.   This means that filenames are case sensitive and all characters
    are allowed except '/' and '\0'. This is perfectly  legal  on  Windows,
    though  some application may get confused. The option windows_names may
    be used to apply Windows restrictions to new file names.
И

Код: Выделить всё

windows_names
       This option prevents files, directories and extended  attributes
       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).
Правда, когда я размонтировал этот раздел и смонтировал его руками mount /dev/sdc2 NTFS, то возможность записывать на него файлы с любыми именами появилась.
Но хотелось бы, чтобы это возможность была после автоматического монтирования раздела NTFS.
Можно ли это сделать?
P.S. Решил поискать windows_names в разных файлах. Нашёл в
/etc/udisks2/mount_options.conf.example -- но там во всех строках в начале стоит #
/usr/share/bash-completion/completions/_mount.linux -- но непохоже, чтобы от него что-то зависило
и ещё в трёх исполняемых ELF-файлах:
/usr/bin/lowntfs-3g
/usr/bin/ntfs-3g
/usr/libexec/udisks2/udisksd
Похоже, что опция windows_names жёстко задана в последней программе.
Спасибо сказали:
astroncia
Сообщения: 133

Re: Как записывать на NTFS файлы с "запрещёнными а Windows" именами?

Сообщение astroncia »

MiK13 писал:
04.09.2021 03:07
/etc/udisks2/mount_options.conf.example
Это пример файла, название на это намекает...
/etc/udisks2/mount_options.conf.example

Код: Выделить всё

# This file contains custom mount options for udisks 2.x
# Typically placed at /etc/udisks2/mount_options.conf
# Refer to http://storaged.org/doc/udisks2-api/latest/mount_options.html
Может попробовать так?

Shell

/bin/echo -e '[defaults]\nntfs_defaults=uid=$UID,gid=$GID' | \
sudo tee /etc/udisks2/mount_options.conf
Спасибо сказали:
MiK13
Сообщения: 1164
ОС: Linux Debian

Re: Как записывать на NTFS файлы с "запрещёнными а Windows" именами?

Сообщение MiK13 »

astroncia писал:
04.09.2021 08:09
MiK13 писал:
04.09.2021 03:07
/etc/udisks2/mount_options.conf.example
Это пример файла, название на это намекает...
/etc/udisks2/mount_options.conf.example
Спасибо, сработало.
astroncia писал:
04.09.2021 08:09
Может попробовать так?

Shell

/bin/echo -e '[defaults]\nntfs_defaults=uid=$UID,gid=$GID' | \
sudo tee /etc/udisks2/mount_options.conf
Я примерно так и сделал. Просто под рутом записал эту строку в файл
Спасибо сказали:
Ответить