Linux Creating a Partition Size Larger than 2TB

by Vivek Gite · 20 comments

Linux desktop user generally uses small hard disk and partition, but on server you need a large partition. For example, you cannot create 4TB partition size (RAID based) using fdisk command. It will not allow you to create a partition that is greater than 2TB. In this tutorial, you will learn more about creating Linux filesystems greater than 2 Terabytes to support enterprise grade operation under any Linux distribution.

To solve this problem use GNU parted command with GPT. It supports Intel EFI/GPT partition tables. Partition Table (GPT) is a standard for the layout of the partition table on a physical hard disk. It is a part of the Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the outdated PC BIOS, one of the few remaining relics of the original IBM PC. EFI uses GPT where BIOS uses a Master Boot Record (MBR).

GUID Partition Table
(Diagram illustrating the layout of the GUID Partition Table scheme. Each logical block (LBA) is 512 bytes in size. LBA addresses that are negative indicate position from the end of the volume, with −1 being the last addressable block. Imaged Credit Wikipedia)

GPT Kernel Support

EFI GUID Partition support works on both 32bit and 64bit platforms. You must include GPT support in kernel in order to use GPT. If you don't include GPT support in Linux kernelt, after rebooting the server, the file system will no longer be mountable or the GPT table will get corrupted. By default Redhat Enterprise Linux / CentOS comes with GPT kernel support. However, if you are using Debian or Ubuntu Linux, you need to recompile the kernel. Set CONFIG_EFI_PARTITION to y to compile this feature.

File Systems
   Partition Types
     [*] Advanced partition selection
     [*] EFI GUID Partition support (NEW)
....

Linux create 3TB partition size

One of my clients has Raid 5 Array -7x500GB hard disks to store large data. To create partition start GNU parted as follows:
# parted /dev/sdx
Output:

GNU Parted 1.8.1
Using /dev/sdx
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Creates a new GPT disklabel i.e. partition table:
mklabel gpt
Create 3TB partition size:
mkpart primary 0 3001G
Quit and save the changes:
quit
Use mkfs to format file system:
# mkfs.ext3 /dev/sdx1

Note: Replace /dev/sdx with actual RAID or disk name or block Ethernet device such as /dev/etherd/e0.0 . Don't forget to update /etc/fstab, if necessary.

Further readings:

Continue reading rest of the Multi-Terabytes Linux Filesystems series.

Contents
  1. Linux Creating a Partition Size Larger than 2TB
  2. Linux: Boot a 2TB+ partition or Larger Array Using Grub

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 20 comments… read them below or add one }

1 Ryan 11.10.07 at 8:02 pm

Typically with Linux and large disks, I prefer just to use LVM directly on the disk, no partitioning at all. I find this to be very stable and manageable.

2 Benjamin Schweizer 11.26.07 at 4:53 pm

Ryan, how do you tell grub to load the kernel from a lvm partition? IMHO, grub wont mount logical volumes and thus, cannot find your kernel.

3 Paul 03.12.08 at 7:40 am

Thanks for the CLI verify – I used gPartED for the same – with graphical confirmation;)

4 John 03.17.08 at 1:10 am

Using the default distro kernel in Debian 4.0 (etch):

$ uname -a

Linux video-server 2.6.18-4-amd64 #1 SMP Mon Mar 26 11:36:53 CEST 2007 x86_64 GNU/Linux
</blockquote?
$ zgrep _EFI_ /proc/config.gz

CONFIG_EFI_PARTITION=y

5 Wessel 08.07.08 at 6:03 pm

Another tip, instead of doing

# mkpart primary 0 3001G

Do

# mkpart primary 0 -0

This will tell parted to fill up the entire drive with one volume.

6 Gadgetman 10.16.08 at 9:35 pm

I could create on 3TB volume following guide above. But when rebooting, the pratition tabled is wrong. Pleas Help /T

7 svrmarty 11.11.08 at 2:28 pm

when i’m booting my own build debian kernel,
it stocks when the system want’s to mount to root filesystem.

it says somthing like
the following disks found
0800 sd sda
0810 sd sdb

8 svrmarty 11.12.08 at 12:07 pm

the error is

VFS: cannot open root device “sda2″ or unknown-block(8,2)
Please append a correct “root=” boot option; here are the available partitions:
0800 244129792 sda driver: sd
0810 9765519360 sdb driver: sd

9 Jamie 11.20.08 at 11:30 pm

All supported releases of Ubuntu (ie 6.06 LTS and higher) do have ‘CONFIG_EFI_PARTITION=’y compiled into the kernel.

10 Randall 01.08.09 at 3:07 pm

Since recent versions of Ubuntu and Debian have CONFIG_EFI_PARTITION compiled into their stock kernels, you should remove the part about having to recompile the kernel so that readers don’t needlessly recompile their kernels.

11 Luke 01.28.09 at 6:42 am

What tripped me up is mkpart gpt is actually a lone command followed by a sub-command.
Don’t type them both at once, wait for the next prompt before typing gpt.

12 John 06.09.09 at 2:28 pm

With EXT3 on most systems the max block size is 4096 bytes, which will still limit you to ~8TB for your filesystem.

13 Manish Patel 06.27.09 at 4:56 am

Hi,

How to Create a Partition Size Larger than 2TB in Freebsd 7.2 64-bit and 32-bit OS. I have a hardware raid 5 disk contains total 8TB of size and want to create a partition like one 5TB and one 3TB.

How I can get it done in FreeBsd.

Thank you
Manish

14 what? 12.20.09 at 8:45 am

i don’t understand the premise.

since i can’t buy a > 2tb drive, i don’t see the problem.

fdisk /dev/sda
(make a partition of type fd, that spans the entire 2tb drive)
fdisk /dev/sdb
ditto sdc
ditto sdd

mdadm (assemble sda through sdd into a raid 5 of size 6 terabytes)

then mkfs /dev/md0

show me where with the biggest drives you can buy as of today, that you’ll have to run “fdisk” against something larger then 2tb????

15 Vivek Gite 12.20.09 at 11:18 am

Clearly you never worked in an enterprise setup where you can put 24 x 1TB size drive put in RAID mode.

16 Amit Sinha 12.22.09 at 8:42 pm

Thanks for the great tut. There is 1 basic part I could not understand, once you create a single 3 TB partition using “mkpart primary 0 3001G”, how do you create partitions for OS, swap and other stuff.

17 SassyZ 01.16.10 at 9:11 pm

Great Post!!!

Prior to this article, I was having trouble partitioning a 6TB Raid 5 Array (4 x 2TB disks).
I’m running CentOS (2.6.18-164.10.1.el5) and used the following commands from this article and comments. Thanks!

————————-
parted /dev/sda
mklabel gpt
mkpart primary 0 -0
quit
mkfs.ext3 /dev/sda
————————-

* Note: I first tried using “gparted” but something with the data types in the graphical interface didn’t like the size of the raid array and was displaying negative values. Stupid gui.

18 Jon Kiji 01.19.10 at 11:33 am

[quote]show me where with the biggest drives you can buy as of today, that you’ll have to run “fdisk” against something larger then 2tb????[/quote]

Try a hardware RAID for a change. The RAID controller will report a single huge drive to your OS. I just skip partitioning the RAID device altogether. *shrug*. Just mkfs /dev/sdb.
No fiddling with exotic partitions. Not the prettiest of solutions, but very reliable nontheless.

19 Chris 02.09.10 at 1:10 am

This isnt working for me.

(parted) mklabel
New disk label type? gpt
Error: Invalid argument during write on /dev/sdb
Retry/Ignore/Cancel?

Would this have anything to do with it…

Warning: Device /dev/sdb has a logical sector size of 4096. Not all parts of
GNU Parted support this at the moment, and the working code is HIGHLY
EXPERIMENTAL.

If so, how can I get around this? I’m using four 2TB drives in RAID5 – volume size is 5.9TB – it is ISCSI.

20 Chris 02.09.10 at 1:22 am

[QUOTE]I just skip partitioning the RAID device altogether. *shrug*. Just mkfs /dev/sdb[/QUOTE]

I tried that but if I run fdisk -l i get….

Disk /dev/sdb doesn’t contain a valid partition table.

Will this cause any problems?

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: