- NTFS
- Tips and tricks
- Improving performance
- Prevent creation of names not allowed by Windows
- Known issues
- Explicit file system type required to mount
- Troubleshooting
- unknown filesystem type ‘ntfs’
- udisks support
- Unable to mount with ntfs3 with partition marked dirty
- See also
- Can Linux read NTFS? 6 things to know about Linux and NTFS
- Can you install Linux on NTFS?
- How to use NTFS-3G to read and write NTFS on Linux
- Mount NTFS using NTFS-3G
- How to mount NTFS partition on boot
- Can’t mount NTFS partition because of Windows hibernation
- NTFS mounted disk shows errors or constantly turns into read-only
- Как получить доступ к NTFS из Linux?
NTFS
NTFS (New Technology File System) is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family.
The ntfs3 kernel driver provides read and write support for the file system.
- All officially supported kernels with versions 5.15 or newer are built with CONFIG_NTFS3_FS=m and thus support it. Before 5.15, NTFS read and write support is provided by the NTFS-3G FUSE file system. Or you can use backported NTFS3 via ntfs3-dkmsAUR .
- Paragon Software, the author of the kernel module, has not yet released userspace utilities for NTFS3. You can use NTFS-3G userspace utilities without NTFS-3G driver via ntfsprogs-ntfs3AUR .
Tips and tricks
Improving performance
You can enable the prealloc mount(8) option to decrease fragmentation in case of parallel write operations (most useful for HDD).
Prevent creation of names not allowed by Windows
NTFS itself does not have restrictions for characters and names used, but Windows does.
Since the kernel version 6.2, ntfs3 supports windows_names mount(8) option. Use it to strictly maintain compatibility.
Known issues
Explicit file system type required to mount
ntfs3 requires the file system type to mount.
To be able to mount the file system, specify its type as ntfs3 . For example, using mount(8) ‘s -t / —types option:
# mount -t ntfs3 /dev/sdxY /mnt
Troubleshooting
unknown filesystem type ‘ntfs’
When mounting NTFS, you can encounter an error such as:
mount: /mnt: unknown filesystem type 'ntfs'
If you want to use ntfs3 as the default driver for ntfs partitions, such udev rule does the trick:
/etc/udev/rules.d/ntfs3_by_default.rules
SUBSYSTEM=="block", ENV=="ntfs", ENV="ntfs3"
Although, this method is not recommended and can confuse some 3rd party tools.
udisks support
This article or section is out of date.
Reason: The described problems have been fixed. Since kernel version 6.2, ntfs3 supports windows_names option. (Discuss in Talk:NTFS)
udisks supports NTFS3, but has some issues at the moment. See udisks ntfs3 PR and issue 932.
Issues can manifest as the following errors, when the NTFS3 driver is used because NTFS-3G is not installed, but with mount options that it does not recognize:
ntfs3: Unknown parameter 'windows_names'
Filesystem type ntfs3,ntfs not configured in kernel
The second error in particular can be encountered with Dolphin. Nautilus can also report the same error message in the case of a dirty NTFS partition (see #Unable to mount with ntfs3 with partition marked dirty).
As a workaround, add a such option to /etc/udisks2/mount_options.conf in [defaults] section:
ntfs_defaults=uid=$UID,gid=$GID,prealloc
Unable to mount with ntfs3 with partition marked dirty
When trying to mount a good NTFS partition (i.e. which successfully mounts with NTFS-3G and for which ntfsfix —no-action does not report any error), you may get the following error:
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error. dmesg(1) may have more information after failed mount system call.
ntfs3 will not mount a partition where the volume is marked dirty without the force option. dmesg explicitly helps recognizing the situation, saying:
sdb1: volume is dirty and "force" flag is not set!
You can try passing the —clear-dirty argument to ntfsfix to clean it. [1]
See also
Can Linux read NTFS? 6 things to know about Linux and NTFS
NTFS is a proprietary file system, which stands for New Technology File System, it has this name because it was made for Windows NT 3.1, while Linux on the other hand has the Extended File System, or ext, which is the file system designed to support Linux.
Linux only supports reading NTFS, it cannot write on the file system, but by using an NTFS implementation called NTFS-3G, you can read and write on NTFS.
Can you install Linux on NTFS?
Linux must be installed in an EXT partition, like Ubuntu, in some situations dealing with NTFS is unavoidable, like the users who use a dual-boot with Windows and want to access another partition.
When using dual-boot, you have a drive or different drivers which will have the NTFS partition for Windows and the EXT partition for Linux, Linux is still installed on the EXT partition, which supports the permission system it has.
How to use NTFS-3G to read and write NTFS on Linux
NTFS-3G is a driver/implementation which will help you dealing with NTFS partitions from your Linux partition. If you have an NTFS partition that you want to write to, you must use the NTFS-3G NTFS implementation.
Before using NTFS-3G check if you have it installed, if not, install it on your system.
How to install NTFS-3G
- To install NTFS-3G on Ubuntu, use: sudo apt-get install -y ntfs-3g
- Fedora: NTFS-3G is already installed
- Arch Linux, Manjaro: pacman -S ntfs-3g
- You can get ntfs-3g in almost any distribution!
Caution when using NTFS-3G
This driver implements the NTFS file system and its wrong use may harm your device, read more about it on the MAN page.
Mount NTFS using NTFS-3G
Creates a folder called mydata to mount the partition
sudo mount -t ntfs-3g /dev/sdxx /mnt/mydata
Use the mount command, using -t to specify ntfs-3g as the type, followed by the device and then the mountpoint.
If you don’t know the exact partition you want to mount, use sudo fdisk -l to list the disks and devices, you can identify the partition using the disk model or its size as a reference.
After mounting, you can access the data in the mountpoint specified, with read and write permissions!
To umount, you can use the umount command with that partition.
How to mount NTFS partition on boot
You can follow these steps to mount your NTFS on boot.
- sudo blkid
- Copy the UUID of your disk
- sudo nano /etc/fstab
- Add the following line to the end of this file: UUID=the uuid copied above /mnt/mydata ntfs-3g defaults 0 0
- Save the file and reboot
If you have problems with the ownership of the mounted disk, you can use the following:
Umount the disk if it is being used
Use chown to set your user as owner
chown youruser:youruser /mnt/mydata
The problem with chown is that it will have to be set every time the partition mounts, to change this, change the defaults for the device on fstab to:
rw stands for read and write, users is being used to allow any user to mount this disk, when searching online you will also find the user option, the difference between users and user is that users will let any user umount it, while user will make only the user who mounted the filesystem umount it.
For an external disk you could use something like:
Auto and nofail are being used to not stop the boot process in case of an error with this device, but to mount it if possible, the noatime option will prevent writes when doing reads.
Can’t mount NTFS partition because of Windows hibernation
If you get the message ‘Metadata kept in Windows cache, refused to mount.’, your disk was previously used by a Windows installation, the message is preventing you from doing potential harm to your Windows installation, like locking it in hibernation forever.
You cannot by default mount a partition that had a Windows installation in it, the proper way to fix this is by booting the Windows system and properly shutting down the computer, but if you don’t care about that previous installation, there is an easier way to mount the partition.
You can also try to fix it using the mount command:
mount -t ntfs-3g /dev/sdxx /mnt/myhd -o remove_hiberfile
The remove_hiberfile does what is needed to allow you to mount the partition even with the presence of the hiberfil.sys file, which holds a flag telling other Operational Systems that Windows is hibernating.
Users report problems with the remove_hiberfile command, which in my machine it turned out that it didn’t do anything, what you can do is try to append the -o parameter at the end of the command like above, to attempt fixing the problem.
NTFS mounted disk shows errors or constantly turns into read-only
One bad surprise that you can have is figuring out that after mounting the disk with read-write mode, it randomly and repeatedly turns back into read-only.
The most common reason for the read-only issue is that your disk has problems, Linux turns it to read-only to prevent further damage, even if Windows didn’t care about that.
There can be other reasons why your disk is doing this, but spotting this is a good signal to backup your data, and be safe until you figure out the issue.
You can use tools like badblocks and smartctl to further identify these issues, if you are just mounting your NTFS partition for the first time, it could even be a great idea to format it to EXT4 and run some checks to know your data is safe!
Badblocks has destructive and non-destructive modes, and it will report the reading, writing, and comparing errors, the tests don’t go easy on your disk, so use it with caution.
Как получить доступ к NTFS из Linux?
Я новичок в линукс. Есть жесткий на 2 Тб и SSD на 240Гб.
На жестком стоит win10 на ssd Linux Mint.
Запускаю нужную ОС просто выбором в биос Boot device priority
Столкнулся с такой проблемой, из под линукс я вижу жесткий диск и файлы на нем, но не могу ничего на него записать,
только считать.
Если простой способ записи файлов на ntfs диски из под линукса.
Заранее благодарю за ответ.
Из вопроса не ясно какой у тебя дистрибутив линукс. Поставь пакет ntfs-3g. Он позволяет монтировать для записи разделы винды. Если установлен попробуй перемонтивать раздел для записи:
mount -o remount,rw /////
Денис, а можно поподробнее про «гибернате» где-то почитать? В частности о том, как винда блокирует запись в свой раздел
Дмитрий Беляев, она может не то чтобы блокировать запись, а просто ставить флаг «Dirty bit»:
https://askubuntu.com/questions/145902/unable-to-m.
Насколько я понимаю, он идет в линукс через перезагрузку. Вообще странный расклад. Минт должен обнауживать винду на втором жестком винду и прописывать её в загрузчик. Зачем в этом случае идти через биос не ясно.
В линухе еще ни разу не сталкивался с ситуацией, когда гуй, при его наличии хоть какого-нибудь, не мог смонтировать NTFS раздел. Правда, считается, что лучше все-таки обходиться без записи в них.
Тормозной способ.
Поставить ntfs-3g и монтировать им через fuse.
Скоростной способ.
Скачать бесплатный вариант Microsoft NTFS for Linux by Paragon Software и монтировать с типом ФС ufsd.
Первый вариант даже на USB3 выдавал не более 20-25МБ/сек, второй вариант дотягивал до 100-110МБ/сек.
Главный недостаток второго варианта — нет поддержки DKMS (вручную переставлять при каждом изменении версии ядра) и утилит для проверки целостности ФС. (Есть в платном варианте.)
mount -t ntfs /dev/устройство /куда/будем/монтировать
Если сругнется то придется поставить поддержку ntfs.
Вот ntfs-3g выше советуют
Проблема в другом. Вроде-бы при выключении Win10 записывает какие-то служебные данные, что-бы потом быстрее стартонуть. Драйвер в Linux это видит. и дабы не повредить ничего, монтирует в Read Only режиме. Попробуйте перезагрузиться из Win10 в Linux, должно сработать. Плюс, можно отключить эту возможность в Win10, и тогда все будет норм.