LVM Interview Questions and Answers
Here are all Important LVM Interview Questions.
1.Is it possible to increase the logical volume on fly ?
Ans: Yes.We can increase the logical volume without umount it.
2.How to reduce the logical volume ? is it possible to reduce on fly ?
Ans: No.You can’t reduce the logical volume on fly. Here is the steps to reduce the logical volume on redhat Linux.
Un-mount the filesystem
Run e2fsck on the volume device
Reduce the Filesystem.(resize2fs)
Reduce the logical Volume(lvreduce)
Mount the filesystem back for production.
3.How to do you scan the new LUN or disk for LVM physical volume ?
Ans: Use “pvscan” to scan existing physical volume from newly connected SAN or DISKS.
4.How to scan disks for existing volume group ?
Ans: Use “vgscan” to scan existing volume group from newly connected SAN or DISKS.
But you should use “pvscan” prior to executing this command.
5.How to scan a logical volume from exising volume group?
6.How to stop the logical volume ? or deactivate the logical volume ?
Ans: “lvchange -an /dev/vg_name/lv_name”
7.How to activated the logical volume which in deactivated state ?
Ans: “lvchange -ay /dev/vg_name/lv_name” .
8.How to disable the volume group ? or Deactivate the volume group ?
Ans: ”vgchange -an volume_group_name” .
9.How to enable the volume group ? or Activate the volume group ?
Ans: ”vgchange -ay volume_group_name” .
10.How do you find that what are the disks are used for logical volume mirroring ?
Ans: use “lvs -a -o +devices”
11. What are steps to perform in order to increase the logical volume on fly ?
Extend the logical volume
Increase the Filesystem size
Verify the status using df command or lvs command.
12.How to list the imported volume groups ?
Ans: Use “vgs” command to display the imported volume group.
13.How to list the available logical volumes on the system?
Ans: Use “lvs” command to list the available logical volumes on the system.
14.How to list the available physical volumes in LVM?
Ans: Use “pvs” command to list the available physical volumes.
15.How to see the detailed volume group information ?
Ans: Use “vgdisplay vg_name”
16.How to see the detailed logical volume information ?
Ans: Use “lvdisplay /dev/vg_name/lv_name”
17.How to see the detailed physical volume information ?
Answer: Use “pvdisplay /dev/disk_name” Ex: pvdisplay /dev/sde
18.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.
19.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” .
20.How to re-create the device files for LVM volumes ?
Ans: Run “vgmknodes” to recreate the LVM devices files.
21.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
22.How are snapshots in LVM2 different from LVM1 in Redhat Linux?
Ans: LVM1 snapshots are readonly by default where LVM2 snapshots were read/write.
23.What are the steps involved to create the logical volume from scratch ?
i.Create a physical volume using pvcreate command.
ii.Create a volume group using “vgcreate” command
#vgcreate vg02 /dev/sdc
iii.Create a logical volume using “lvcreate” command
#lvcreate -L 100M -n vol1 vg02
iv.Create a filesystem on logical volume using mkfs command.
#mkfs -t ext4 /dev/vg02/vol1
v.Mount the filesystem using mount command for use.
#mount -t ext4 /dev/vg02/vol1 /vol1
24.How to extent the volume group ?
Ans: Using “vgextend” we can increase the volume group.
25.How to copy a LV from one VG to another?
Ans: # cplv -v <new vg name> <sourcelvname>
26.Assume Volume group “vg02″ is already exists.How do you extend the volume group with 50GB ? Provide all the steps with commands.
1.Get the 50GB lun from SAN team.(/dev/sdd)
2.Create physcical volume ( # pvcreate /dev/sdd )
2.Extend the volume group (# vgextend vg02 /dev/sdd)
27.How do I replace a disk?
Ans: extendvg VolumeGroupName hdisk_new
migratepv hdisk_bad hdisk_new
reducevg -d VolumeGroupName hdisk_bad
28.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/”
29.How to decommission/remove LVM completely from the host ?
1.Un-mount all the logical filesystems
2.Remove the logical volumes using “lvremove” command.
3.Destroy the volume group using “vgremove” command.
4.Use “pvremove” command remove the physical volumes from the system.
30. Why is 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.
31.How can I change the characteristics of a volume group?
You use the chvg command to change the characteristics of a volume group.
32.How do I create a logical volume?
Ans: #mklv -y name_of_logical_volume name_of_volume_group number_of_partition
33.How will you change a PP size?
Ans: PP size can be change using a T-factor. If not then add a partitions in VG by adding one disk.
# chvg –t3 rootvg
34.T – Factor?
Ans: T – factor means that it will change the pp size to increase the efficiency of vg
#chvg –t16 datavg
Cal-if suppose that datavg pp size is 1016 we can take t factor is 16 then it comes to 2048 and pv contains in vg is 2.
35. What is the default PP Size in AIX?
36. How To check Memory stats and CPU stats ?
Ans: Using ‘free’ & ‘vmstat’ command we can display the physical and virtual memory statistics respectively.With the help of ‘sar’ command we see the CPU utilization & other stats.
37. 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 CPU-bound.
By default log files of Sar command is located at /var/log/sa/sadd file, where the dd parameter indicates the current day.
38. 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
39.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/myvg-mylv 10G
-Now use the lvreduce command , e.g lvreduce -L 10G /dev/mapper/myvg-mylv
Above Command will shrink the size & will make the filesystem size 10GB.
40. 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.