2

I hope someone can help me here. I have below partition in my CentOS 8 which is a VM hosted in hyper-v 2012.

[root@appliance ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G  8.5M  3.9G   1% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2       4.0G  997M  3.1G  25% /
/dev/sda1       488M   80M  373M  18% /boot
/dev/sda3      1014M   40M  975M   4% /tmp
/dev/sda5       4.5G  4.5G   20K 100% /var/lib/mysql
tmpfs           787M     0  787M   0% /run/user/0

MYSQL has stopped due to disk being 100% full. I have added more storage to the virtual disk through hyper-v. Have extended it to 30GB.

[root@appliance ~]# parted -l /dev/sda
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  538MB   537MB   primary   ext4         boot
 2      538MB   4833MB  4295MB  primary   xfs
 3      4833MB  5907MB  1074MB  primary   xfs
 4      5907MB  10.7GB  4831MB  extended
 5      5908MB  10.7GB  4830MB  logical   xfs

However I'm not too sure how to extend MYSQL partition to give to give additional space which I have added to the disk. I have tried following few articles online, but I have not had any success so far. Greatly appreciate if someone can help me out here.

fdisk-l output also below.

[root@appliance ~]# fdisk -l
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf8386911

Device     Boot    Start      End Sectors  Size Id Type
/dev/sda1  *        2048  1050623 1048576  512M 83 Linux
/dev/sda2        1050624  9439231 8388608    4G 83 Linux
/dev/sda3        9439232 11536383 2097152    1G 83 Linux
/dev/sda4       11536384 20971519 9435136  4.5G  5 Extended
/dev/sda5       11538432 20971519 9433088  4.5G 83 Linux

Thank you.

PGP
  • 21
  • 1
  • 2
  • 1
    First make a backup. Then increase the extended partition sda4 first, once that is done you can increase the logical partition sda5 and extend the file system there. – Bob Nov 30 '20 at 08:02
  • And if you ever find the person who made this bizarre partitioning scheme, ask them what they were thinking. – Michael Hampton Nov 30 '20 at 12:50
  • @hermanb is below what I need to do? `- start fdisk /dev/sda u (don't mind the depricated warning) n p (leave all the questions to default answer) w REBOOT pvcreate /dev/sda4 vgextend zabbix-vg /dev/sda4 lvextend -l 100%FREE /dev/sda5 resize2fs /dev/sda5 ` – PGP Nov 30 '20 at 21:25
  • @MichaelHampton this is the zabbix appliance, not sure why the partition was done in such a way :(. – PGP Nov 30 '20 at 21:27
  • I have been trying to follow this guide mainly but no luck :( https://www.zabbix.com/forum/zabbix-help/46027-increasing-available-diskspace-zabbix-3-0-appliance-in-hyper-v-2008 – PGP Nov 30 '20 at 21:28

1 Answers1

0

First and foremost take a backup, or snapshot, the vm before making any changes as any partition modifications always have a chance of doing bad things to the disk.

What you're looking for is growpart. growpart /dev/sda 4 to fill the remainder of the disk and then increase the size of sda5 by the same command (growpart /dev/sda 5) if you want it to fill all of sda4.

If you only want it to fill a portion of sda4 then use parted resizepart number end. Number is partition number and end is final, larger, partition size.

Once you have sda5's partition expanded, you'll want to increase the filesystem size with xfs_growfs /var/lib/mysql

Logan
  • 136
  • 3