Skip to content
November 24, 2016 / lasseathome

Formatting a drive bigger than 2TB in Linux

I recently installed a big disk into my calculation server but could not format it with the gparted GUI. The main problem is that gparted and other tools use fdisk that cannot format drives larger than 2TB, and I wanted to add a 3 TB disk to my calculation server to store data and development code. I had to Google some solutions and found that this can be overcome by using GNU parted command using a partition table of type Intel EFI/GPT. Where the latter comes from the globally unique identifier (GUID) for the EFI System partition and uses information stored in the GUID Partition Table (GPT). EFI uses GPT where BIOS uses a Master Boot Record (MBR). There are plenty of other posts that contain the same essence, but I want to keep some commands readily available for myself so I once again post the commands I have used and want to remember, in the hope that others might find them useful.

The essence of the procedure is to identify the drive letter with lsblk, run parted to create a gpt table and a primary partition, format the drive with mkfs.ext4, and find the GUID with blkid so it can be stored in the /etc/fstab for automatic mounting. The command sequence is:

$ lsblk     # find drive name
$ sudo parted /dev/sdc # start parted
# the rest is in parted's interactive shell
(parted) mklabel gpt
(parted) unit TB
(parted) mkpart primary 0.0TB 2.7TB
(parted) quit
$ sudo mkfs.ext4 /dev/sdc1
$ sudo tune2fs -m 1 /dev/sdc1
$ sudo blkid     # Identify the drive GUID
$ sudo mkdir /Data
$ sudo nano /etc/fstab
# In fstab place the line
UUID=d18b6e08-d82d-4581-8445-8a463e1043fd /Data ext4 defaults 1 2
$ mount /Data

Now the 3TB drive is mounted in data, and I have a sandbox to play in.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: