New disks need to be prepared for use. When using a hardware raid like explained in Create hardware raid on HP via hpacucli some partitioning tools even show an error message.
To prepare a disk for use, the disk needs to be partitioned. When the disk is completely empty, some partitioning tools show an error message about the disk not being usable. This is as the disk does not have a partition table. The partition table is at the beginning of the disk containing the information about the partitions present on the disk.
In the following example the partition table is created on a hardware raid disk named “/dev/cciss/c0d1” using parted(8) and the “mklabel” command.
$ parted /dev/cciss/c0d1 GNU Parted 3.2 Using /dev/cciss/c0d1 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) (parted) mklabel gpt (parted) q Information: You may need to update /etc/fstab.
The “gpt” stands for GUID Partition Table and is the type of partition table to be created on the disk.
The disk now has a partition table but no partitions. The next step is to create the partitions. Partitions should be aligned correctly to achieve the best performance.
Starting parted with the option “–align optimal” will instruct parted to “use optimum alignment as given by the disk topology information”.
$ parted --align optimal /dev/cciss/c0d1 GNU Parted 3.2 Using /dev/cciss/c0d1 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: Compaq Smart Array (cpqarray) Disk /dev/cciss/c0d1: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags
As the output above shows, there is no partitionyjet created on this disk. Using the “mkpart” command, a new partition is created. In case of a GPT partition table, the first argument is the name of the partition not the partition type as it is on “msdos” partition table. To allow parted to align the new partition, the easiest way is to start the partition at 0%. Wrongly aligning the partition will result in a warning message like this.
Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel?
In the command below, the entire disk is created as one large partition so the partition start is 0% and the partition end is 100%.
(parted) mkpart primary 0% 100% (parted) print Model: Compaq Smart Array (cpqarray) Disk /dev/cciss/c0d1: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 2000GB 2000GB primary (parted) align-check opt 1 1 aligned (parted) q Information: You may need to update /etc/fstab.
With the partition table and the partition created, the disk is ready to be used after the partition is formatted with the file-system of choice. As an alternative, an LVM could be created on the disk as well.
Read more of my posts on my blog at https://blog.tinned-software.net/.