If you are trying to create disk volumes over two terabytes (2TB) you’ll find that fdisk won’t let you do it. The problem lies not with fdisk, but with the old PCDOS disk label used on disks for the last three decades or so. Back in 1981 when the IBM PC was introduced, a disk of over two terabytes would have seemed inconcievable.
Thus, we struggle with the limitations of PCDOS disk labels today.
Some (newer?) versions of fdisk report the problem with large drives, giving this warning:
WARNING: The size of this disk is 8.0 TB (8001389854720 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
To get around the size limitation, there is only one solution: dump the PCDOS disk label for another label. The usual recommendation is the GPT (the GUID Partition Table) created by Intel. The GPT has a much larger limit, making 2TB partitions feasable.
However, the Linux utility fdisk does not work with drives that use GPT; thus, you have to use a different partitioning tool. The usual recommendation to Linux users is GNU parted. GNU parted handles multiple partition formats, including GPT. Documentation is available in multiple formats (PDF is one).
The steps to getting a large partition done with parted are simple:
- Create a disklabel (partitioning) on disk.
- Create a partition of the appropriate size.
- Create a filesystem (if needed).
First, create the GPT disklabel – in other words, create the partitioning tables to support GPT:
# parted /dev/sdc GNU Parted 2.2 Using /dev/sdc Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: Ext Hard Disk (scsi) Disk /dev/sdc: 8001GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags (parted) mklabel gpt Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes
Then after this, create a partition:
(parted) mkpart primary xfs 0 8001.4GB Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? c
This is what happens when the disk is not aligned properly on the appropriate boundary. Traditionally, the boundary was 512 bytes; now it is changing to 4K. GPT also apparently use a significant portion of the beginning of the disk.
To get around the alignment problem, you can use a start position of 1MB and an end position 1MB from the end:
(parted) mkpart primary xfs 1 -1 (parted) p Model: Ext Hard Disk (scsi) Disk /dev/sdc: 8001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 8001GB 8001GB primary
Parted supports a wide variety of units (and defaults to megabytes), all of which can be specified during numeric input – such as for start and end points. Using an end point of “100%” is probably just as good as using “-1” (1MB from end).
Jamie McClelland has a nice article about 2TB drives and alignment. Don’t blindly trust the tools to get the partitioning right; specify the appropriate numbers and units in order to force correct alignment.
GNU parted also supports an option that at least suggests it will use the best alignment when it can:
parted --align optimal
Again, don’t blindly trust it: check the numbers.