How To Create a Partition Larger than 2TB in Linux

Andrew Rodriguez
Andrew Rodriguez
  • Updated

Document Scope

In order to create partitions larger than 2TB in Linux, you need to use the command "parted" as fdisk can only manage partitions UP to 2TB. This article provides a basic step-by-step on how to properly create a partition that will let you use the entirety of a drive larger than 2TB.

Note

For any commands here, you will either need to use sudo permissions or be logged in as root in your running installation. This guide assumes you have already set yourself to have the needed permissions and only provides the commands necessary to modify drive partitions.

Partition the target drive

For this guide, our new drive will be /dev/sdb so all commands will use that drive name. Make sure to edit any commands here to fit your actual drive name.

# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.

Set disk label to gpt

Now that parted has a drive specified, you will first use mklabel to set the drive label to gpt. Running the print command now will simply allow you to verify that the mklabel command was successful.

(parted) mklabel gpt
(parted) print
Model: Unknown (unknown)
Disk /dev/sdb: 5909GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags

Create a partition

Next, use mkpart to create a partition. You will need to set a partition type (primary/logical) as well as the start and end of the partition. This can be done with specific size ranges or percentages of a drive. In the below example, a partition is made using a specific range/size of 5909 GB. Again, print is used here simply to show the command results and is not necessary to the formatting/partitioning of the drive. Once you have all of your partitions created, you can simply press q to save and exit parted.

(parted) mkpart primary 0GB 5909GB
(parted) print
Model: Unknown (unknown)
Disk /dev/sdb: 5909GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
 1        1049kB  5909GB  5909GB               primary


(parted) q

If you know you want to simply use the entirely of a drive, then you can use percentages rather than specific start/end GBs, as in:

(parted) mkpart primary 0% 100%

Format the partition

You now have a drive partitioned but it's not QUITE ready to be used. To begin writing data, you'll need a file system. To do this, you can use the mkfs command as in the below example.

# mkfs.ext4 /dev/sdb1                                
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 6553088 4k blocks and 1638400 inodes
Filesystem UUID: da1ccafe-62c8-4fea-b05a-bbf656c829e5
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Allocating group tables: done                          
Writing inode tables: done                          
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Mount the new partition

Lastly you can mount this new partition to make writing data easier.

# lsblk | grep sdb
sdb 8:16 0 25G 0 disk
└─sdb1 8:17 0 25G 0 part /testmount

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.