2

I have a CentOS 7 server. I have extended a LV a few times like so:

fdisk /dev/sdd
pvcreate /dev/sdd1
vgextend pg_data /dev/sdd1
lvextend /dev/pg_data/lvol0 /dev/sdd1
xfs_growfs /dev/pg_data/lvol0

My question is, how many times can one extend a logical volume this way?

1
  • I suggest using lextend -r which would take care of FS resize. This does the resizing in correct order except it does not handle encrypted devices (yet) and is the best way to avoid problems after resize was done in wrong order as seen many times.
    – Martian
    Jun 21, 2016 at 9:12

2 Answers 2

3

The upper bound for LV size in LVM2 format volumes (assuming 64-bit arch, 2.6+ kernel) is 8 exabytes. You're not in danger of hitting that. There is also no practical limit on the number of physical volumes you can have backing a volume group or logical volume. You should be able to extend your VG and LV as many times as you want. (The original LVM format was limited in that it supported a maximum of 65534 physical extents to an LV, the default size of which was 4MB but configurable on VG creation - this clearly placed a practical upper limit on LV size depending on what you set the PE size to.)

However I wouldn't recommend going so far in practice as LVM has no redundancy mechanism and you increase the risk of data loss the more potentially failing disks you include in the volume. If I were you (and assuming you've got disks of similar size) I would be making a RAID of those and then running LVM on top of it. Of course, if you don't care about losing the data or you've got other backups you're happy to recover from...

2

LVM2 does have another limit: meta data area (MDA) size, which can be set when creating physical volume (pvcreate --metadatasize). Default size is good for hundreds of PVs and LVs.

Also when having many PVs you might want to limit number of meta data copies. By default meta data are stored on each PV. Having many PVs with enabled MDA slows down lvm operations. 3 copies should be enough for everyone ;-). To disable MDA on a PV do either pvcreate --metadataignore y when creating one or later it can be changed using pvchange. LVM can do it automatically if vgmetadatacopies is set in lvm.conf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .