Parted: Solving Partitioning Problems on Large Filesystems
Software version | 2.1 |
Operating System | Debian 6 Red Hat 6.3 |
Last Update | 13/02/2013 |
Introduction
GNU Parted is a program for creating, destroying, resizing, checking, and copying partitions, and the file systems on them. This is useful for creating space for new operating systems, reorganizing hard disk usage, copying data between hard disks, and disk imaging. It was written by Andrew Clausen and Lennert Buytenhek.
It consists of a library, libparted, and a command-line frontend, parted, that also serves as reference implementation.
Currently, Parted runs only under Linux, GNU/Hurd, FreeBSD and BeOS.
Problem Statement
You may have just acquired a disk array (SATA, SAS…) and are encountering partitioning issues. For example, you might not be able to create partitions larger than 99GB or 2TB. This is what happened to me. And in your boot logs (dmesg), you might see errors like:
|
|
You likely partitioned with fdisk or cfdisk. And that’s where your error lies! Apparently, these tools still have difficulty handling large capacities. That’s why I’m recommending parted :-)
Installation
Quite simple:
|
|
Partitioning
Wizard
My partitioning is fairly simple; I want to create a single 4.5TB disk. First, I check that I don’t have any existing partitions and I begin:
|
|
Here we can see that I’m on my first disk (sda) and not on my array (sdb). Let’s switch to it:
|
|
Let’s create a label:
|
|
Next, create the partition:
|
|
For those who want to use LVM, simply add a flag:
|
|
Command line
If you want to do everything from the command line, for example to automate the process, here’s how. I’ve made a small script that creates a partition taking up the entire disk and optimizes it (via disk alignment) for the best performance:
|
|
- Line 1: we create a gpt-type label for large partitions (greater than 2TB)
- Line 2: we create a partition that takes up the entire disk
- Line 3: we indicate that this partition will be LVM type
Validation
We can see the result:
|
|
Everything looks good. I can exit:
|
|
And verify once more:
|
|
Formatting
All that’s left is to format it in the desired format (ext3 in this case):
|
|
Maximum Filesystem Sizes
Filesystem | Maximum partition size | Maximum file size |
---|---|---|
ext2 | 8 TB | 2 GB |
ext3 | 8 TB | 2 TB |
ext4 | 1024 PB | |
Resiser4 | 8 TB | |
ZFS | 16 EB | 16 EB |
Last updated 13 Feb 2013, 12:54 +0200.