FortiSIEM
FortiSIEM provides Security Information and Event Management (SIEM) and User and Entity Behavior Analytics (UEBA)
alaxkar
Staff
Staff
Article Id 391150
Description

This article describes Logical Volume Manager, a tool in Linux that provides a more flexible and powerful way to manage disk storage compared to traditional partitioning methods.

With LVM, this can create logical volumes that span across multiple physical disks, allowing for easier resizing and management of disk space. Here are the basic concepts and how LVM works.

Scope FortiSIEM.
Solution

To create an LVM disk, follow these steps:

 

Step 1: Add a new disk to the server and rescan the SCSI subsystem for new or removed devices without the server reboot.

 

fdisk -l |grep Disk
bash -c 'echo "- - -" > /sys/class/scsi_host/host0/scan'
fdisk -l |grep Disk

 

scan-disk.png

 

 

Step 2: Declare the required variable and create an LVM partition.

 

export DISK=/dev/sdb  <----- Replace this disk with the newly added disk.

fdisk -u $DISK

fdisk -l $DISK

 

03-partition.jpg

 

Step 3: Now that the disk is ready, it is necessary to create a physical volume with pvcreate.

 

export DISK=${DISK}1

echo ${DISK} <----- Verify that the new disk in the output is accurate.

pvcreate -tvd $DISK

pvcreate -vd $DISK

pvdisplay -C

 

04-pvcreate.jpg

 

Step 4: Create a Volume Group (VG) from the newly added PV disk.

 

vgcreate vg-name $DISK

vgs  <----- To confirm the created VG.

 

Step 5: Create the logical volume with lvcreate.

 

lvcreate --name lv-name -l 100%FREE vg-name <----- Here, 100% of it has been allocated. 

lvs  <----- To confirm the created LV.

 

Step 6: The final step to prepare the new logical volume (LV) for use is to format it.

 

For ext format:

 

resize2fs /dev/vg-name/lv-name <----- i.e. Run this command to resize if the partition is in an EXT4 filesystem.

 

For XFS format:

 

xfs_growfs /dev/vg-name/lv-name <----- i.e. Run this command to resize if the partition is in the XFS filesystem.

 

Step 7: Mount the LVM partition on the /data directory.

                   

mkdir /data

mount /dev/vg-name/lv-name /data

 

Verify with the following command:

 

df -hT /data <----- To verify the final mount.

 

Verify /etc/fstab Configuration.

 

After resizing and mounting the LVM partition, open the /etc/fstab file to ensure that the logical volume is correctly listed. This ensures it will mount automatically on system boot.

 

cat /etc/fstab


/dev/mapper/vgname-lvname /data xfs defaults 0 0


Look for the relevant line mentioned above and confirm that the mount point, device path (e.g., `/dev/mapper/vgname-lvname`), file system type, and options are correct.