Does Linux support NTFS?

Status
Not open for further replies.

acidosmosis

Posts: 1,310   +0
Does Linux support NTFS?

This was a question asked and talked about in #3dspotlight (unofficial IRC chatroom for TechSpot).

There is an article at www.anandtech.com about this. I am posting this article with a link so people can find this here if the question comes up again.



This article is located at http://www.anandtech.com/guides/viewfaq.html?i=121

I in no way claim that this is my work.


All modern Linux kernels (all 2.4.x and many 2.2.x) DO support NTFS in read-only mode.

Long Answer:
Although you can read NTFS partitions created with any version of Windows NT, you can not WRITE to an NTFS partition created with Windows 2000, XP, or anything yet to come. NTFS partitions created with Windows NT 4.0 and earlier CAN be written to, but this tends to make a mess of the file system, so make sure to do a chkdsk when you boot into NT after writing from Linux.

Below are in-depth instructions on how to gain access to your NTFS partition from Linux.

To access your NTFS partition:


Open a shell if you haven't already.

Become root. Do this by running su and entering your root password when prompted.

Create a mount point for the NTFS partition. mkdir /mnt/ntfs

Mount your NTFS partition. mount -t ntfs -o umask=644 /dev/device /mnt/ntfs
Replace device with the name of your NTFS partition. See below for advice on how to find this if you don't know.

The contents of the NTFS partition is now part of your tree. When you want to access a file on it, just think of /mnt/ntfs as C:\ and you're all set.

When you are done, repeat steps 1 and 2 (if you exited the shell) and run umount /mnt/ntfs
If you want all that to be done automatically when you boot Linux (doesn't take effect until you reboot of course):

Open a shell and become root as described before.

Open your fstab file. kedit /etc/fstab
Note that this assumes you have KEdit (part of the kdeapps package) installed. If you don't, replace kedit with vim, xemacs, gnotepad, or whatever text editor you like.

Add this line somewhere in the file:
/dev/device /mnt/ntfs ntfs umask=000 0 0

Save and exit.
Note that you have to make sure the directory /mnt/ntfs exists before you reboot, or else it just won't work.

To figure out what device your NTFS partition is:

What kind of hard drive is it on?
If it's on an internal IDE drive, it will be HDxy
If it's on a SCSI drive, or a pen drive, or an IDE drive hooked up to USB or FireWire, or any number of bizarre methods, it will be SDxy


Which device letter (x) is it?
IDE drives will be A for primary master, B, for primary slave, C for secondary master, and so on.
SCSI and other drives will be A for the first detected, B for second, and so on.

If that doesn't help, run dmesg | less and look through it for clues.


Which partition number (y) is it?
The first partition on the disk will be 1, and the second will be 2, and so on.

So if it's the second partition on your primary master IDE drive, the device is HDA2
If you get an error about NTFS not being supported by your kernel, the first thing you should try is to install the NTFS kernel module:

Open a shell and become root.

Install the module. modprobe ntfs
If no errors, try mounting again. If you do get an error, you might have to build yourself a new kernel
 
It can read NTFS no problem.

It can write to it to, however this is EXTREMELY problematic, and can cause data corruption.

You will have to have NTFS compiled as a kernel module, or into the kernel itself.
 
First and foremost, have you actually tried to mount an ntfs partition ? The module may already be compiled...

mount -t ntfs /dev/hda3 /mnt/mountpoint

where /dev/hda3 is the ntfs partition and /mnt/mountpoint is - you guessed it - the mount point
 
Seem to recall from compiling it, that the 2.6.2 kernel has slightly better NTFS write support? You guys probably know better than I do. :D
 
the new 2.6.4 kernel is at stable now...anyone know if this has NTFS support, or...much better than before?
 
NTFS read support has been in Linux kernel since 2.4. 2.6 kernels up to 2.6.4 support very limited NTFS writing - you can write to an existing file if you don't change its size (you can enable full writing also if you don't mind trashing the whole NTFS filesystem).
 
Status
Not open for further replies.
Back