How to Expand the MySQL Partition Size from the Console

To use the console to expand the size of the partition used for MySQL operations, enter the following commands as root:
  1. (Optional) View the amount of free disk space available.
    [root@localhost cpn_service]# df -h
  2. Signal to the OS that there has been a hardware change to the disk.
    [root@localhost cpn_service]# echo ‘1’ > /sys/class/scsi_disk/2\:0\:1\:0/device/
    rescan
  3. Expand the physical volume.
    [root@localhost cpn_service]# pvresize /dev/sdb -v
  4. Extend the size of the logical volume for MySQL operations. This example shows that we areextending the size of the logical volume by adding 25GB.
    [root@localhost cpn_service]# lvextend -L +25G /dev/mapper/application_vg-mysql
  5. Resize the file system. This writes your changes to disk and completes the partition expansion process.
    [root@localhost cpn_service]# resize2fs /dev/mapper/application_vg-mysql
  6. Verify the amount of free disk space available.
    [root@localhost cpn_service]# df -h
The output should indicate the increased partition size.