Monday, April 21, 2014

Mount a ntfs partion in Ubuntu, Linux

Generally no file can be executed at a pendrive or at a separate partition in Linux, unless it is mounted with proper permissions. The default mount (clicking on a pendrive or partition mounts automatically) does not provide necessary permission due to security issue.
This problem can be override by the following commands.

  1. First we need to find out our media to be mounted.
    fdisk -l
    This command gives a list of devices currently connected. Prompting this command at my terminal gives output:
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0xfa61dadb
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *   376006656   976773119   300383232    7  HPFS/NTFS/exFAT
    /dev/sda2            2046   376006655   188002305    5  Extended
    Partition 2 does not start on physical sector boundary.
    /dev/sda5            2048   360380415   180189184   83  Linux
    /dev/sda6       360382464   376006655     7812096   82  Linux swap / Solaris
    
    Partition table entries are not in disk order
    
    Suppose we are going to mount /dev/sda1.

  2. Now we have to define a mount point where that partition is going to be mounted. I will mount it into /media/Partition directory. The following command will create that directory.
    mkdir -p /media/Partition

  3. Finally, the following command will mount our partition.
    sudo mount -t ntfs -o nls=utf8,umask=000 /dev/sda1 /media/Partition
    We are mounting ntfs type partition or device, full list of supported type can be found at manual page of "mount" command. Umask = 000 means it allows read, write and execute permission for all (security risk).
Thats it. We have just mounted an ntfs file system into readable, writable, and executable mode.

No comments:

Post a Comment

Thanks - Jajabor, 2014