HowTo: Mount your NTFS Filesystem/Partition for Read/Write Access in openSUSE 10, 11

openSUSE versions: 10.3 and 11. I maintain a page with information for earlier versions of Suse on this link.

Internal and external NTFS partitions are different: NTFS partitions don't mount read-write by default. You can arrange for an internal drive to mount read-write permanently by making a permanent entry in the file system table (fstab). You can't do that for an external NTFS partition because if it's switched off when the system boots, the entry in fstab will cause an error condition. So we apply different tweaks for internal and external drives.

↑↑↑↑Identify your NTFS partitions: You can see your NTFS partitions in the response you get when you call an fdisk listing in a console with this command:

sudo /sbin/fdisk -l

Look for the lines contining "NTFS" in the output, like this one from my computer:

/dev/sdb1 * 1 1306 10490413+ 7 HPFS/NTFS

That identifies an NTFS partition on device sdb1, the first partition on the second internal drive. If it's mounted, you'll see it in the response to the console command mount, in KDE's "My Computer" link on the Desktop or in Gnome's Nautilus under the Computer --> Filesystem Icon (provided you know the mount point).

Alternatively you can see a good summary of all the above information in Yast's Partitioner --> System --> Partitioner.

Software FYI: You need applications ntfs-3g and libfuse2 (or fuse which brings libfuse2 with it). These are usually installed by default. You can optionally have ntfs-config which allows one-click switching on/off of read permissions for ordinary users on internal ntfs partitions; warning -- do not use ntfs-config for external drives unless you are at least an intermediate user.

Internal Drives

↑↑↑↑Suse's default treatment of NTFS on Internal Drives: If you accepted the defaults for NTFS partitions suggested during installation of openSUSE, then the install program will create entries in fstab that mount NTFS partitions permanently using the ntfs-3g driver. Root can read and write whereas users can only read.

If you negate/refuse the suggestion for mounting an existing NTFS partition made by Yast's partitioner during installation of openSUSE -- or if you create a new NTFS partiton on an internal drive after installation, then the partition/s will not be mounted at all thereafter until you actively make it happen.

There are two types of mounts: temporary mounts made from the command line interface using a console and permanent mounts made by inserting mount instructions into the file system table using either the CLI or one of several GUI devices.

↑↑↑↑Permanent Mounts for Internal Drives

Suppose that you want to mount a partition permanently in a folder you create for it (e.g. mount_point), located anywhere you like in your filesystem, say at /path_to/mount_point.

To mount your NTFS partition permanently, add your version of the following line into the file system table, fstab. make sure you leave no line spaces, except the last entry must be a blank line. Recommended option for world-writeable mount:

/dev/sda2    /path_to/mount_point    ntfs-3g    defaults    0 0

When you reboot, the partion will mount into the folder /path_to/mount_point with permissions drwxrwxrwx, i.e with read/write access for everybody, in the style of Microsoft's insecure filesystems.

Here's an alternate option for fstab: If you want the permissions to be linux-like, you can specify a particular owner for the mount folder and its contents with this sort of line in fstab. Recommended option for sole-owner mount:

/dev/sda2    /path_to/mount_point    ntfs-3g    uid=1000,gid=100,umask=0022    0 0

In this example the "umask" with octal value 0022 produces permissions drwxr-xr-x on folder /path_to/mount_point, for the owner/user with uid=1000, just like a standard linux user. Of course, uid values run 1000, 1000, 1002,.... as the case may be.

Here's yet another alternative for the entry, widely quoted, which is why I include it. Recommended against because it can cause errors:

/dev/sda2    /path_to/mount_point    ntfs-3g    user,users,gid=users,umask=0002    0 0

In this example the owner is root, the group is users and the octal value 0002 for umask produces permissions drwxrwxr-x. The options "user" and "users" imply that the disk is mountable (and unmountable) by ordinary users. Caution: that can lead to a "dirty" filesystem which will no longer mount until a consistency check is performed in Windows. Also, in reality, mounting the partition as an ordinary user can be problematic. I recommend strongly against using this last formulation.

↑↑↑↑The locale option: If the partition contains files with a national character set that has not been set (by the operating system) before the partition is mounted, those files can be invisible and appear to have vanished; very disconcerting. Setting the locale option can render them visible again; e.g. add locale=en_US.UTF-8 for us English, utf8 or locale=cs_CZ.utf8 for Czech, etc. To see them all on openSUSE enter this command in a console: locale -a. Most people do not need to include the locale option.

↑↑↑↑The force option: If the partition is unmounted in a disorderly fashion, e.g. power failure, unmounted improperly by a user, etc, then the so-called "dirty" bit remains set and a consistency check (e.g. by booting to Windows and running chkdsk) is needed before the drive can be mounted again. You can bypass this requirement by including the force option. Just add the word force into the comma-separated list of options in either of the recommended mounting lines above, which will become "defaults,force" or "uid=1000,gid=100,umask=0022,force" depending which you are using.

↑↑↑↑Failed Mounts -- Resetting the "dirty" bit: Sometimes the drive will fail to mount, as mentioned immediately above. You might get a messages like this one beginning "$LogFile indicates unclean shutdown. Mount is denied because NTFS is marked to be in use.......". These are symptomatic of disorderly processes previously interrupting a clean dismount or shutdown. If you have Windows (2000 or higher) installed or handy, boot the drive in that and allow Windows to right the situation either automatically by running a consistency check on booting or by running chkdsk /f yourself from the command prompt. You can also run chkdsk /f from the repair facility after you boot from the Windows install CD and run to the end where you select to repair the installed system. Failing that you can use the force option outlined just above, but that's not the preferred option.

↑↑↑↑Temporary Mounts for Internal Drives: I'm making this section brief, hoping you will refer above to the section on permanent mounts for the fuller details.

If you want to mount the NTFS partition temporarily, then you don't put an entry into fstab. Instead you just execute the command line versions of either of the recommended mounts discussed earlier. Don't forget these must be issued as root, so enter su first to get rootly powers.

Here is the recommended form for a world-writeable temporary mount:

hostname:~ # mount -t ntfs-3g /dev/sda2 /path_to/mount_point

Note that the directory "mount_point" automagically changes permissions during the mount process to drwxrwxrwx, regardles of where and what it was before..

Here is the recommended form to simulate Linux-like permissions in a temporary mount:

hostname:~ # mount -t ntfs-3g -o rw,uid=1000,gid=100,umask=0022 /dev/sda2 /path_to/mount_point

This alternate command-line version produces permissions drwxr-xr-x on folder /path_to/mount_point, for the owner/user with uid=1000, which is the normal situation for a Linux first user's home folders. You can of course use other values of uid, depending who needs to own the mount.

↑↑↑↑Automounting external (USB) NTFS drives in read-write mode: When you plug a USB NTFS drive into openSUSE it automounts read-only by design of the openSUSE developers. If you want it mounted read-write, you can either unmount it and then remount it using one of the CLI commands I've outlined above or you can change the system default way of automounting NTFS drives so they will always automount read-write. To do that you essentially put a link into the directory /sbin that redirects the automount process to the ntfs-3g driver. The following command (as root) will create the permanent adjustment:

sudo ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs

If at some later stage you want to revert back to the default of automounting USB drives read-only, simply delete the link mount.ntfs located at /sbin/mount.ntfs. Finally, read what was said above about haw to fix a failure to mount.

Appendix: Bits and Pieces

With regard to the Linux-like permissions you get when you use the second options I've listed above, you may adjust adjust the folder, document or user permissions quite widely. You should read the man pages. Check out the umask, dmask and fmask options. Here's a handy little table of octal permissions to use for directory permissions:

  • owner=rwx group=rwx other=rwx; i.e for drwxrwxrwx use umask=0000
  • owner=rwx group=rwx other=r-x; i.e for drwxrwxr-x use umask=0002
  • owner=rwx group=rwx other=---; i.e for drwxrwx--- use umask=0007
  • owner=rwx group=r-x other=r-x; i.e for drwxr-xr-x use umask=0022
  • owner=rwx group=--- other=---; i.e for drwx------ use umask=0077

↑↑↑↑The GUI application ntfs-config: openSUSE comes with the RPM ntfs-config, although it's not installed by default. You have to start it with this command in a console issued as root (enter su first): ntfs-config. It brings up a GUI that shows all your NTFS partitions and allows you to mount them as read-only or as read-write filesystems with simple one-click actions. You should not use this application on external drives because ntfs-config writes an entry to fstab for a permanent mount. If you reboot with that entry still remaining in fstab, you will have an error situation that will prevent booting to a Desktop Manager if the USB drive is not powered on when next you reboot.

Credits - I adopted this info and these methods after reading the following and much more:

Cheers
Swerdna June 07; latest update August 08