• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to recreate LVM device files under /dev directory using vgmknodes

by admin

After a server crash or due to a human error, volume group device files are not seen under /dev directory. The device files were removed from the filesystem after the system crash, probably due to a filesystem corruption.

# cd /dev
# ls vg01
ls: cannot access vg01: No such file or directory

If you check the output of lvdisplay command you would see the vg intact and without any error.

# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg01/lv01
  LV Name                lv01
  VG Name                vg01
  LV UUID                iP1MbY-LPMY-nmym-iY2B-CCRJ-ElVY-5L1mql
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-10-11 21:39:45 +0530
  LV Status              not available
  # open                 1
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:3

Creating LVM devices

1. The command vgcfgrestore would fail if you try to recover the volume group using the backup.

# vgcfgrestore -f /etc/lvm/backup/vg01 /dev/sdc

2ba3ce899000-2ba3ce89a000 rw-p 2ba3ce899000 00:00 0
2ba3ce8a5000-2ba3ce8aa000 rw-p 2ba3ce8a5000 00:00 0
2ba3ce8aa000-2ba3d1e83000 r--p 00000000 fd:00 77807        /usr/lib/locale/locale-archive
7fff26a43000-7fff26a58000 rw-p 7ffffffea000 00:00 0        [stack]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0    [vdso]
Aborted

2. In order to recreate the LVM devices under /dev/ you will have to use the vgmknodes command. Use the vgmknodes command with verbose options :

# vgmknodes -vv

Filed Under: Linux

Some more articles you might also be interested in …

  1. Why Does a Lun World Wide ID Starts with the Number 3 in Linux dm-multipath
  2. How to use strace and ltrace commands in Linux
  3. Linux / UNIX : How to create extended partition using fdisk
  4. How to Stop SSH Session From Getting Timed Out
  5. How to change the number of commands stored in Bash History
  6. How to Remove/Delete All Packages from Channel(s) in SpaceWalk
  7. vgextend Command Examples in Linux
  8. bpftool: command not found
  9. How to Enable X11 Forwarding on CentOS/RHEL 5,6,7
  10. CentOS/RHEL – How to run a script or command when any user logout the ssh session

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright