The Danger of Raw Hard Drives
If you purchase a brand new 4TB hard drive, plug it into your Linux server, and boot up the machine, the operating system will recognize the physical metal disk. However, you cannot immediately start saving files to it. Before a hard drive can hold data, it must be logically divided into specific sections called “partitions.”
Historically, Linux administrators used a tool called fdisk to slice up hard drives. While fdisk is legendary, it was built in an era when hard drives were measured in megabytes. It natively struggles with modern hard drives larger than 2 Terabytes because it relies on the ancient Master Boot Record (MBR) standard, which mathematically caps out at 2TB.
To safely format massive 4TB, 8TB, and 16TB drives using the modern GUID Partition Table (GPT) standard, you must use a more advanced partitioning tool. In the Linux terminal, the most powerful and reliable tool for this job is the parted command.
Step 1: Identifying the Target Drive
Before you use parted, you must be absolutely certain you are targeting the correct physical drive. Formatting the wrong drive will instantly eradicate the entire Linux operating system.
Run the lsblk (List Block Devices) command to see all attached drives.
lsblk
You might see your primary 500GB drive listed as sda, and your brand new, completely empty 4TB drive listed as sdb. Write down the name of the new drive (sdb). You will use it for the rest of this tutorial.
Step 2: Entering Interactive Mode
Because partitioning a drive requires several sequential steps, parted operates in an interactive mode. You launch the program, and it takes over your terminal until you explicitly tell it to quit.
Because you are modifying raw hardware, you must use sudo, and you must explicitly tell parted which drive to target.
sudo parted /dev/sdb
Your standard bash prompt ($) will change to (parted), indicating that you are now actively inside the partitioning program. Every command you type now goes directly to the hard drive controller.
Step 3: Initializing the Drive (GPT)
The first step is to stamp a modern partition table onto the blank drive. As mentioned, you must use GPT to handle drives larger than 2TB.
At the (parted) prompt, type:
mklabel gpt
Press Enter. The command will execute silently. The drive is now initialized and ready to be sliced.
Step 4: Slicing the Partitions
Now you must define the actual partitions. You can slice the 4TB drive into four 1TB chunks, or you can assign the entire 4TB block to a single massive partition. Let’s create a single, massive partition.
You use the mkpart (Make Partition) command. You must define a name (e.g., “primary”), the starting point, and the ending point.
mkpart primary 0% 100%
By using percentages (0% to 100%), you completely bypass the complex math required to calculate exact megabyte sectors. You are simply telling parted to use every single drop of available space from the beginning of the disk to the absolute end.
To verify that it worked, type:
print
You will see a clean table displaying your massive new partition (which will be labeled as Partition 1). Type quit to exit the interactive mode and return to your standard bash prompt.
Step 5: Formatting the File System
The parted command slices the drive, but it does not apply a file system (like FAT32 or NTFS). Linux requires an ext4 file system to actually read and write files.
Now that the partition is created, it will be labeled as /dev/sdb1 (the number 1 indicates it is the first partition on the sdb drive).
To format it with the ext4 file system, run:
sudo mkfs.ext4 /dev/sdb1
Once this process finishes, the massive 4TB drive is fully prepared. You can now mount it to a directory and begin saving your massive video files or database backups securely.