Creating and Formatting NTFS partitions with Ubuntu

Let’s say you just bought a brand new hard drive, are planning to put it into a Ubuntu server, and also want it formatted as NTFS. So you probably would think to partition and format the drive on your Windows box beforehand right? Well I completely didn’t think to do that in my excitement of unwrapping my new 16TB Exos drive. It was also such a pain in the ass to get this drive into the case the server is currently residing in, that I did not want to pull it out to then have to struggle to get it back in.

So if you find yourself in this situation, fear not! Ubuntu 22.04 is perfectly capable to partition and format a fresh drive with NTFS, it may just take a little more work than the Windows GUI, but not much.

Let’s draw out the process by referring to my tutorial of how to mount NTFS partitions in ubuntu. The TLDR of it is: we need to determine the UUID of a partition that we want to mount automatically at startup using /etc/fstab.

So this means you need to create a partition because the drive currently doesn’t have any. (For the most part this is how a new drive will come, but this is not always the case).

Side note: One notable exception to the above paragraph is USB external hard drives. They are typically pre-formatted in either NTFS, exFAT, or something Appley. I’ve even seen a USB hard drive that was split in half with NTFS and Macintosh HFS+, and whichever one you plugged it into initially, there was a program for that OS that will wipe the 2nd partition and grow the one you intend to use to full size.

Now that we have that out of the way, before you can create a partion, you need to decide which partition scheme you would like to use, GUID or MBR. Pretty much if you are using a modern motherboard/firmware, you should use GUID. MBR should be used for older systems, or for wider compatability between systems.

If you don’t already have it installed, you should install parted to perform command line partitioning operations. Do so with:

sudo apt update
sudo apt install parted

Now identify the new drive using parted. This command will only work for drives that do not currently have any partitions on it.
sudo parted -l | grep Error

If your drive already has partitions on it, instead use
sudo fdisk -l
To list all current drives/partitions on the system. If your drive already has partitions on it, you can also skip the steps to create a partition scheme. If you just want to reformat an existing partition, skip the steps where you define the partition and instead go right to creating the filesystem with mkfs.

Now that you’ve identified the drive, use parted to create the partition scheme:
sudo parted /dev/sda mklabel gpt for GPT
sudo parted /dev/sda mklabel msdos for MBR

Now that the drive’s partition scheme is defined, use parted to define an NTFS partition, that spans the entire size of the drive.
sudo parted -a opt /dev/sda mkpart primary ntfs 0% 100%

With the new partition defined, use mkfs to create the filesystem within the partition. Use the “-f” flag to perform a quick format:
sudo mkfs.ntfs -f -L partitionlabel /dev/sda1

If you want to change the partition label after it has been formatted, use:
sudo e2label /dev/sda1 newlabel

At this point you should be able to use lsblk to see the new partition with the label used from the previous step(s):
sudo lsblk

Now that the NTFS partition has been created, you can follow the steps from my aforementioned article of how to mount NTFS partitions with Ubuntu.

Sources:
1. How to Partition and Format Storage Devices in Linux
2. How can I format a partition into a filesystem quickly?