12

We have a poorly implemented mysql server that had been built by a vendor. It has consumed 100% of available disk space, and as soon as any space is cleared out mysql grows to consume it. This is, obviously, a problem.

We currently have 2 disks in a raid 1+0, and just added 2 additional. We have added them directly to the RAID, so disk size should be essentially double what it was previously.

Pvresize would be our next step, but it only seems to facilitate growing to specific numbers (pvresize --setphysicalvolumesize 20G /path/to/disk).

Is there an equivalent command that lets you specify to expand to all physical space on the disk (or in this case, the array)?

1
  • 5
    The --setphysicalvolumesize is used when you want to shrink a pv. Omitting it entirely (pvresize /path/to/disk) should extend it. If it doesn't, I'd suggest looking at dmesg and fdisk/parted to verify the space you added is actually there before continuing.
    – user143703
    May 15 '15 at 16:54
15

As yoonix pointed out in the comment, the pvresize without options resizes physical volume to the size the operating system reports for the underlying partition.

pvresize /dev/sdXY

--setphysicalvolumesize option can be used to shrink the physical volume or to override the operating system autodetected size (if for some reason is wrong).

To extend a logical volume to full available capacity you have to pass to lvextend explicit option:

lvextend -l +100%FREE /dev/VGNAME/LVNAME
2
  • I used this command on my centos box with 2 partitions: sudo lvextend -v -r -l +100%FREE /dev/centos/root. -v will give a great verbose output.
    – user674669
    Jun 18 '20 at 18:32
  • The answer was very helpful :D Dec 11 '20 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.