One of the most common tasks that I have been performing lately is disk resize, especially in environment which have not been planned well and taking the application into account.
This was the procedure I performed the other day when an incident was raised.
Find the problem.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
db01 ~ # df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-lvolroot 5.0G 2.1G 2.7G 45% / tmpfs 16G 0 16G 0% /dev/shm /dev/sda1 504M 82M 397M 18% /boot /dev/mapper/VolGroup00-lvolhome 504M 17M 462M 4% /home /dev/mapper/VolGroup00-lvolvar 1008M 483M 474M 51% /var tmpfs 16G 84M 16G 1% /tmp /dev/mapper/VolGroup00-lvol 119G 49G 64G 44% /srv/mysql/ /dev/mapper/VolGroup00-lvol--binlog 9.9G 9.4G 17M 100% /srv/mysql/binlogs/ |
Find out if LVM and the volume group has available space.
1 2 3 |
db01 ~ # vgs VG #PV #LV #SN Attr VSize VFree VolGroup00 1 6 0 wz--n- 199.50g 62.00g |
Confirm the logical volume name.
1 2 3 4 5 6 7 8 |
db01 ~ # lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert lvol VolGroup00 -wi-ao---- 120.00g lvol-binlog VolGroup00 -wi-ao---- 10.00g lvolhome VolGroup00 -wi-ao---- 512.00m lvolroot VolGroup00 -wi-ao---- 5.00g lvolswp VolGroup00 -wi-ao---- 1.00g lvolvar VolGroup00 -wi-ao---- 1.00g |
Issue the command to extend.
1 2 3 |
db01 ~ # lvextend -L20G /dev/mapper/VolGroup00-lvol--binlog Extending logical volume lvol-binlog to 20.00 GiB Logical volume lvol-binlog successfully resized |
Issue the command to resize the file system.
1 |
db01 ~ # resize2fs /dev/mapper/VolGroup00-lvol--binlog resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/VolGroup00-lvol--binlog is mounted on /srv/mysql/binlogs; on-line resizing required old desc_blocks = 1, new_desc_blocks = 2 Performing an on-line resize of /dev/mapper/VolGroup00-lvol--binlog to 5242880 (4k) blocks. The filesystem on /dev/mapper/VolGroup00-lvol--binlog is now 5242880 blocks long. |
Confirmation it has taken affect.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
db01 ~ # df -lh Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-lvolroot 5.0G 2.1G 2.7G 45% / tmpfs 16G 0 16G 0% /dev/shm /dev/sda1 504M 82M 397M 18% /boot /dev/mapper/VolGroup00-lvolhome 504M 17M 462M 4% /home /dev/mapper/VolGroup00-lvolvar 1008M 483M 474M 51% /var tmpfs 16G 84M 16G 1% /tmp /dev/mapper/VolGroup00-lvol 119G 49G 64G 44% /srv/mysql/ /dev/mapper/VolGroup00-lvol--binlog 20G 9.4G 9.4G 50% /srv/mysql/binlogs |