When you increase the size of a an existing block device (eg /dev/sdc was given 20 gigs from vmware, now it has been increased to 40 gigs), you need to do some work for LVM to use the space. All the guides I've seen (1, 2, 3) suggest deleting the existing partition and recreate it with the extra space added on to the end, then run pvresize.
Instead of resizing /dev/sdc1 then running pvresize /dev/sdc1
, you could also create /dev/sdc2 and run pvcreate /dev/sdc2
and add it to the VG.
Is there a technical or performance reason why resizing is better than adding a new partition or is resizing just the way its always been done?
Best Answer
Summary: From a purely technical standpoint, it doesn't make much difference, but resizing is better. Once you add in practical aspects, adding a new partition is a clear winner.
From a strictly technical standpoint, new PVs have a few downsides:
From a practical standpoint, none of those matter for any reasonable number of PVs. The extra copies of the metadata matter first, but there is an LVM option to keep fewer copies (VG
--metadatacopies
or PV--metadataignore
).Further, continuing the practical standpoint, deleting and recreating a partition is much more likely to suffer from admin error (typo, etc.) than creating a new partition due to better tools for the latter. And any admin errors that occur are likely to be much more destructive for resizing (because your data is on the resized partition, but there is no data on a new partition). This is even worse when you have multiple layers; e.g., mdraid below LVM. Depending on your
-e
option, the superblocks can be at the end of the array—fun when you resize a partition.There is one exception that comes to mind: if for whatever reason you can't create a new partition. For example, maybe you're using DOS partition tables, and you already used all four primary partitions (without creating an extended partition). Then you don't have a choice.