Online Tutorials & Training Materials | STechies.com
Register Login

Linux LVM Interview Questions and Answers

|| 0

Linux LVM Interview Questions and Answers
Stechies

What is LVM and its full form?

The LVM stands for Logical Volume Manager and it is used for providing logical volume management for the LINUX kernel. It allows more flexibility in managing the disk storage.

Why we use LVM in Linux?

In LINUX, the LVM is used for partitioning the hard disks storage spaces for improving the efficiency of storage rather than traditional partitioning. The system administrators use the method to manage the different storage requirements of multiple users.

Through the device mapper in the LINUX kernel, the storage devices can be grouped and logical units can be allocated from that combined space.

What are the benefits of LVM?

The benefits of LVM are:

  • Better management of the available storage space.
  • More control over the storage units.
  • The logical volumes of memory can be resized according to the requirements in space.
  • These volumes can be distributed among the physical devices.
  • It provides advanced features like mirroring, snapshotting and stripping.

What is encrypted LVM?

During the formatting process of the LVM volume, there are two options to choose from – encrypted LVM or not encrypted LVM. The encrypted LVM is used for securing the data in the hard drive or solid state drive.

While using encrypted LVM partition, the encryption key is stored in the RAM. It is advised that a backup password is used during this process in case the original password is lost.

Why create an LVM partition?

The LVM partitions are created as they have the following advantages:

  • Multiple disks can be grouped as one single disk.
  • The logical storage volumes are distributed over many disks.
  • The volumes can be resized irrespective of their order.
  • Small volumes can be developed which can be resized dynamically.
  • All the creation, resizing, deletion of the logical volumes can be easily done online.

How many LVM partitions are allowed?

As per the MBR constraints, the maximum primary partitions can be 4. If more partitions are required, then 3 primary and 1 extended partition has to be created. Multiple logical partitions can be created inside the logical partition.

How to extend LVM partition in Linux?

An LVM partition in LINUX can be extended by the following steps:

  • Type in the df -h command for listing the file system.
  • After that, the available or free space in the Volume group has to be checked.
  • To increase the size of the partition, use the lvextend command
  • Execute the resize2fs command
  • To verify the /home size use the df command.

What must be done before LVM-based replication can take place between a source and remote volume?

Before an LVM-based replication can take place between a source and remote volume, an initial synchronization process has to be performed.

How to extend filesystem in Linux LVM?

To extend the Linux file system the logical volume or partition has to be extended first.

The steps are as follows:

  • For ext2/ext3/ext4 based file systems use the command resize2fs /dev/centos/var.
  • For xfs based file systems use the command xfs_growfs /dev/centos/var.
  • For Reiserfs file systems use the command resize_reiserfs -f /dev/vg01/lvol1.

What is a physical extent in LVM?

In LVM, the physical extent is the block size that is being used by the physical volumes. This extent can start from 8kB and go up to 16GB  but the default extent is 4MB. To create a  volume group, the physical extents of the physical volume have to be clubbed together into a logical volume.

What is LVM mirroring?

LVM mirroring lets the user allocate multiple copies of a particular physical partition to make the data more available. In case the disk crashes and the physical partitions are not functioning properly, the mirrored data on the disk can be used. The mirroring is carried out inside the logical volume.  

The following can be mirrored within a mirror cluster:

  • Logical volume data
  • Logical volume log every shared volume group

What is the difference between pvmove and LVM mirroring?

Pvmove is a command that is used to move physical extents to different physical volumes. If the pvmove is interrupted during execution, it can be run again with no PhysicalVolume arguments. The command works by creating a temporary pvmove Logical Volume for storing the required data movements.

LVM mirroring lets the user allocate multiple copies of a particular physical partition to make the data more available. In case the disk crashes and the physical partitions are not functioning properly, the mirrored data on the disk can be used.

What is Red hat LVM?

The Red Hat Device Mapper supports udev integration. This will synchronize the Device Mapper with LVM devices. LVM provides an additional layer between the file system and the physical disk so that the file systems are resized and moved easily.

Red Hat provides logical volume management for the LINUX kernel. It allows more flexibility in managing the disk storage.

How to use unused LVM space?

If there is free space in the LVM partition, it can be used to store more data by expanding the storage pool. This can be done by formatting another storage drive to add more space.

How to convert LVM to excel?

An LVM file can be converted into an excel file by opening it in MS Excel by selecting the file type as All Files. Excel will import it as text and open it. Using the default tab separator settings, the process can be completed by hitting the Finish button.

What is Kubuntu LVM?

Kubuntu is a version of the popular operating system Ubuntu that uses a KDE Plasma Desktop and uses the same repositories that Ubuntu uses. LVM partitions can be created using the KDE Partition Manager in Kubuntu.

How can we list the available physical volumes in LVM?

All the physical volumes can be listed in LVM using the pvscan command. This command scans all the LVM devices for locating physical volumes. Alternatively, the physical volumes for a particular volume group can be seen by using the following command:

# pvdisplay -C --separator '  |  ' -o pv_name,vg_name

What is the difference between LVM and RAID?

The differences between LVM and RAID are given below:

LVM

RAID

LVM provides an additional layer between the file system and the physical disk so that the file systems are resized and moved easily.

RAID is a method of creating a logical representation of a device in the Operating System by physically grouping disk devices      

It is used for partitioning the hard disks logically for managing the data.

It is used for redundancy and improving the system’s performance.

It is situated on top of RAID for creating blocks by partitioning.

It can be used to create striped or physical block devices by utilizing other block devices.

It manages a pool of devices by grouping them together as a single storage resource.

It cannot do pool storage resources.

It can be used for backing up data.

It is not a very good data backup solution.

How to recover deleted LVM in linux?

The steps to recover deleted LVM in Linux are:

  • The archive file under the /etc/lvm/archive has to be verified.
  • Perform dry run using the –test command.
  • If it is successful, perform the restore using the vgcfgrestore command on the deleted volume.
  • Use lvscan to ensure restoration is successful.
  • Activate the logical volume for accessing it.
  • Mount the volume and check whether the data is intact.


Related Articles