Partition and Format Drive With NTFS
Say we bought an external hard drive to back up some stuff from a crashed computer. We can use a Live USB to get at the data and put the data on the external hard drive. Because the data needs to be accessible by Windows, we are going to use format the drive with NTFS.
Connect the external hard disk to your computer. Use
sudo fdisk -l to
find the device name. Output should look something like this:
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Disk model: CT2000MX500SSD1 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x117d68c1 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 3907029167 3907027120 1.8T 83 Linux
As can been seen above, the name of the device is
/dev/sdb. We use to
name to run
$ sudo fdisk /dev/sdb
Notice how we use the name of the device, and not the name of the
/dev/sdb without any numbers attached at the end).
After entering the command above, an interactive menu will be facing
you. Type a letter and press Enter to confirm.
Changes will only be applied when you type
w, so if you make a
mistake, just stay calm and press
q and you will exit
your pending changes discarded.
- Delete all your existing partitions by pressing
d. Depending on the amount of partitions, you might have to repeat this several times. If you want to check the current partition table, press
- After all old partitions are deleted, add a new partition by
n. If you just want to create a single partition on your drive, accept all the defaults by pressing Enter on each prompt. This will leave you with a single partition that will take up all space on the drive.
- Back in the main menu, type
tto change the partition type. Press
Lto see all partitions types. Here we are going to choose
HPFS/NTFS/exFAT). “The partition type […] is a byte value intended to specify the file system the partition contains and/or to flag special access methods used to access these partitions” (source). Linux does not care about the partition type, but Windows does, so we have to change it.
wto write your changes to the disk and exit
Format partition with NTFS
Now we create the actual NTFS file system on the drive:
$ sudo mkfs.ntfs -Q -L label /dev/sdX1
(If you don’t have
mkfs.ntfs installed, use your distro’s package
manager to install it (on Arch Linux it’s in a package called
-Qis the same as
--fast. This will perfom a quick format, meaning that it will skip both zeroing of the volume and and bad sector checking. So obviously, leave this option out if you want the volume to be zeroed or you want error checking. Depending on the size of your partition, this might take quite a while.
-Lis the same as
--label: it’s the identifier you’ll see in Windows Explorer when your drive is connected.
dev/sdX1: change the
Xto the actual letter of your drive we found earlier in this tutorial. You always format a partition, not a drive, so make sure that you put the correct number of the partition you want formatted at the end.