RHCE-Interview Question || LVM02



Part-02

6. How to reduce the File system size in Linux?

Step1:- unmounts the file system
Step2:- we need to reduce the file system size using "resize2fs"
Step3:-Then reduce the lv0 size using "lvreduce"
#umount –l /dev/VG0/LV0
#resize2fs -f /dev/VG0/LV0  3G
#lvreduce -L 3G /dev/VG0/LV0

7.If the vg02 has two physical volumes called /dev/sdc/ & /dev/sdd. How do you remove /dev/sdd from vg02.
Answer: “vgreduce vg02 /dev/sdd/”

8.How to extent the volume group ?
Using “vgextend” we can increase the volume group.

9.Assume Volume group “vg02″ is already exists.How do you extend the volume group with 50GB ? Provide all the steps with commands.
Answer:
      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)

10.If the vg02 has two physical volumes called /dev/sdc/ & /dev/sdd. How do you remove /dev/sdd from vg02. 

Answer: “vgreduce vg02 /dev/sdd/”

11. How to stop the logical volume? or deactivate the logical volume ?
Answer: “lvchange -an /dev/vg_name/lv_name”

12.How to activated the logical volume which in deactivated state ?
Answer: “lvchange -ay /dev/vg_name/lv_name” .

13. How to disable the volume group ? or Deactivate the volume group ?
#vgchange -an vg_name

14.How to enable the volume group? or Activate the volume group?
#vgchange -ay vg_name


15.How do you find that what are the disks are used for  logical volume mirroring ? 

Answer: use “lvs -a -o +devices”

16.How to rename volume Group ? can we rename the VG on fly ? 

It’s possible to rename the volume group on flying mode.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.

17. How to take a LVM configuration backup?

Use (#vgcfgbackup vg_name) to take the latest configuration backup of volume group. The default volume group backup location is “/etc/lvm/backup”.

18. How to re-create the device files for LVM volumes ?
Run “vgmknodes” to recreate the LVM devices files.

19. What is lvmdump? 
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


 20:Explain LVM snapshot?
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.

21.How are snapshots in LVM2 different from LVM1 in Redhat Linux?
Answer:LVM1 snapshots are  readonly by default where LVM2 snapshots were read/write.


abrt-server is showing .lock file is locked by a specific process

Environment

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7

Issue

  • The following message is seen in /var/log/messages:
abrt-server[28388]: Lock file '.lock' is locked by process 35522

Resolution

RHEL 6
  • In Red Hat Enterprise Linux 6 this issue has been resolved in Errata with package abrt-2.0.8-40.el6.x86_64.rpm.
RHEL 7
  • In Red Hat Enterprise Linux 7 this issue has been resolved in Errata with package abrt-2.1.11-45.el7.x86_64.rpm.
  • There are instances where the issue persisted in the 2.1.11-50.el7 version of ABRT.
    There is a Bug reported and is being worked on.

Diagnostic Steps

  • Check /var/log/messages for abrt-server[<pid>]: Lock file '.lock' is locked by process <pid>

When change or login to specific user, 'abrt-cli status' timed out is always shown



Environment

  • Red Hat Enterprise Linux 7.3
  • abrt-2.1.11-45.el7.x86_64

Issue

  • When change or login to specific user, 'abrt-cli status' timed out is always shown
# su - testuser
Last login: Mon Jun 12 15:00:40 JST 2017 from localhost on pts/0
'abrt-cli status' timed out

Resolution

  • Since lastnotification file is not owned by testuser the user can't update the file. Usually, the file is updated when change or login to the user, and it records the latest time.
  • If the system has a large quantity of abrt status information and it takes over 10 sec, the time out message will be shown every time.
  • To prevent it, correct the file permission, so that the file can be updated. Once the file is updated, time out message should not be shown.
# chown testuser lastnotification

Diagnostic Steps

 [root@server01:~]# cat /etc/passwd |grep testuser
testuser:x:6014:4500::/home/testuser:/bin/bash
[root@server01:~]# ls -la /home/testuser/
total 28
drwxrwx--- 7 testuser group1  206  Jun  9 14:12 .
drwxr-xr-x 4 root     root     37  May 26 14:27 ..
-rw------- 1 user001  group1 1739  Jun  9 16:52 .bash_history
-rw-r--r-- 1 testuser group1   18  Jul 13  2016 .bash_logout
-rw-r--r-- 1 testuser group1  193  Jul 13  2016 .bash_profile
-rw-r--r-- 1 testuser group1  338  May 11 18:37 .bashrc
drwxr-xr-x 3 user001  group1   18  Jun  1 16:21 .cache
drwxr-xr-x 3 user001  group1   18  Jun  1 16:21 .config
-rw-r--r-- 1 testuser group1  172  Apr 28  2016 .kshrc
-rw------- 1 e225675  group1    3  Jun  9 14:12 .psql_history
drwxr-xr-x 3 user001  group1   65  Jun  5 14:43 .subversion
drwxrwxrwx 5 root     root    174  Jun  1 19:20 dir_20170601
drwxrwxrwx 3 root     root   4096  Jun  2 14:03 dir_20170602
[root@server01:~]#
[root@server01:~]# ls -la /home/testuser/.cache/abrt/
total 4
drwxr-xr-x 2 user001 group1 30  Jun  9 16:44 .
drwxr-xr-x 3 user001 group1 18  Jun  1 16:21 ..
-rw------- 1 user001 group1 11  Jun  9 16:44 lastnotification

How can I find the installation date of my Red Hat Enterprise Linux system ?

==>Environment

Red Hat Enterprise Linux 3 / 4 / 5/ 6

==>Issue

How can I find the installation date of my Red Hat Enterprise Linux system?

==>Resolution

There are various method by which you can find when your system was installed.

One method is to get the package details of the "basesystem" package:

# rpm -qi basesystem

In the output you can see the installation date:

Install Date: Wed 07 Jan 2009 04:23:27 AM IST

The "basesystem" rpm defines the components of a basic Red Hat Enterprise Linux system (for example, the package installation order to use during
bootstrapping). This rpm does not provide any files. Basesystem should be the first package installed on a system and it should never be removed.

Since this package is never removed or updated , the install date of this package indicates the install date of the system.

Other methods include checking the creation date of the files "install.log" in the /root directory or "anaconda.*" logs in the /var/log directory:

# ls -l /root/install.log
# ls -l /var/log/anaconda.*

But since these files can be accidentally deleted, finding the installation date can be best accomplished using the "basesystem" rpm.