Debian partition disk over 2TB

Usually you cannot create a Linux partition larger than 2 TB using the fdisk command. The fdisk won’t create partitions larger than 2 TB. If you need a large partition on Linux Server, It will not allow you to create a partition that is greater than 2TB. In this tutorial, You will learn how to format a 4TB hard disk and mount it.

Find Out The Current Linux Disk Size

Type the following command:

fdisk -l | grep '^Disk'

You will see I need to format /dev/sdb (3.91 TiB)

Start to format the disk

To create a partition start GNU parted as follows:

parted /dev/sdb


Output:

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

Creates a new GPT disklabel i.e. partition table:

 mklabel gpt

Sample outputs, and type “Yes” to continue,

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes

Next, set the default unit to TB, enter:

 unit TB

To create a 4TB partition size, enter:

 mkpart primary 0 0

OR

 mkpart primary 0.00TB 4.00TB

To print the current partitions, enter:

 print

Sample outputs:

Model: ATA ST33000651AS (scsi)
Disk /dev/sdb: 4.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 0.00TB 4.00TB 4.00TB ext4 primary

Please use screen command before you proceed command below to avoid Broken pipe for SSH connection.

screen -S hdd

Use the mkfs.ext4 command to format the file system, enter:

mkfs.ext4 /dev/sdb1

Mount the disk

mkdir /hdd2

mount /dev/sdb1 /hdd2

Use df -H to check your hard disk

Reference

  1. https://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html
  2. https://gparted.org/
  3. https://www.cyberciti.biz/faq/linux-disk-format/
  4. https://www.cyberciti.biz/faq/linux-check-boot-path-command/
  5. https://yylin.medium.com/%E5%A6%82%E4%BD%95%E6%8E%9B%E8%BC%892tb%E4%BB%A5%E4%B8%8A%E7%A1%AC%E7%A2%9F-614e6e6d005a ( Chinese version)