LVM Interview Questions
Q.What Is The Difference Between Lvm And Raid?
Ans: A RAID device is a physical grouping of disk devices in order to create a logical presentation of one device whereas LVM is a logical layer that that can be manipulated in order to create and, or expand a logical presentation of a disk device to an OS.
Q. Explain Lvm Snapshot?
Ans:LVM snapshots allow the administrator to create a new block device which presents an exact copy of a logical volume, frozen at some point in time.
Q. How You Will Check On Your Server Or System Device-mapper Is Installed Or Not?
Ans:
Check the following file:
#cat /proc/misc
if this file contains “device-mapper” term it means device mapper is installed on your system.
Q. How Are Snapshots In Lvm2 Different From Lvm1?
Ans:
In LVM2 snapshots are read/write by default, whereas in LVM1, snapshots were read only.
Q. What Is The Maximum Size Of A Single Lv?
Ans:
For 2.4 based kernels, the maximum LV size is 2TB. For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB. For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB.
Q. If A Volume Group Named As Vgname Already Exists But We Need To Extend This Volume Group Up To 4gb. Explain All Steps?
Ans:
Firstly, create Physical volume (/dev/sdaX, where X is the partition number) of size 4GB.
Now run following command: # vgextend vgname /dev/sdaX
Q. If A Volume Group Vgname Have 3 Pv’s (/dev/sda5, /dev/sda6, /dev/sda7) But We Want To Remove /dev/sda7 Pv From This Vgname?
Ans:
# vgreduce vgname /dev/sda7
Q. Which Command Is Used To Extend A Logical Volume?
Ans:
# lvextend -size +<addsize> /dev/<vgname>/<lvname>
resize2fs /dev/<vgname>/<lvname>
Q. What Is The Partition Type Number For Swap, Raid And Lvm?
Ans:
SWAP (82), RAID (fd) and LVM (8e)
Q. How To Add A Disk To A Volume Group?
Ans:
suppose disk is /dev/sdb
# pvcreate /dev/sdb
# vgextend <vgname> /dev/sdb
Q. How To Remove A Disk From A Volume Group?
Ans:
Syntax:
# vgreduce <vgname> <disk>
Example:
# vgreduce vgname /dev/sdb
Q. How To Backup New Lvm Data Structures?
Ans:
# vgcfgbackup /dev/vgname
Q. Is It Possible To Increase The Logical Volume On Fly?
Ans:
Yes. LVM has the feature to increase the volume without unmount it.
Q. How To Reduce The Logical Volume? Is It Possible To Reduce On Fly?
Ans:
No. we can't reduce the logical volume on fly. Here is the steps to reduce the logical volume.
Un-mount the filesystem
Run e2fsck on the volume device
Reduce the Filesystem using resize2fs
Reduce the logical Volume using lvreduce
Mount the filesystem back for production.
Q. How Do You Scan The New Lun Or Disk?
Ans:
Use "echo 1 > /sys/class/scsi_host/hostx/scan" to scan disk from newly connected SAN or DISKS and also replace the "x" with number of host id present under /sys/class/scsi_host/.
Q. How To Scan Disks For Existing Volume Group?
Ans:
Use "vgscan" to scan existing volume group from newly connected SAN or DISKS.
But we should use "pvscan" prior to executing this command.
Q. How To Scan A Logical Volume From Exising Volume Group?
Ans: lvscan
Q. How To Stop The Logical Volume? Or Deactivate The Logical Volume?
Ans: "lvchange -an /dev/vg_name/lv_name"
Q. How To Activate The Logical Volume Which Is In Deactivated State?
Ans: "lvchange -ay /dev/vg_name/lv_name".
Q. How To Disable The Volume Group? Or Deactivate The Volume Group?
Ans: "vgchange -an volume_group_name".
Q. How To Enable The Volume Group? Or Activate The Volume Group?
Ans: "vgchange -ay volume_group_name" .
Q. How Do You Find That What Are The Disks Are Used For Logical Volume Mirroring?
Ans: use "lvs -a -o +devices"
Q. What Are Steps To Perform In Order To Increase The Logical Volume On Fly?
Ans:
Extend the logical volume
Increase the Filesystem size
Verify the status using df command or lvs command.
Q. How To List The Imported Volume Groups?
Ans:Use "vgs" command to display the imported volume group.
Q. How To Create Partition From The Raw Disk ?
Ans:
Using fdisk utility we can create partitions from the raw disk.Below are the steps to create partition from the raw dsik :
fdisk /dev/hd* (IDE) or /dev/sd* (SCSI)
Type n to create a new partition
After creating partition , type w command to write the changes to the partition table.
Q. What Does Sar Provides And At Which Location Sar Logs Are Stored ?
Ans:
Sar Collect, report, or save system activity information. The default version of the sar command (CPU utilization report) might be one of the first facilities the user runs to begin system activity investigation, because it monitors major system resources. If CPU utilization is near 100 percent (user + nice + system), the workload sampled is CPUbound.
By default log files of Sar command is located at /var/log/sa/sadd file, where the dd parameter indicates the current day.
Q. How To Reduce Or Shrink The Size Of Lvm Partition ?
Ans:
Below are the logical Steps to reduce size of LVM partition :
Umount the filesystem using umount command, use resize2fs command ,
e.g resiz2fs /dev/mapper/myvgmylv 10G Now use the lvreduce command ,
e.g lvreduce L 10G /dev/mapper/myvgmylv
Above Command will shrink the size & will make the filesystem size 10GB.
Q. How To Increase The Size Of Lvm Partition ?
Ans:
Below are the Logical Steps :
Use the lvextend command (lvextend L +100M /dev/<Name of the LVM Partition> , in this example we are extending the size by 100MB.
resize2fs /dev/<Name of the LVM Partition>
check the size of partition using ‘df h’ command
Q. Why Lvm Is Required?
Ans:
LVM stands for Logical Volume Manager , to resize filesystem's size online we required LVM partition in Linux. Size of LVM partition can be extended and reduced using the lvextend & lvreduce commands respectively.
Q. How To Create Partition From The Raw Disk?
Ans:
Using fdisk utility we can create partitions from the raw disk.Below are the steps to create partition from the raw disk :
fdisk /dev/hd* (IDE) or /dev/sd* (SCSI)
Type n to create a new partition
After creating partition , type w command to write the changes to the partition table.
Q. How To Decommission/remove Lvm Completely From The Host?
Ans:
Un-mount all the logical filesystems
Remove the logical volumes using "lvremove" command.
Destroy the volume group using "vgremove" command.
Use "pvremove" command remove the physical volumes from the system.
Q. If The Vg02 Has Two Physical Volumes Called /dev/sdc/ & /dev/sdd. How Do You Remove /dev/sdd From Vg02?
Ans:
"vgreduce vg02 /dev/sdd/"
Q. Assume Volume Group "vg02" Is Already Exists. How Do You Extend The Volume Group With 50gb? Provide All The Steps With Commands?
Ans:
Get the 50GB lun from storage team.(/dev/sdd)
Create physcical volume ( # pvcreate /dev/sdd )
Extend the volume group (# vgextend vg02 /dev/sdd)
Q. How To Extent The Volume Group?
Ans:
Using "vgextend" we can increase the volume group.
Q. What Are The Steps Involved To Create The Logical Volume From Scratch?
Ans:
Create a physical volume using pvcreate command: #pvcreate /dev/sdc
Create a volume group using "vgcreate" command: #vgcreate vg02 /dev/sdc
Create a logical volume using "lvcreate" command: #lvcreate -L 100M -n vol1 vg02
Create a filesystem on logical volume using mkfs command: #mkfs -t ext4 /dev/vg02/vol1
Mount the filesystem using mount command for use: #mount -t ext4 /dev/vg02/vol1 /vol1
Q. How Are Snapshots In Lvm2 Different From Lvm1 In Redhat Linux?
Ans:LVM1 snapshots are readonly by default where LVM2 snapshots were read/write.
Q. What Is Lvmdump?
Ans:"lvmdump" is tool for LVM2 to collect the various information for diagnostic purposes.By default, it creates a tarball suitable for submission along with a problem report
Q. How To Re-create The Device Files For Lvm Volumes?
Ans:Run "vgmknodes" to recreate the LVM devices files.
Q. How To Take A Lvm Configuration Backup?
Ans:Use "vgcfgbackup vg_name" to take the latest configuration backup of volume group. The default volume group backup location is "/etc/lvm/backup" .
Q. How To Rename Volume Group? Can We Rename The Vg On Fly?
Ans:Yes. Its possible to rename the volume group on fly. But the mounted volumes will not reflect the same unless you re-mount the volume with new VG name. Need to update the /etc/fstab with new VG name to mount the volumes across the system reboot.
Q. How To See The Detailed Physical Volume Information?
Ans:Use "pvdisplay /dev/disk_name" Ex: pvdisplay /dev/sde
Q. How To See The Detailed Logical Volume Information?
Ans:Use "lvdisplay /dev/vg_name/lv_name"
Q. How To See The Detailed Volume Group Information?
Ans:Use "vgdisplay vg_name"
Q. How To List The Available Physical Volumes In Lvm?
Ans:Use "pvs" command to list the available physical volumes.
Q. How To List The Available Logical Volumes On The System?
Ans:Use "lvs" command to list the available logical volumes on the system.
Ans: A RAID device is a physical grouping of disk devices in order to create a logical presentation of one device whereas LVM is a logical layer that that can be manipulated in order to create and, or expand a logical presentation of a disk device to an OS.
Q. Explain Lvm Snapshot?
Ans:LVM snapshots allow the administrator to create a new block device which presents an exact copy of a logical volume, frozen at some point in time.
Q. How You Will Check On Your Server Or System Device-mapper Is Installed Or Not?
Ans:
Check the following file:
#cat /proc/misc
if this file contains “device-mapper” term it means device mapper is installed on your system.
Q. How Are Snapshots In Lvm2 Different From Lvm1?
Ans:
In LVM2 snapshots are read/write by default, whereas in LVM1, snapshots were read only.
Q. What Is The Maximum Size Of A Single Lv?
Ans:
For 2.4 based kernels, the maximum LV size is 2TB. For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB. For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB.
Q. If A Volume Group Named As Vgname Already Exists But We Need To Extend This Volume Group Up To 4gb. Explain All Steps?
Ans:
Firstly, create Physical volume (/dev/sdaX, where X is the partition number) of size 4GB.
Now run following command: # vgextend vgname /dev/sdaX
Q. If A Volume Group Vgname Have 3 Pv’s (/dev/sda5, /dev/sda6, /dev/sda7) But We Want To Remove /dev/sda7 Pv From This Vgname?
Ans:
# vgreduce vgname /dev/sda7
Q. Which Command Is Used To Extend A Logical Volume?
Ans:
# lvextend -size +<addsize> /dev/<vgname>/<lvname>
resize2fs /dev/<vgname>/<lvname>
Q. What Is The Partition Type Number For Swap, Raid And Lvm?
Ans:
SWAP (82), RAID (fd) and LVM (8e)
Q. How To Add A Disk To A Volume Group?
Ans:
suppose disk is /dev/sdb
# pvcreate /dev/sdb
# vgextend <vgname> /dev/sdb
Q. How To Remove A Disk From A Volume Group?
Ans:
Syntax:
# vgreduce <vgname> <disk>
Example:
# vgreduce vgname /dev/sdb
Q. How To Backup New Lvm Data Structures?
Ans:
# vgcfgbackup /dev/vgname
Q. Is It Possible To Increase The Logical Volume On Fly?
Ans:
Yes. LVM has the feature to increase the volume without unmount it.
Q. How To Reduce The Logical Volume? Is It Possible To Reduce On Fly?
Ans:
No. we can't reduce the logical volume on fly. Here is the steps to reduce the logical volume.
Un-mount the filesystem
Run e2fsck on the volume device
Reduce the Filesystem using resize2fs
Reduce the logical Volume using lvreduce
Mount the filesystem back for production.
Q. How Do You Scan The New Lun Or Disk?
Ans:
Use "echo 1 > /sys/class/scsi_host/hostx/scan" to scan disk from newly connected SAN or DISKS and also replace the "x" with number of host id present under /sys/class/scsi_host/.
Q. How To Scan Disks For Existing Volume Group?
Ans:
Use "vgscan" to scan existing volume group from newly connected SAN or DISKS.
But we should use "pvscan" prior to executing this command.
Q. How To Scan A Logical Volume From Exising Volume Group?
Ans: lvscan
Q. How To Stop The Logical Volume? Or Deactivate The Logical Volume?
Ans: "lvchange -an /dev/vg_name/lv_name"
Q. How To Activate The Logical Volume Which Is In Deactivated State?
Ans: "lvchange -ay /dev/vg_name/lv_name".
Q. How To Disable The Volume Group? Or Deactivate The Volume Group?
Ans: "vgchange -an volume_group_name".
Q. How To Enable The Volume Group? Or Activate The Volume Group?
Ans: "vgchange -ay volume_group_name" .
Q. How Do You Find That What Are The Disks Are Used For Logical Volume Mirroring?
Ans: use "lvs -a -o +devices"
Q. What Are Steps To Perform In Order To Increase The Logical Volume On Fly?
Ans:
Extend the logical volume
Increase the Filesystem size
Verify the status using df command or lvs command.
Q. How To List The Imported Volume Groups?
Ans:Use "vgs" command to display the imported volume group.
Q. How To Create Partition From The Raw Disk ?
Ans:
Using fdisk utility we can create partitions from the raw disk.Below are the steps to create partition from the raw dsik :
fdisk /dev/hd* (IDE) or /dev/sd* (SCSI)
Type n to create a new partition
After creating partition , type w command to write the changes to the partition table.
Q. What Does Sar Provides And At Which Location Sar Logs Are Stored ?
Ans:
Sar Collect, report, or save system activity information. The default version of the sar command (CPU utilization report) might be one of the first facilities the user runs to begin system activity investigation, because it monitors major system resources. If CPU utilization is near 100 percent (user + nice + system), the workload sampled is CPUbound.
By default log files of Sar command is located at /var/log/sa/sadd file, where the dd parameter indicates the current day.
Q. How To Reduce Or Shrink The Size Of Lvm Partition ?
Ans:
Below are the logical Steps to reduce size of LVM partition :
Umount the filesystem using umount command, use resize2fs command ,
e.g resiz2fs /dev/mapper/myvgmylv 10G Now use the lvreduce command ,
e.g lvreduce L 10G /dev/mapper/myvgmylv
Above Command will shrink the size & will make the filesystem size 10GB.
Q. How To Increase The Size Of Lvm Partition ?
Ans:
Below are the Logical Steps :
Use the lvextend command (lvextend L +100M /dev/<Name of the LVM Partition> , in this example we are extending the size by 100MB.
resize2fs /dev/<Name of the LVM Partition>
check the size of partition using ‘df h’ command
Q. Why Lvm Is Required?
Ans:
LVM stands for Logical Volume Manager , to resize filesystem's size online we required LVM partition in Linux. Size of LVM partition can be extended and reduced using the lvextend & lvreduce commands respectively.
Q. How To Create Partition From The Raw Disk?
Ans:
Using fdisk utility we can create partitions from the raw disk.Below are the steps to create partition from the raw disk :
fdisk /dev/hd* (IDE) or /dev/sd* (SCSI)
Type n to create a new partition
After creating partition , type w command to write the changes to the partition table.
Q. How To Decommission/remove Lvm Completely From The Host?
Ans:
Un-mount all the logical filesystems
Remove the logical volumes using "lvremove" command.
Destroy the volume group using "vgremove" command.
Use "pvremove" command remove the physical volumes from the system.
Q. If The Vg02 Has Two Physical Volumes Called /dev/sdc/ & /dev/sdd. How Do You Remove /dev/sdd From Vg02?
Ans:
"vgreduce vg02 /dev/sdd/"
Q. Assume Volume Group "vg02" Is Already Exists. How Do You Extend The Volume Group With 50gb? Provide All The Steps With Commands?
Ans:
Get the 50GB lun from storage team.(/dev/sdd)
Create physcical volume ( # pvcreate /dev/sdd )
Extend the volume group (# vgextend vg02 /dev/sdd)
Q. How To Extent The Volume Group?
Ans:
Using "vgextend" we can increase the volume group.
Q. What Are The Steps Involved To Create The Logical Volume From Scratch?
Ans:
Create a physical volume using pvcreate command: #pvcreate /dev/sdc
Create a volume group using "vgcreate" command: #vgcreate vg02 /dev/sdc
Create a logical volume using "lvcreate" command: #lvcreate -L 100M -n vol1 vg02
Create a filesystem on logical volume using mkfs command: #mkfs -t ext4 /dev/vg02/vol1
Mount the filesystem using mount command for use: #mount -t ext4 /dev/vg02/vol1 /vol1
Q. How Are Snapshots In Lvm2 Different From Lvm1 In Redhat Linux?
Ans:LVM1 snapshots are readonly by default where LVM2 snapshots were read/write.
Q. What Is Lvmdump?
Ans:"lvmdump" is tool for LVM2 to collect the various information for diagnostic purposes.By default, it creates a tarball suitable for submission along with a problem report
Q. How To Re-create The Device Files For Lvm Volumes?
Ans:Run "vgmknodes" to recreate the LVM devices files.
Q. How To Take A Lvm Configuration Backup?
Ans:Use "vgcfgbackup vg_name" to take the latest configuration backup of volume group. The default volume group backup location is "/etc/lvm/backup" .
Q. How To Rename Volume Group? Can We Rename The Vg On Fly?
Ans:Yes. Its possible to rename the volume group on fly. But the mounted volumes will not reflect the same unless you re-mount the volume with new VG name. Need to update the /etc/fstab with new VG name to mount the volumes across the system reboot.
Q. How To See The Detailed Physical Volume Information?
Ans:Use "pvdisplay /dev/disk_name" Ex: pvdisplay /dev/sde
Q. How To See The Detailed Logical Volume Information?
Ans:Use "lvdisplay /dev/vg_name/lv_name"
Q. How To See The Detailed Volume Group Information?
Ans:Use "vgdisplay vg_name"
Q. How To List The Available Physical Volumes In Lvm?
Ans:Use "pvs" command to list the available physical volumes.
Q. How To List The Available Logical Volumes On The System?
Ans:Use "lvs" command to list the available logical volumes on the system.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home