pilla Bodhisattva
Joined: 07 Aug 2002 Posts: 7731 Location: Underworld
|
Posted: Tue Jan 07, 2003 8:00 pm Post subject: UN2: Mounting MS Windows partitions (FAT,NTFS) |
|
|
Navigation: [Uncategorized] [Table of Contents]
Symptoms:
Cannot mount a Windows (tm) partition, or just root can access a mounted partition.
Solution:
Step 1 Build a kernel with support to your Windows (tm) file systems
There are two main types of Windows (tm) partitions: NTFS and FAT-based. The first step is to compile the file system support for these in your kernel or as modules.
In the kernel configuration menus, go to File Systems and enable:
Code: |
...
<*> DOS FAT fs support
<*> MSDOS fs support
...
<*> VFAT (Windows-95) fs support
...
<*> NTFS file system support (read only)
...
|
Compile also the Native Language Support (usually ISO 8859-1) in Native Language Support.
It is very important not enabling write support for NTFS, as it is DANGEROUS. These are recommended settings, if you are sure you do not need some of these, feel free not to select them. You can also build them as modules. Compile and install your new kernel and modules, reboot your computer and you are ready for the next step.
Step 2 Setting your /etc/fstab
Considering that your Windows (tm) partition is on /dev/hda1 and it is a FAT32 partition, the basic configuration for your /etc/fstab should be:
Code: |
/dev/hda1 /mnt/c vfat defaults 0 0
|
where /dev/hda1 is the partition, /mnt/c the mountpoint where the partition will be available after mounting, vfat is the file system type, defaults is the option to be passed to mount, and 0 0 is related to file system integrity test (no test with 0 0). This will allow only root to enter, read or write /mnt/c or its contents. If you want to allow only a given user/group to access it, use the options uid and gid:
Code: |
/dev/hda1 /mnt/c vfat defaults,uid=510,gid=610 0 0
|
will mount /mnt/c for the user with user id 510, and will set the group id for 610. But the default group permission is read-only, so users of the same group cannot enter the directory (because it is not set executable).
Options like "defaults,uid=510,..." are only separed by ",". A space or a tab will give a message like:
Quote: |
[mntent]: line 16 in /etc/fstab is bad
mount: can't find /mnt/c in /etc/fstab or /etc/mtab
|
You can change permissions using the parameter umask. But be aware that it must be the bitmask of permissions that are not present for the mountpoint. It is an octal number, formed like this:
first digit: permissions for everybody
second digit: group permissions
third digit: user permissions
The modes are as follows (the first column is the mode octal number):
Quote: |
M | R W X
--------------------
0 | * * *
1 | * * -
2 | * - *
3 | * - -
4 | - * *
5 | - - *
6 | - * -
7 | - - -
|
For example, if you want that everybody be able to read, write, and execute every file in your /mnt/c, you should specify the mask 000:
Code: |
/dev/hda1 /mnt/c vfat defaults,umask=000 0 0
|
If you want that only users from group 610 be able to read, write, and execute:
Code: |
/dev/hda1 /mnt/c vfat defaults,gid=610,umask=707 0 0
|
If you want that only users from group 610 be able to read, and execute (not write):
Code: |
/dev/hda1 /mnt/c vfat defaults,gid=610,umask=727 0 0
|
If you have a NTFS partition, change vfat to ntfs and add ro (read-only) to the option line:
Code: |
/dev/hda1 /mnt/c ntfs defaults,ro 0 0
|
_________________ "I'm just very selective about the reality I choose to accept." -- Calvin |
|