PV commands in Linux - LVM interview Questions

PV related commands in Linux LVM :

Directories and Files :

## Directories
/etc/lvm                    - default lvm directory location
/etc/lvm/backup         - where the automatic backups go
/etc/lvm/cache          - persistent filter cache
/etc/lvm/archive        - where automatic archives go after a volume group change
/var/lock/lvm             - lock files to prevent metadata corruption

# Files
/etc/lvm/lvm.conf       - main lvm configuration file
$HOME/.lvm               - lvm history

Diagnostics :

#lvmdump -d

# dmsetup [info|ls|status]    

// Note: by default the lvmdump command creates a tar ball


Display :

  # pvdisplay -v
  # pvs -v
  # pvs -a

Scanning : 

#pvscan -v

Note: scans for disks for non-LVM and LVM disks

Add / Remove  / Check PV:

 # pvcreate /dev/sdb1
 # pvremove /dev/sdb1
  #pvck -v /dev/sdb1

Change physical attributes:  

## do not allow allocation of extents on this drive

#pvchange -x n /dev/sdb1

- Common Attributes that you may want to use:

      --addtag add a tag
      -x allowed to allocate extents
       -u change the uuid

Move  PV        : 

# pvmove -v /dev/sdb2 /dev/sdb3

Note: moves any used extents from this volume to another volume, in readiness to remove that volume. However you cannot use this on mirrored volumes, you must convert back to non-mirror using "lvconvert -m 0"

Post a Comment