Occasionally you will have the need to use physical volumes which exceed the limits of the standard DOS partitioning scheme. When you run into this a quick fdisk -l will reveal that you will need a new way to partition your disks.
Fdisk will produce output similar to this…
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.</p> <p>WARNING: The size of this disk is 2.3 TB (2290828181504 bytes).<br /> DOS partition table format can not be used on drives for volumes<br /> larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID<br /> partition table format (GPT).
Use Parted to Create a Partition Using the Whole Disk
Parted is able to handle large volumes which are not able to be modified with fdisk. Here we are going to launch parted, and then create the partition with a size of 1 -1 which means that it will use it all until it gets to the end. You can additionally specify the number in megabytes, so 1 1024 would start at 1 and go until 1024 giving you a 1GB partition.
# parted /dev/sdb<br /> (parted) mkpart primary ext3 1 -1
Review the created partition.
(parted) print</p> <p>Model: DELL PERC H700 (scsi)<br /> Disk /dev/sdb: 2291GB<br /> Sector size (logical/physical): 512B/512B<br /> Partition Table: gpt</p> <p>Number Start End Size File system Name Flags<br /> 1 17.4kB 2291GB 2291GB primary
Set the LVM flag.
(parted) set 1 lvm on
Review our changes to our partition.
(parted) print</p> <p>Model: DELL PERC H700 (scsi)<br /> Disk /dev/sdb: 2291GB<br /> Sector size (logical/physical): 512B/512B<br /> Partition Table: gpt</p> <p>Number Start End Size File system Name Flags<br /> 1 17.4kB 2291GB 2291GB primary lvm<br /> (parted) quit
Initialize the Physical Volume for LVM
The rest of this is pretty standard, and already covered in my article Linux LVM2: Flexible Local Storage Management in case you’d like more details.
# pvcreate /dev/sdb1<br /> Physical volume "/dev/sdb1" successfully created
Create the LVM Volume Group
# vgcreate VolGroup01 /dev/sdb1<br /> Volume group "VolGroup01" successfully created<br /> # vgs<br /> VG #PV #LV #SN Attr VSize VFree<br /> VolGroup00 1 2 0 wz--n- 99.88G 0<br /> VolGroup01 1 0 0 wz--n- 2.08T 2.08T
Well now we have a Volume Group (VolGroup01) which can be used to create Logical Volumes from.