Wednesday, October 28, 2009

Discover /etc/fstab

Many times, after a Linux install Windows partition i.e. NTFS file system becomes inaccessible through Linux. In these cases if you can make appropriate entries on your /etc/fstab you can recover these partitions. Although tools like ntfg-3g and ntfs-config are already there. And these tools are easy to use but knowing the innards never hurts, does it?
The basic syntax of fstab entry is :-
[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]
 Let us take each term one by one.
  • Device : Here we specify the device we want to mount. For eg. HardDisks are generally named as /dev/hda1 or something similar.
  • Mount Point : This entry tells the OS about the folder on which your partition or device will be mounted. You should keep all your mounted devices in /mount/the_device_name or /mnt/the_device_name. Again, this in convention not compulsion.
  •  File System Type : Here you can tell the OS about the type of file system you are going to mount. If you are not sure of the type then try using auto. This will make an attempt to detect the file system type automatically.
    For NTFS write ntfs-3g. Other popular file system types are ext3 and swap.
  • Options : Fstab supports a lot of options. Some major ones are discussed here.

    1. ro or rw : This stands for read only or read write type of mounting.
    2. exec or noexec : This option enables or disables the execution of binaries present in the specified device.
    3. auto or noauto : If you want the device to get automatically mounted on boot then choose auto otherwise choose noauto.
    4. user or nouser : Choosing user will enable all the users to mount the device while nouser will make sure that device is monted only by root user.
    5. defaults : If you find all of this too confusing :) .

  • Dump and Pass : These options have a little role to play if your computer does not contain important data. Dump tell the OS to backup the device, if it is setted to 1. 0 disables it.
    Pass specifies the order to check file system. Usually 1 is used for root partition and 2 for the other devices. The options are :-
    0 == do not check.
    1 == check this partition first.
    2 == check this partition(s) next 
A typical fstab entry looks like this:-
/dev/hda6       /mount/hda6          ntfs-3g         defaults      0      0


Reblog this post [with Zemanta]

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.