Digital storage is getting cheaper every day, but even though they cost less than they used to, drives over 2 TB pose an additional difficulty: they don’t partition nicely. That is, unless you know how to partition a GPT hard drive.
I recently bought this 3 TB Seagate Barracuda hard drive from Amazon to put in my home Ubuntu server. In the era of smaller drives, I would normally use a program like GParted or a command line tool like fdisk to make partitions and format them, but working with drives just isn’t that simple any more.
Old drives — under 2 TB — are partitioned with a Master Boot Record (MBR). Newer drives 2 TB and up are partitioned with a partition table using a globally unique identifiers (GUID). GUID partition table = GPT.
So what?
As it turns out, most of the old tools that were used to working with MBR drives don’t know how to hand GPT drives. GParted and fdisk can’t handle the job anymore. If you try working on a GPT drive in fdisk, the program greets you with something like this:
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdb’! The util fdisk doesn’t support GPT. Use GNU Parted.
WARNING: The size of this disk is 3.0 TB (3000592982016 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 make things worse, the drives not only use a different partitioning schema, they also use a different sector size. Previously the sector size was 512 bytes, and this is what most of the tools were built to handle. These new drives use 4,096-byte sectors — a.k.a. “advanced hard drive format” — once again too big for our legacy partitioning and formatting tools.
Now that we know what won’t work, let’s take a look at what will.
How to Partition a GPT Hard Drive with GNU Parted
One confusing part of Linux is the similarity between program names. GNU Parted — not to be confused with GParted — is a command line tool for partitioning and formatting drives, and it works nicely with GPT drives.
If you aren’t used to it, command line programs can be a little intimidating. Thankfully, GNU Parted employs a very user-friendly interactive mode to guide you through the process. To get started, type this at your command line:
# parted device
In this example, device
means the drive that you are formatting. If you need help figuring out how to describe the drive you want to use, try a command like this:
# lshw -C disk
Review the output and find the “logical name” for the drive (it will look like /dev/sdb
).
When you envoke the GNU Parted interactive mode, you get this greeting:
GNU Parted 2.2
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.(parted)
Typing 'help
' gets you this list of commands:
You can spend some time working through all this if you want, but if you're in a hurry try this:
(parted) mklabel gpt
(parted) mkpart P1 ext3 1MiB 8MiB
The first command labels the drive GPT. The second command makes a partition in that label in ext3 format.
If you're really brave, you can also try partition and formatting with just one command, without even entering the interactive mode:
# parted /dev/sda mklabel gpt mkpart P1 ext3 1MiB 8MiB
This command does the same thing the interactive mode did -- the only difference is that the second choice is executed directly from the command prompt whereas the first choice is done through the GNU menu system.
How to Partition a GPT Hard Drive Graphically
If the command line stuff is too much or if you just want to take a fast, simpler approach, there is a graphical tool that can handle GPT and advanced format drives with ease: Webmin.
If you don't already have Webmin installed, from your Ubuntu command line type sudo apt-get install webmin
. After the install, open your web browser and navigate to port 10000 on your computers IP address. For example, my server is located at 192.168.1.100 on my local network. To access Webmin, I type in my browser's address bar: https://192.168.1.100:10000
.
Once you have logged into Webmin, expand the "Hardware" tab in the left menu and click "Partitions on Local Disks." Choose the drive you want to manage to view your options. If your drive is blank, you can create a partition. If there are already partitions, you can add a new partition or wipe the current partitions. If you have an Advanced Format Drive, make sure you enter a sector size of 4096 bytes when you are creating the partition. Otherwise you might get warnings that your drive is not aligned, or you might experience performance issues.
After you make the partition, click the button to create a filesystem on the partition and Webmin will format the partition for you.
Now that you are comfortable working with GPT hard drives, why not plan ahead for your storage needs? Click here to get great deals on GPT hard drives from Amazon. (aff)
Leave a Reply