Format An NTFS Drive In Ubuntu

Most external drives are shipped with FAT32, which is great, until you come across files larger than 2 GB. The easiest way to get around this and maintain Windows compatibility is to reformat the drive to NTFS. Sure, you could do it in Windows, but what if you just happen to only have a Linux computer handy? Here’s how to do it in Ubuntu. These instructions are for an external drive, but should work for internal drives too. This will destroy any data on the drive. You’ve been warned!

First, you’re going to need the ability to create NTFS file systems, so install ntfsprogs:

sudo apt-get install ntfsprogs

Next, connect your external drive. In my case, I’m formatting a Western Digital WDElements 1 TB external USB hard drive. This auto-mounted for me at /media/Elements. If I run df -k I can see the drive to get the disk ID:

$ df -k
[...misc output...]
/dev/sdb1            976521568       128 976521440   1% /media/Elements

Ah, so it’s at /dev/sdb. First, we blow away the partition and re-create it as NTFS. Warning: you are going to be destroying all the data on the drive! Make sure you have the write drive designation, or you could lose data on your other drives!

$ sudo umount /dev/sdb1
$ sudo fdisk /dev/sdb

Options to select:

  • ‘d’ to delete the partition
  • ‘n’ to create a new partition
  • ‘p’ for primary
  • ’1′ for partition number
  • ‘Enter’ for first cylinder (default 1)
  • ‘Enter’ for last cylinder (default of max size)
  • ‘t’ for type
  • ‘L’ to list codes, and enter code for HPFS/NTFS. In my case, it’s ’7′
  • ‘w’ to write changes to disk, and exit
  • sudo umount /dev/sdb1

In the last step, I unmount the partition, because Ubuntu auto-mounted it again for me. Now, we need to create the file system. There are two ways to go about it: the impatient way (Quick Format), or the better but much longer way (Full Format).

Quick Format

This just allocates the disk space, but doesn’t zero out the drive or check for bad sectors. This means it’ll take a few seconds.

sudo mkfs.ntfs -f /dev/sdb1

Full Format

If you’re much more concerned about data integrity and don’t mind waiting, do a full format. This may take a few hours to zero out a large drive!

sudo mkfs.ntfs /dev/sdb1

That’s it!

Some other caveats:

  • NTFS is a journaling file system, which means changes may not be immediately applied. Always unmount a drive before disconnecting.
  • If you’re extra paranoid, run a ‘sync’ before you unmount the drive, to be sure that changes are written.
  • Windows is also quite paranoid about this, so always safely unmount the drive before disconnecting. Otherwise, you may find you can’t access the drive at all under Linux, until you mount it under Windows first to recover the journal.