How to format and mount disk larger than 2TB on Linux

Days ago I needed to format a large 4TB drive on Linux, and same as other times I knew I couldn’t run a simple fdisk command to create the new partition, as fdisk won’t work on drives larger than 2TB on Linux. This is what I did to format and mount a driver larger than 2TB on Linux, follow my step by step tutorial.

 format and mount drive larger than 2TB on Linux

Run fdisk -l to check out your disk device name, for example:

fdisk -l

Output example:

Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes
 255 heads, 63 sectors/track, 486401 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 4096 bytes
 I/O size (minimum/optimal): 4096 bytes / 4096 bytes
 Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
 /dev/sdd1 1 267350 2147483647+ ee GPT
 Partition 1 does not start on physical sector boundary.

How to format and mount disk larger than 2TB on Linux 5

How can I  create a 4TB partition size on Linux without fdisk?

We will use the parted command as you see below:

parted /dev/sdd

Output example:

[root@DHPV006 ~]# parted /dev/sdd
 GNU Parted 2.1
 Using /dev/sdd
 Welcome to GNU Parted! Type 'help' to view a list of commands.
 (parted)

Now let’s create a new GPT disk label, issue this command:

mklabel gpt

Output example:

(parted) mklabel gpt
 Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to continue?
 Yes/No? yes

Now set the default disk unit to TB, issue the next command:

(parted) unit TB

Create the new 4TB partition:

mkpart primary 0.00TB 4.00TB

Now let’s see if the system can detect the new partition by printing the new disk information, enter “print”:

(parted) print

Sample outputs:

Model: ATA TOSHIBA MD04ACA4 (scsi)
 Disk /dev/sdd: 4.00TB
 Sector size (logical/physical): 512B/4096B
 Partition Table: gpt

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

All done, now let’s format the new partition with ext4 filesystem, for that we will use the mkfs command, as you see here:

mkfs.ext4 /dev/sdd1

Output example:

[root@DHPV006 ~]# mkfs.ext4 /dev/sdd1
 mke2fs 1.41.12 (17-May-2010)
 Filesystem label=
 OS type: Linux
 Block size=4096 (log=2)
 Fragment size=4096 (log=2)
 Stride=1 blocks, Stripe width=0 blocks
 244195328 inodes, 976754176 blocks
 48837708 blocks (5.00%) reserved for the super user
 First data block=0
 Maximum filesystem blocks=4294967296
 29809 block groups
 32768 blocks per group, 32768 fragments per group
 8192 inodes per group
 Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
 102400000, 214990848, 512000000, 550731776, 644972544

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

This filesystem will be automatically checked every 20 mounts or
 180 days, whichever comes first. Use tune2fs -c or -i to override.
 [root@DHPV006 ~]#

Add the new 4TB partition to fstab so the system will try to mount it automatically after every reboot:

nano -w /etc/fstab

Then add this line at the end:

/dev/sdd1 /mnt/home2 ext4 defaults 0 2

On this example I used “/mnt/home2” as mount point, but you can use any directory you need.

Now let’s create the directory:

mkdir /mnt/home2

Then issue this command to manually mount it by reading /etc/fstab content:

mount -a

Now let’s verify the new partition is mounted as expected by running df command, as you see down here:

df -ah | grep home2

Output example:

[root@DHPV006 ~]# df -ah | grep home2
 /dev/sdd1 3.6T 68M 3.4T 1% /mnt/home2
 [root@DHPV006 ~]#

If you see that then I have to say congratulations, your new big partition is ready to be used.

Further readings:

About the Author: Esteban Borges

Experienced Sr. Linux SysAdmin and Web Technologist, passionate about building tools, automating processes, fixing server issues, troubleshooting, securing and optimizing high traffic websites.

Leave a Reply

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