Home About Me

Auto-Mounting NTFS Partitions with fstab

To have NTFS partitions mounted automatically at boot, first inspect the partition layout:

fdisk -l

The partitions in this example are:

<table> <thead> <tr> <th>Partition</th> <th>Format</th> </tr> </thead> <tbody> <tr> <td>/dev/sd1</td> <td>NTFS</td> </tr> <tr> <td>/dev/sd5</td> <td>NTFS</td> </tr> <tr> <td>/dev/sd6</td> <td>NTFS</td> </tr> <tr> <td>/dev/sd7</td> <td>NTFS</td> </tr> <tr> <td>/dev/sd8</td> <td>NTFS</td> </tr> </tbody> </table>

Create the mount directories:

#mkdir /media/{a,b,c,d,e}

Then open /etc/fstab in vi and add the following entries:

/dev/sda1 /media/a ntfs-3g defaults,iocharset=gb2312 0 0
/dev/sda5 /media/b ntfs-3g defaults,iocharset=gb2312 0 0
/dev/sda6 /media/c ntfs-3g defaults,iocharset=gb2312 0 0
/dev/sda7 /media/d ntfs-3g defaults,iocharset=gb2312 0 0
/dev/sda8 /media/e ntfs-3g defaults,iocharset=gb2312 0 0

What the fields mean:

  • /dev/sdax is the partition device.
  • /mnt/xxx stands for the mount point; in the sample above, the mount points are /media/a through /media/e.
  • ntfs-3g is the filesystem type used for the mount.
  • iocharset=xxx sets the character set. To support Chinese directory names created under Windows, set it to gb2312.

With these entries in place, the listed NTFS partitions will be mounted under their assigned directories when the system boots.