Sunday, August 16, 2009

Adding ntfs partitions in fstab

This section describes how to add the ntfs partitions in the fstab so that they will get mounted automatically while bootup itself

1. Find the partitions which are ntfs
/dev/sda1, /dev/sda6, /dev/sda7 are ntfs partitions in my system.

saravanan@saravanan-desktop:~$ sudo fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0f4a0f4a

Device Boot Start End Blocks Id System
/dev/sda1 * 1 6081 48838656 7 HPFS/NTFS
/dev/sda2 6082 30401 195350400 5 Extended
/dev/sda5 8154 11800 29294496 83 Linux
/dev/sda6 11801 17598 46572403+ 7 HPFS/NTFS
/dev/sda7 17599 30401 102840066 7 HPFS/NTFS
/dev/sda8 6082 6329 1991997 82 Linux swap / Solaris
/dev/sda9 6330 8153 14651248+ 83 Linux

Partition table entries are not in disk order
saravanan@saravanan-desktop:~$


2. Create three directories for mounting the three ntfs partitions (name it as you wish).

saravanan@saravanan-desktop:~$ sudo mkdir /media/windows
saravanan@saravanan-desktop:~$ sudo mkdir /media/media
saravanan@saravanan-desktop:~$ sudo mkdir /media/download


3. Add the following lines to the end of the /etc/fstab file.

/dev/sda1 /media/windows ntfs-3g defaults,force 0 0
/dev/sda6 /media/media ntfs-3g defaults,force 0 0
/dev/sda7 /media/download ntfs-3g defaults,force 0 0


4. The content of the fstab file will now be like this,

saravanan@saravanan-desktop:~$ sudo cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc defaults 0 0
# / was on /dev/sda9 during installation
UUID=a279e8ee-83fa-4fcc-afd7-6ca8ea508fb4 / ext4 relatime,errors=remount-ro 0 1
# /home was on /dev/sda5 during installation
UUID=c8203577-d56f-4806-bf3c-95e8d0508cc4 /home ext4 relatime 0 2
# swap was on /dev/sda8 during installation
UUID=c9bcea3f-1d09-4787-b95a-730664fdf7a7 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/sda1 /media/windows ntfs-3g defaults,force 0 0
/dev/sda6 /media/media ntfs-3g defaults,force 0 0
/dev/sda7 /media/download ntfs-3g defaults,force 0 0
saravanan@saravanan-desktop:~$


5. You can either reboot the system to check that the partitions are getting properly mounted (OR) You can mount the partitions using 'sudo mount -a' command


Note: The 'force' option in the fstab file is used to force mount the partitions in case of unclean shutdown. Normally if there was a unclean shutdown, the ntfs partitions will not be automatically mounted during the bootup. To avoid this, the 'force' option is added.

No comments: