Partitition, Format Mount NTFS Drive Ubuntu 10.04

Ubuntu Linux Specific Guides
Post Reply
User avatar
dedwards
Site Admin
Posts: 70
Joined: Wed Mar 15, 2006 8:28 pm
Contact:

Partitition, Format Mount NTFS Drive Ubuntu 10.04

Post by dedwards » Sun Sep 26, 2010 7:59 am

Personally, I haven’t seen a speed difference copying files whether I’m using any Linux file system (ext3, XFS, JFS) or the NTFS file system on an external usb drive under Linux. So, I figure for maximum compatibility (HINT: being able to read the drive on both Linux and Windows systems) it makes sense to use the NTFS file system on external USB drives.

First, ensure the drive is detected in your system:

Code: Select all

sudo lsusb


You’ll get a listing similar to the following:

Code: Select all

Bus 004 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 005: ID 10d5:55a4 Uni Class Technology Co., Ltd
Bus 003 Device 004: ID 0461:4d22 Primax Electronics, Ltd
Bus 003 Device 003: ID 413c:2003 Dell Computer Corp. Keyboard
Bus 003 Device 002: ID 058f:9254 Alcor Micro Corp. Hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 1058:1110 Western Digital Technologies, Inc.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0bc2:3101 Seagate RSS LLC
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


Ensure that your drive is listed. You should be able to pick it out by the manufacturer type. Alternatively you can issue:

Code: Select all

sudo lsusb –v


which will give you a detailed listing of all your usb devices along with model numbers and make it easier to pick out your usb hard drive. Once you have verified that your USB device id properly detected issue the following command to view all the drives in your system:

Code: Select all

sudo fdisk –l


You will get a listing similar to the following:

Code: Select all

Disk /dev/sde: 1499.6 GB, 1499598946304 bytes
218 heads, 46 sectors/track, 292072 cylinders
Units = cylinders of 10028 * 512 = 5134336 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00029d92

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1      292073  1464451072    7  HPFS/NTFS



The drive I’m looking for is a 1.5 TB drive so the drive above meets the criteria on the size as well as the file system type (HPFS/NTFS). Usually you don’t have to format the drive since it’s formatted already when you buy it, but for the purposes of this tutorial we will partition and format it with NTFS again. So, assuming the drive you are partitioning is /dev/sde issue the following command:

Code: Select all

sudo fdisk /dev/sde


On the “Command (m for help):” prompt enter “d” without the quotes to delete the existing partition. Then press “n” to create a partition and then “p” for primary partition and then “1” for partition 1. Then press “Enter” for default first cylinder of 1 and “Enter” for the default last cylinder and press “w” to write the changes to the drive and exit fdisk.

Ensure ntfsprogs is installed on the machine:

Code: Select all

sudo apt-get install ntfsprogs


If not installed go ahead and install if installed the system will tell you so. Once installed issue the following command:

Code: Select all

sudo mkntfs -f /dev/sde1


You will get the following on your screen:

Code: Select all

Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes:   0%                                         3%   


Once the drive has been initialized, create a mount point (you can name your mount point whatever you like, I usually create my mount points under /mnt):

Code: Select all

sudo mkdir /mnt/ext-usb


and then mount it:

Code: Select all

sudo mount –t ntfs-3g /dev/sde1 /mnt/ext-usb


Your drive should be ready for use. Copying files to NTFS USB drives within Ubuntu I get about 22-25 MB/sec.

Automount your drive at bootup

If you wish to have the drive automatically mounted when the system boots up, you must add the following entry in your /etc/fstab file:

sudo vi /etc/fstab

Add an entry like below substituting your own drive partition and mount point:

Code: Select all

/dev/sde1 /mnt/ext-usb ntfs-3g rw,auto,user,fmask=0111,dmask=0000


Code: Select all

/dev/sda1 /mnt/ext-usb ntfs-3g defaults 0 0


Ensure you enter "ntfs-3g" as the file system if you want all users to have access to that partition.
Post Reply