Mounting NTFS and exFAT: Sharing Disks With Windows

Mounting NTFS and exFAT: Sharing Disks With Windows

A Windows partition that mounts read-only, files all owned by root, and a USB stick that works on one machine and not another. Three symptoms with three different causes, all stemming from the same thing: these filesystems were not designed for Unix semantics, so Linux fabricates them.

Two NTFS drivers

# which do you have available
grep -E 'ntfs|exfat|fuseblk' /proc/filesystems
modinfo ntfs3 2>/dev/null | head -3
which ntfs-3g mount.ntfs-3g

ntfs3 is the in-kernel driver, merged in Linux 5.15. Contributed by Paragon Software, and considerably faster than the alternative because it does not round-trip through FUSE.

ntfs-3g is the older userspace FUSE driver. Slower, and more battle-tested in corners the kernel driver has not been through yet.

# force one explicitly
sudo mount -t ntfs3 /dev/sda3 /mnt/win
sudo mount -t ntfs-3g /dev/sda3 /mnt/win

# what is actually mounted
findmnt /mnt/win
# TARGET SOURCE    FSTYPE OPTIONS
# /mnt/win /dev/sda3 ntfs3  rw,relatime,uid=0,gid=0...

fuseblk in the FSTYPE column means you are on ntfs-3g. ntfs3 means the kernel driver.

Most distributions now default to ntfs3. If you hit corruption warnings or odd behaviour, trying the other one is a reasonable diagnostic step rather than a workaround.

Permissions do not exist, so they are invented

The thing to understand before anything else.

NTFS and exFAT store no Unix ownership, no mode bits, no symlinks. NTFS has its own ACL system that does not map cleanly onto Unix, and exFAT has nothing at all.

So the driver makes them up at mount time, uniformly for the whole filesystem. Which is why everything is owned by root and nothing is writable by you.

# the options that matter
sudo mount -t ntfs3 -o uid=1000,gid=1000,umask=022 /dev/sda3 /mnt/win

# find your ids
id -u; id -g
OptionEffect
uid=Owner of every file
gid=Group of every file
umask=Permission mask for everything
fmask=Mask for files only
dmask=Mask for directories only
windows_namesReject filenames Windows cannot handle
preallocReduce fragmentation, ntfs3

umask=022 gives 755 directories and 644 files. For a drive only you should touch, umask=077 is tighter. Our umask guide covers the arithmetic and our permissions guide covers what the bits mean.

fmask and dmask separately is the better form, because directories need the execute bit and files usually should not have it:

sudo mount -t ntfs3 -o uid=1000,gid=1000,fmask=0133,dmask=0022 /dev/sda3 /mnt/win

fstab, properly

# get the UUID, never use /dev/sdaX in fstab
lsblk -o NAME,SIZE,FSTYPE,UUID,LABEL
blkid /dev/sda3
# /etc/fstab
UUID=1234ABCD5678EF90  /mnt/win  ntfs3  defaults,uid=1000,gid=1000,fmask=0133,dmask=0022,windows_names,nofail,x-systemd.device-timeout=5  0 0

Two options doing important work:

nofail means the system still boots if the drive is absent. Without it, an unplugged external drive drops you into emergency mode, which is a genuinely unpleasant surprise.

x-systemd.device-timeout=5 caps how long boot waits for it.

The last field must be 0. fsck does not understand NTFS, and a non-zero pass number makes boot attempt a check that cannot work.

Our fstab guide covers the format, and using UUIDs rather than device names is the point our /dev guide makes about detection order.

For a drive you want mounted on demand rather than at boot:

UUID=1234ABCD5678EF90  /mnt/win  ntfs3  noauto,x-systemd.automount,uid=1000,gid=1000  0 0

x-systemd.automount mounts it on first access, which is the right behaviour for a large secondary disk.

Read-only, and why forcing it is a bad idea

sudo mount /mnt/win
# or it mounts and is read only
touch /mnt/win/test
# touch: cannot touch: Read-only file system

sudo dmesg | tail -20
# ntfs3: Failed to mount read-write, volume is dirty

This is nearly always Windows fast startup.

Fast startup is hibernation wearing a different name. Windows writes its memory state to disk and marks the filesystem as in-use, because resuming expects the filesystem to be exactly as it left it. Linux sees the dirty flag and refuses to write, which is correct.

If you write to it anyway and then resume Windows, you corrupt the filesystem. Windows resumes with a stale picture of the disk and writes over your changes with no awareness they exist.

# the wrong fix, understand what it does
sudo mount -t ntfs3 -o remove_hiberfile /dev/sda3 /mnt/win   # discards the hibernation image

The correct fix is in Windows:

  • Control Panel → Power Options → Choose what the power buttons do → Turn off fast startup
  • Then Shut down, not Restart, once
# clear a stale dirty flag, after a genuine clean shutdown
sudo ntfsfix /dev/sda3

ntfsfix is not chkdsk. It mainly clears flags and schedules a real check for the next Windows boot. For actual damage, run chkdsk /f from Windows. Our fsck guide covers the Linux-native equivalent for Linux filesystems.

Our dual boot guide covers the wider arrangement, and fast startup is the single most common cause of dual-boot grief.

exFAT

# driver, in-kernel since 5.4
grep exfat /proc/filesystems

sudo mount -t exfat -o uid=1000,gid=1000,umask=022 /dev/sdb1 /mnt/usb

# format one
sudo mkfs.exfat -n MYDRIVE /dev/sdb1
sudo fsck.exfat /dev/sdb1

exFAT’s case for existing: every modern system writes it natively. Windows, macOS, Linux, cameras, Android. For a drive that must move between all of them, it is the answer.

What it does not have:

  • No permissions or ownership
  • No journalling, so an interrupted write can leave inconsistency
  • No symlinks or hard links
  • No extended attributes, so none of the metadata our xattrs guide covers

Do not use it for backups. A backup on exFAT loses ownership, permissions, symlinks and xattrs, which means a restore produces files that are not what you backed up. Our restic versus borg comparison covers tools that store metadata in their own format, which sidesteps the problem if you must use such a drive as a container.

Do not use it for a Linux home directory, which fails in confusing ways the moment something expects a symlink.

Choosing

UseFilesystem
Portable drive, Windows and Linux both writeexFAT
Large shared partition, Windows primaryNTFS
Linux backupsext4 or Btrfs
Linux system or homeext4, Btrfs, XFS
USB stick for BIOS firmware updatesFAT32

Our filesystem comparison covers the Linux options, and FAT32 remains the answer for firmware because that is what UEFI can read.

Diagnosing a drive that will not mount

# is it detected at all
lsblk -o NAME,SIZE,TYPE,FSTYPE,LABEL
sudo dmesg | tail -30

# what does the superblock say
sudo blkid /dev/sdb1
sudo file -s /dev/sdb1

# is the driver present
grep -E 'ntfs|exfat' /proc/filesystems
sudo modprobe ntfs3 exfat

# try explicitly, and read the error
sudo mount -t ntfs3 -v /dev/sdb1 /mnt/test
sudo mount -t ntfs-3g -v /dev/sdb1 /mnt/test

The causes in order of likelihood:

  1. Dirty flag from fast startup or hibernation
  2. Driver module not loaded, on a minimal install
  3. Wrong partition, since Windows disks have several and the data one is not usually the first
  4. Actual damage, which wants chkdsk from Windows
  5. A nofail-less fstab entry that stopped the boot rather than the mount

Our hardware info guide covers identifying the disk, and dmesg guide covers reading the driver’s complaint, which usually states the reason plainly.

Frequently Asked Questions

Should I use ntfs3 or ntfs-3g?

ntfs3 is the in-kernel driver, available since Linux 5.15, and it is considerably faster because it avoids the FUSE round trip. ntfs-3g is the older userspace driver and remains more mature in places. Most distributions now default to ntfs3, and ntfs-3g is the fallback when it misbehaves.

Why does my NTFS partition mount read only?

Almost always because Windows was hibernated or shut down with fast startup enabled, which leaves the filesystem marked dirty. Linux refuses to write to it rather than risk corruption. The fix is disabling fast startup in Windows and doing a full shutdown, not forcing the mount.

Why are all the files on my NTFS drive owned by root?

Because NTFS and exFAT have no Unix ownership or permission metadata, so the driver invents it at mount time. Everything appears owned by whoever the uid and gid mount options say, defaulting to root. Set uid, gid and umask in fstab to make it usable by your account.

Can I use exFAT for a Linux backup drive?

You can and should not. It has no permissions, no ownership, no journalling and no symlink support, so a backup loses metadata and is not crash safe. Use exFAT only for drives that must be readable by Windows or a camera, and ext4 or Btrfs for anything else.

How do I repair an NTFS filesystem from Linux?

Use ntfsfix for minor issues, which mainly clears the dirty flag and schedules a real check. It is not a replacement for chkdsk. For anything beyond trivial, run chkdsk from Windows, because the Microsoft tool understands structures the Linux tools treat conservatively.

Which filesystem should I use for a drive shared between Linux and Windows?

exFAT for a portable drive that both must write to, since both support it natively without extra drivers. NTFS if you need permissions-free interoperability with large files and Windows is the primary system. Avoid putting a Linux home directory on either, because the missing Unix metadata breaks things in subtle ways.