Operating System - HP-UX
1834346 Members
2026 Online
110066 Solutions
New Discussion

What if raw device file for a logical volume deleted for a mounted file system

 
Ayaz.Ahmad
New Member

What if raw device file for a logical volume deleted for a mounted file system

What if raw device file for a logical volume deleted for a mounted file system? will the file system work properly?
4 REPLIES 4
Matti_Kurkela
Honored Contributor

Re: What if raw device file for a logical volume deleted for a mounted file system

Removal of the raw device file will not damage the filesystem. Even if you remove the block device file, it won't cause any immediate problems. Only after unmounting the filesystem there will be problems: you cannot run fsck if the raw device file is missing, and mounting is impossible if there is no block device file.

Remember, Unix won't actually remove a file that is being held open until the file is closed. The same principle applies here.

Device files are very easy to re-generate: all you need is the name, device type (character or block), minor & major device numbers, and ownership & permissions information.

If you know this information, you can re-create the missing device file using the mknod command, but the command "insf -e" should be be even easier way to recover. It will automatically re-create any missing device files.

MK
MK
Robert-Jan Goossens
Honored Contributor

Re: What if raw device file for a logical volume deleted for a mounted file system

Hi,

You can just recreate the device files, see example below.

# ll /dev/vg00
total 0
crw-r----- 1 root sys 64 0x000000 Jan 5 2005 group
brw-r----- 1 root sys 64 0x000001 Apr 21 08:54 lvol1
brw-r----- 1 root sys 64 0x000002 Jan 5 2005 lvol2
brw-r----- 1 root sys 64 0x000003 Jan 5 2005 lvol3
brw-r----- 1 root sys 64 0x000004 Jan 5 2005 lvol4
brw-r----- 1 root sys 64 0x000005 Jan 5 2005 lvol5
brw-r----- 1 root sys 64 0x000007 Jan 5 2005 lvol7
brw-r----- 1 root sys 64 0x000008 Jan 5 2005 lvol8
crw-r----- 1 root sys 64 0x000001 Jan 5 2005 rlvol1
crw-r----- 1 root sys 64 0x000002 Jan 5 2005 rlvol2
crw-r----- 1 root sys 64 0x000003 Jan 5 2005 rlvol3
crw-r----- 1 root sys 64 0x000004 Jan 5 2005 rlvol4
crw-r----- 1 root sys 64 0x000005 Jan 5 2005 rlvol5
crw-r----- 1 root sys 64 0x000007 Jan 5 2005 rlvol7
crw-r----- 1 root sys 64 0x000008 Jan 5 2005 rlvol8

I removed the raw device files for (r)lvol6

# mknod /dev/vg00/lvol6 b 64 0x000006
# mknod /dev/vg00/rlvol6 c 64 0x000006

You could also restore these device files from back-up.

Best regards,
Robert-Jan
Bill Hassell
Honored Contributor

Re: What if raw device file for a logical volume deleted for a mounted file system

Device files are essentially starting points for communicating with a device (disk, tape, etc). Essentially, it contains two pieces of information, the driver ID (major number) and the options for this driver. When the system is running, the device file is no longer used. When booting up or when creating a filesystem, the raw device file is used to talk directly to the disk. After that, LVM takes over and opens the block device (which is a different driver that uses the buffer cache). Once open, the file control block inside the various programs talks directly to the driver. So the block device file is not used.

So the device files are used just during the open system calls. They can be remove and restored without incident. They do not have a direct connection to the device. The mknod command can be run at anytime to create/recreate a missing device file. There are just two numbers needed to recreate the file, major and minor.


Bill Hassell, sysadmin
Ayaz.Ahmad
New Member

Re: What if raw device file for a logical volume deleted for a mounted file system

Thanks a lot...