How to create a Linux partition larger than 2TB

A question I get asked more and more, is how do you create a filesystem larger than 2TB on a linux server. Most admins know how to use fdisk, and then mkfs, but fdisk limits you to a 2T partition on the disk.

An easy way to create a partition larger than 2TB is to use the parted command. In this example, I have a 39T drive, and I want to create a 20T filesystem. On the system, the drive device is /dev/sdb

image

First use parted /dev/sdb to modify the drive. When you start parted you are placed in a command prompt. The first task is to create a drive label, “mklabel gpt”

image

The next task is to create a new 20TB primary partition on the disk, using the command “mkpart primary” The system will ask for the start block, and then the size of the partition. In this example, since I am using an NVME device, I also will get an error about the alignment.

image

The print command will show the new partition

image

Now you can create the filesystem as you normally would.

On the alignment error,  if you look at the logical block size ( 512) and start on the 1st block, you will not get the error;

image

2 Replies to “How to create a Linux partition larger than 2TB”

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.