Installing CentOS/RedHat on disks larger than 2Tb
So you have a new server that has a lot of disk! The classic example is you have a server with 8 x 1Tb drives or something similar and you do not want to be restricted to using only 2Tb of disk, as dictated by the default MSDOS disk label. You've set up a RAID-5 or 6 array using these drives and want to use all the available space. You may read things about using EFI instead of BIOS, but that can be a massive hassle. The easier way to get this happening is to use a Guid Partition Table (GPT) disk label. This will allow you to have partitions greater than 2Tb without having to change from using BIOS to EFI. This is CentOS 6 specific as CentOS 5 does not support booting off GPT partitions! The method I describe here is a little fiddly, but it works. You will need a GParted Live CD and a Kickstart server.
1. Download the GParted ISO image and boot off it.
NOTE: If you don't want to use the GParted ISO, then use any Live CD that has parted on it.
2. If there are no existing partitions go to step 3. If there are any partitions, delete them using either the GUI or the following commands:
a. List the current partitions:
sudo bash parted /dev/sda print
Output will look something like:
Disk /dev/sda: 6998GB Sector size (logocal/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 525MB 524MB ext4 boot 2 525MB 6998GB 6997GB lvm
b. Delete the partitions you saw in the output of the previous command
parted /dev/sda rm 1 parted /dev/sda rm 2
You may get the following error:
Error: Partitions(s) 1 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. Ignore/Cancel?
It is safe to ignore this error and keep going!
3. Now use parted to change the disk label to GPT
sudo parted -s /dev/sda mklabel gpt
You may get the same error as in step 2b, but again, keep going!
4. Reboot the machine and begin the Kickstart install. Your Kickstart file should have something like this for the disk layout:
ignoredisk --only-use=sda clearpart --linux --drives=sda part /boot --fstype=ext4 --size=500 part pv.pv1 --grow --size=1 volgroup vg1 --pesize=4096 pv.pv1 logvol /data --fstype=ext4 --name=data --vgname=vg1 --size=6498824 logvol /home --fstype=ext4 --name=home --vgname=vg1 --size=40960 logvol / --fstype=ext4 --name=root --vgname=vg1 --size=51200 logvol swap --name=swap --vgname=vg1 --size=20480 logvol /usr --fstype=ext4 --name=usr --vgname=vg1 --size=20480 logvol /var --fstype=ext4 --name=var --vgname=vg1 --size=40960 bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
NOTE: The following lines should NOT be in your Kickstart file:
zerombr clearpart --all --initlabel
This will destroy the disk label and put an msdos label back in place!
That's basically it. Kickstart should now work and will use all the available space.