Extend disk in AL centreon IT 100 free edition

Hello
I’m new with almalinux and with Linux generally. Sorry for that, but it’s never to late for learning :slight_smile:
I downloaded Centreon IT 100 with Almalinux 9 OS
I wanted to extend disk because default size of the disk is 20 Gb, and then I modified settings with more CPU and more disk space. I know that MariaDB will quickly grows up that’s why I already created a disk with 90 GB size.
But, i don’t know how to attribute this free space and extend this space to a special part :

[root@localhost /]# fdisk -l
Disque /dev/sda : 90 GiB, 96636764160 octets, 188743680 secteurs
Unités : secteur de 1 × 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d’E/S (minimale / optimale) : 512 octets / 512 octets
Type d’étiquette de disque : dos
Identifiant de disque : 0xb3991996

Périphérique Amorçage Début Fin Secteurs Taille Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 41943039 39843840 19G 8e LVM Linux

Disque /dev/mapper/almalinux-root : 17 GiB, 18249416704 octets, 35643392 secteurs
Unités : secteur de 1 × 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d’E/S (minimale / optimale) : 512 octets / 512 octets

Disque /dev/mapper/almalinux-swap : 2 GiB, 2147483648 octets, 4194304 secteurs
Unités : secteur de 1 × 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d’E/S (minimale / optimale) : 512 octets / 512 octets

Actually, /dev/sda2 is 17 Gb, and I wanted to extend with the maximum free space :

[root@localhost /]# df -h
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
devtmpfs 1,8G 0 1,8G 0% /dev
tmpfs 1,8G 0 1,8G 0% /dev/shm
tmpfs 1,8G 17M 1,8G 1% /run
tmpfs 1,8G 0 1,8G 0% /sys/fs/cgroup
/dev/mapper/almalinux-root 17G 3,6G 14G 21% /
/dev/sda1 1014M 262M 753M 26% /boot
tmpfs 366M 0 366M 0% /run/user/0

[root@localhost /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 90G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part

  • ├─almalinux-root 253:0 0 17G 0 lvm /*
  • └─almalinux-swap 253:1 0 2G 0 lvm [SWAP]*
    sr0 11:0 1 1024M 0 rom

So, if you want to teach to a new beginner, a Almalinux rookie, I will be very grateful to you

Howdy lionel

I didn’t know about AL centreon IT 100 but it looks like you have an Almalinux 9 with lvm.

We need to use lvm commands in order to see the volumegroup and then see if we can expand the logical volume
https://www.man7.org/linux//man-pages/man8/lvm.8.html

we need to identify how much free space the host has by running

# Report information about Volume Groups.
vgs
#  Report information about Logical Volumes.
lvs

These commands are going to give us information about the lvm

Can you please reply with the output of that commands?

After it we can display information about the logical volume like:

# display all the LVs in "vg0"
lvdisplay vg0

Then we can use the lvextend command like this Managing LVM Logical Volumes on AlmaLinux 9 | Reintech media

redhat 9 lvm docs

Cheers

The “Centreon IT 100” seems to be software – “application” – and thus seems not related to the actual question.


One cannot change size of physical drive, so presumably the “disk” is a “volume” for virtual machine. That too is mostly not crucial.

What does count is that you had a “disk” (sda) with size 20 GB and you (on install of AlmaLinux) did set up “partitioning table” so that there are two partitions (sda1 and sda2) that cover the first 20 GB of “sectors” on the disk. The “expansion” has added more sectors to that disk.


In the below the man something is a command to read manual page of something.

First, the partition table has to be updated. There are two logical options:

  • Update the sda2 to cover 69 GB – all but what the sda1 uses. (man fdisk) If this is done, then the next step is to tell the LVM physical volume (PV) that it has 69 GB, not 19 GB, that it can use. (man pvresize). This increases the capacity of the VG (“almalinux”).
  • Leave sda2 as is and add third partition (wih fdisk), sda3, to cover the additional 50 GB.

If a separate sda3 partition is used, then there are again two options:

  • Create filesystem on the partition (man mkfs.xfs or man mkfs.ext4)
  • Create PV and add to the volume group (man pvcreate and man vgextend). This increases the capacity of the VG (“almalinux”).

If the capacity of VG was increased, then there are again two options:

  • Create new LV (man lvcreate) and then create filesystem into it
  • Resize the existing LV “almalinux-root” and then resize the filesystem in it. lvextend with option --resizefs will do both. (man lvextend)

If a new filesystem was added, either directly to sda3 or to new LV, then it has to be mounted somewhere. For example, the filesystem on sda1 is mounted to be seen as /boot – config for system to mount it is in file /etc/fstab


If I knew that MariaDB is the only user of space and the 50 GB will be enough , then I would have the separate filesystem and:

  1. Stop mariadb.service
  2. Mount new filesystem to temporary location. E.g. /mnt/maria
  3. Move everything from /var/lib/mysql/ to /mnt/maria/
  4. Umount /mnt/maria and mount filesystem to /var/lib/mysql
  5. Add entry to /etc/fstab
  6. restorecon -r /var/lib/mysql
  7. Start mariadb.service

This way I’d have a 50 GB /var/lib/mysql with files of the database in it.

The pro of separate filesystems is that they cannot fill up each other and each can be handled separately (for backups, reinstalls, etc).

The pro of one big filesystem is that one thing can use as much space as possible since there are no “arbitrary fences on the pasture”.


No matter what you do (or don’t), do make and keep backups that you know that you can restore from. Something can always go wrong.

Hi tulkki

thank you for the time you give me and here is the requested information :
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
almalinux 1 2 0 wz–n- <19,00g 0
[root@localhost ~]#
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root almalinux -wi-ao---- <17,00g
swap almalinux -wi-ao---- 2,00g
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# lvdisplay almalinux
— Logical volume —
LV Path /dev/almalinux/swap
LV Name swap
VG Name almalinux
LV UUID MtVX3B-s2R9-RZgq-Kff9-TZ9m-5Ddx-ufeB6H
LV Write Access read/write
LV Creation host, time ip-10-0-2-15.eu-west-1.compute.internal, 2023-12-04 14:52:37 +0100
LV Status available

open 2

LV Size 2,00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto

  • currently set to 8192
    Block device 253:1

— Logical volume —
LV Path /dev/almalinux/root
LV Name root
VG Name almalinux
LV UUID WgCSg2-ZHCo-fkhe-9pBl-SJ73-5HlZ-qxJrRM
LV Write Access read/write
LV Creation host, time ip-10-0-2-15.eu-west-1.compute.internal, 2023-12-04 14:52:37 +0100
LV Status available

open 1

LV Size <17,00 GiB
Current LE 4351
Segments 1
Allocation inherit
Read ahead sectors auto

  • currently set to 8192
    Block device 253:0

I’m going to check the link you gave me to learn a little more

Regards :slight_smile:

Looks like you want to increase the size of the partition /dev/sda2 and then increase the lvm physical volume so the volume group contain more space. If that is the case:

dnf -y install cloud-utils-growpart gdisk
growpart /dev/sda 2
pvresize /dev/sda2

Thank you all
All your help has enabled the solution
with all your recommandations, this is what i did :

dnf -y install cloud-utils-growpart gdisk
growpart /dev/sda 2
pvresize /dev/sda2
lvextend --size +30G --resizefs /dev/almalinux/root

and now what i see :
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 90G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 89G 0 part
├─almalinux-root 253:0 0 47G 0 lvm /
└─almalinux-swap 253:1 0 2G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom

so glad it works !

You’re now my best friends :smile:

1 Like