While rebuilding a large RAID 5 logical drive I had to use parted instead of fdisk. It has been awhile since I had to build a logical drive that was over 2TB so it had been quite awhile since I have used parted which will perform the same basic functions as fdisk and more. Anyhow when first attempting to use parted to create a partition table on the logical volume sitting on top of an Adaptec RAID card with multiple 2TB drives configured as RAID 5 on CentOS Linux I ran into an error. The resolution is easy but needed to note for myself as much as anything else.
CentOS Linux Parted Error Attempting To Partition 6TB Logical Drive:
[root@backup ~]# parted /dev/sdc GNU Parted 1.8.1 Using /dev/sdc Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) help check NUMBER do a simple check on the file system cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition help [COMMAND] prints general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkfs NUMBER FS-TYPE make a FS-TYPE file system on partititon NUMBER mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system move NUMBER START END move partition NUMBER name NUMBER NAME name partition NUMBER as NAME print [free|NUMBER|all] display the partition table, a partition, or all devices quit exit program rescue START END rescue a lost partition near START and END resize NUMBER START END resize partition NUMBER and its file system rm NUMBER delete partition NUMBER select DEVICE choose the device to edit set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version displays the current version of GNU Parted and copyright information (parted) print Error: Unable to open /dev/sdc - unrecognised disk label. (parted) print all Error: Unable to open /dev/sdc - unrecognised disk label. (parted) mkpart primary ext3 1 5991400 Error: Unable to open /dev/sdc - unrecognised disk label.
The above output shows parted being launched from a terminal window on CentOS Linux. From the error messages it is obvious that we need to create a disk label but it took me a moment to remember the exact syntax. Use the parted syntax below to create a label for the hard drive in question.
Use Parted To Create Disk Label On CentOS Linux:
(parted) mklabel gpt
Now that the disk label has been created you can print the partition table or create new partitions as shown in the below example output.
Create Partition On Multi Terabyte Logical Drive On CentOS Linux:
(parted) mkpart primary ext3 1 5991400 (parted) print Model: Adaptec backup1 (scsi) Disk /dev/sdc: 5991GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1000kB 5991GB 5991GB primary (parted)
In the above example output we now have a 6 TB or Terabyte partition generated by parted on CentOS Linux. Don’t forget to format the filesystem before attempting to use your new partition.