Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Sunday, December 5, 2010

OpenSUSE -NTFS partition mounted for rw access

Example of an entry from my fstab file for an NTFS partition on partition 1 of the first drive (all on one line):
/dev/disk/by-id/ata-WDC_WD5000BEVT-60ZAT1_WD-WXN509S27952-part1     /windows/C     ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0
The first string  
specifies the partition to be mounted by its ID code. You have the option to specify it by device (in this case sdb1) instead of by the ID code. 
The second string /windows/C is the path to the mount directory. 
The third string specifies the driver to be used: ntfs-3g
The fourth string users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 lists the options to apply to the mount. In short, these options (selected by the openSUSE developers) give read-only access for normal users and read-write access for the root user. 
Note: option users doesn't work; it's a developers mistake; ignore it. The final string 0 0 is an admin string.
Many users, if not most, prefer to have write access to the NTFS partitions. That simple adjustment is covered in the next paragraph.
Allowing write access to the read-only mounts created during installation
I mentioned above that the default installation leaves normal users with read-only access to their partitions. It's a simple adjustment to make the drives writeable. You change the options string to it's simplest form, from this:
to this
The file fstab is a text file and the easiest way to alter a text file is with a text editor. Open a console window and enter one of the following commands to open the file for editing:
Gnome users:
gnomesu gedit /etc/fstab
KDE users:  
kdesu kwrite /etc/fstab
And replace the long options with these: defaults,locale=en_US.UTF-8. If you find a locale option that differs from locale=en_US.UTF-8, keep your locale option.
That was the quick fix for giving write permissions to partitions mounted read-only by the openSUSE installation program. There are other options for mounting NTFS partitions and these are covered below.

Mounting NTFS partitions permanently (with a line in fstab)
This section is for NTFS partitions that aren't already permanently mounted. If your partition was already automatically mounted during installation of openSUSE and all you want is to allow write access to it, read the sections above to make it writeable.
Tip #1: in most cases we don't have to use the locale= option. I'm going to leave it out from now on.
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. [and leave the last line in the file as a blank line.] Recommended option for world-writeable mount:
/dev/sdb1    /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:
/dev/sdb1    /path_to/mount_point    ntfs-3g    uid=1000,gid=100,umask=0022    0 0
Tip #2: The numerical form above appears all over the net, but I've found that names work just as well so I recommend using names for openSUSE versions 11.x because it's much simpler:
/dev/sdb1    /path_to/mount_point    ntfs-3g    uid=suzette,gid=users,umask=0022    0 0
In this example the "umask" with octal value 0022 produces permissions drwxr-xr-x on folder mount_point, for the owner=suzette (1000) group=users (100), just like normal openSUSE user permissions. If you change the umask option to umask=0027, the permissions become drwxr-x--- and only suzette can read the mount's contents.
[Tip #3: If you want to find a user's UID & GID, run the terminal command: id suzette]

No comments: