Ad Widget

Collapse

Expand /var/lib/mysql - Newby

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bchapple
    Junior Member
    • May 2021
    • 2

    #1

    Expand /var/lib/mysql - Newby

    Love Zabbix but totally a rookie at Linux commands.
    My MySql is nearly out of space. It is a virtual machine so I have already expanded the disk but being a Windows person, I don't know the command to expand the partition to use the new space.

    It is on dev/sda5

    I read that i can use fdisk, record the starting sector, delete the partition and recreate it and just specify the starting sector again. Just really nervous about loosing data.

    Can anyone guide me through this or perhaps I should just create a new partition, stop Mysql, copy all the files to the new partiton....I really don't know.

    Please help.

    Click image for larger version

Name:	zabbix.jpg
Views:	5761
Size:	47.9 KB
ID:	437865
    Last edited by bchapple; 07-01-2022, 19:50.
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Are you using one of the Zabbix VM images downloaded from www.zabbix.com, or is this a VM you created? I assume it came from www.zabbix.com, but it's probably important to be certain about that.

    Over the years, the Zabbix VMs have used different Linux distros as the OS, so if you downloaded this from www.zabbix.com, can you also specify what Linux distro and version it's using?

    You may want to review this thread: https://www.zabbix.com/forum/zabbix-...ing-login-page

    Read through the full thread, as there were some false starts part way through, caused in part by me not realizing that both the underlying distro had changed and the more recent VM had discontinued the user of the LVM volume manager.

    If there's parts of the process outlined there that you don't understand or that are proving to be different from your situation, go ahead and post in this thread.

    Comment

    • Mindsvirge
      Junior Member
      • Nov 2023
      • 1

      #3
      How to increase Zabbix appliance DB disk space | by Elier Herrera | Medium

      I take no credit for this, instructions worked well for me, not loss of data


      Zabbix appliances come with 4.5GB of space allocated for the database. That might be too small for production. Follow these steps to increase DB disk space.

      IMPORTANT: Backup your data before you start! Or if you are running a VM make a copy of it!

      In this example I’m using the VMWare appliance, but the overall steps should be the same for the others.
      1. Shutdown the Zabbix appliance.
      2. Increase the size of the disk in VMware:
      • In your VMware vSphere or VMware Workstation application, find your Zabbix VM.
      • Right-click on the VM and select “Settings” or “Edit Settings”.
      • In the Hardware tab, go to Hard Disks
      • Provisioned size as needed (example 30GB), then click OK.

      3. Resize the partition
      • Boot up your Zabbix VM and SSH into it.

      I’ll use fdisk to delete and recreate the partition with the new size.
      • Start fdisk in interactive mode by running:
      sudo fdisk /dev/sda
      • Type the letter P to print the partition table and take note of the starting sector for /dev/sda4 and /dev/sda5 partitions.

      Example output (might be different for your Zabbix appliance):
      • Type the letter D, then 5 to delete the existing /dev/sda5 partition.
      • Type D, then 4 to delete the existing /dev/sda4 (extended partition).
      • Type N, then E (for extended), then 4 for the partition number, and use the start sector of the old /dev/sda4 partition.
      • For the last sector, just press Enter to accept the default, which should be the end of the available space.
      • Now, type N, then L, (for logical).
      • The first sector should be the start sector of the old /dev/sda5.
      • Again, for the last sector, just press Enter to accept the default, which should be the end of the available space.
      ​​
      • If you see a prompt asking to remove an existing signature, enter N for No, otherwise existing data will be wiped.
      • Type W to write changes to the disk.

      4. Reboot machine:
      sudo reboot

      5. Resize the filesystem:
      • After the machine reboots, use xfs_growfs to resize the filesystem.
      sudo xfs_growfs /var/lib/mysql

      6. Verify the changes:
      • Finally, verify that the filesystem has been resized correctly with:
      df -h

      You should see now that the partition /dev/sda5 has more available disk space (depending on how much you allocated in the VM settings):

      Comment


      • jimpazdera
        jimpazdera commented
        Editing a comment
        Mindsvirge - Thanks a bunch - your steps worked great for increasing /dev/sda5 from 4.5GB to 70GB
    • ArjanVL
      Junior Member
      • Jul 2024
      • 1

      #4
      Awesome! Ran into this issue with the downloaded v7 ... the /var/lib/mysql partition was just 4.5Gb in size... after adding some network devices, it quickly grew.

      Additionally to the resize for the /dev/sda5 (/dev/vda5) partiton for the AlmaLinux release 8.9, you do not have the option to select L for logical, but it will go straight to the partition size and ask if the XFS mark should be removed. Replied with N(o) to this, the a grow of the partition after the reboot and we were golden!
      Thanks

      Comment

      • WebGreg
        Member
        • Feb 2021
        • 49

        #5
        @Mindsvirge Space added, thank You. Unfortunately, I was at the stage when there was no space left and maybe that's the reason why it's not fully working now.
        When I go to Monitoring > Hosts > Graphs > I only see "No data found". But when I go to Hosts > Latest data > Graph > here, the graphs display correctly.

        Solved. I deleted the user. After re-creating, the date is displayed.​



        Last edited by WebGreg; 21-02-2025, 20:41.

        Comment

        Working...