Operating System - HP-UX
1826269 Members
3595 Online
109692 Solutions
New Discussion

Recreate device files in /dev/vg01 after accidental delete ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

Recreate device files in /dev/vg01 after accidental delete ?

How do one recreate character and block device files in /dev/vg01 after an accidental delete
of these files. I need to restore (both character and block) device files for rlvoracle and lvoracle ? So that i see the lvoracle logical volume when I do lvdisplay -v vg01 ?
good judgement comes from experience and experience comes from bad judgement.
6 REPLIES 6
Chris Watkins_1
Respected Contributor
Solution

Re: Recreate device files in /dev/vg01 after accidental delete ?

You could export and re-import the vg, but this will work:

You need to know which lvol this is, if it isn't the only one
in vg01. You also need to know the vg minor number. # ll /dev/vg01/group
to be sure. Meantime, I'll assume "1" there as well.
(If you have multiple lvols in the vg, try and see what's missing.)


mknod /dev/vg01/rlvoracle c 64 0x010001
mknod /dev/vg01/lvoracle b 64 0x010001

That should get you going, assuming vg01 and first lvol is lvoracle,
and everything else is in its default configuration.
Not without 2 backups and an Ignite image!
Jeff Schussele
Honored Contributor

Re: Recreate device files in /dev/vg01 after accidental delete ?

Hi Sam,

Assuming vg01 is the 0x010000 VG device AND lvoracle is the FIRST LV in the VG, then

cd /dev/vg01
mknod lvoracle b 64 0x010001
mknod rlvoracle c 64 0x010001

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven E. Protter
Exalted Contributor

Re: Recreate device files in /dev/vg01 after accidental delete ?

insf -e

Will fix that right up.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: Recreate device files in /dev/vg01 after accidental delete ?

Hi Sam,

Look at /etc/lvmconf directory and see if you have a file called vg01.mapfile. If so, then do a 'cat vg01.mapfile' and note the logical volume number and the name. If may be something like

1 lvol1
2 lvol2

etc

You would need to know the minor number of the group file (ll /dev/vg01/group). If you don't have it, then you will need to create it. Hopefully you remember it or it is in the sequence

mknod /dev/vg01/group c 64 0x010000

Then create the logical volume device files using the following commands

mknod /dev/vg01/ c 64 0x01000

where lvol_name is the second field and lvol_number is the first field in /etc/lvmconf/vg01.mapfile file for each lvol.

If this didn't work, then you will need to export/re-import the VG which means unmounting the filesystems followed by deactivating the VG.

-Sri

You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: Recreate device files in /dev/vg01 after accidental delete ?

Hmmmm.. correction in my previous message. Make sure you create block and character device files as mentioned by Jeff and others. You can use /etc/lvmconf/vg01.mapfile to obtain the lv names and numbers.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sammy_2
Super Advisor

Re: Recreate device files in /dev/vg01 after accidental delete ?

Thanks,Jeff, Chris. Both of yours method works best after i got the numbering from /etc/lvmconf/mapfile (as pointed out by Shridhar). Steve , I tried your method that did not create the device files. Thanks to all. I will assign points once my browser lets me do it.
Shridhar . Thanks for your help in getting me straight with detailed explanation.
good judgement comes from experience and experience comes from bad judgement.