LVM (Logical Volume Management) is a very important tool to have in the toolkit of a MySQL DBA. It allows you to create and extend logical volumes on the fly. This allows me to, say, add another disk and extend a partition effortlessly. The other very important feature is the ability to take snapshots, that you can then use for backups. All in all its a must have tool. Hence, this guide will allow you to understand various terminologies associated with LVM, together with setting up LVM volumes and in a later part will also show you how to extend...
So last night I had to resized one of my Xen partitions. So what
was the magic to make this happen?
dd if=/dev/zero count= >>
/var/lib/xen/images/shiitake.dsk
Then? I need to increase the partition map for my disk:
fdisk /dev/xvda
What did I do in fdisk? I deleted the partition, and then
recreated it with the new available blocks. Of course the machine
was running at the time. What is life without a few risks? But I
have to ask myself, why doesn't fdisk have a resize command? I
swear that tool hasn't changed in well over a decade.
I am running LVM so then I had to:
pvresize /dev/xvda2
lvresize -L +5G /dev/VolGroup00/LogVol00
And finally since the filesystem is ext3:
e2fsck -f /dev/mapper/VolGroup00-LogVol00
resize2fs /dev/mapper/VolGroup00-LogVol00
…