LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Uh-oh. Erased /dev/dvd file (https://www.linuxquestions.org/questions/linux-general-1/uh-oh-erased-dev-dvd-file-346781/)

newmoon 07-25-2005 10:48 PM

Uh-oh. Erased /dev/dvd file
 
Hi all:

Well, I'm a relative newbie to Linux, and apparently, I didn't learn the first time not to work on my box late at night.

When doing some work, I just erased the /dev/dvd file instead of erasing the symbolic link. Just to make matters worse, I also created a new, blank file, with the same name.

Is /dev/dvd a special file or is it generic? Can I recreate it somehow or am I screwed?

Oh, the machine is KnoppMyth (Debian Sarge 2.6.9 custom kernel).

I'm desperate for help

Thanks for any input.


newmoon

Matir 07-25-2005 10:52 PM

Well, it all depends. If you have udev, you could just remove the file and reboot. Otherwise, there's probably a "MAKEDEV" script in you /dev that you can use to recreate it.

newmoon 07-25-2005 11:24 PM

Matir:

Thanks for your quick reply!
Well, I'm not using udev, AFAIK.

I looked around for a makedev file, but there were several files by that name. The one in /dev directory was tiny, and when I looked at it, barely contained any code.

Should the file you're talking about end in ".sh" ?

What repercussions would running that script have?


Thanks again.

newmoon


Quote:

Originally posted by Matir
Well, it all depends. If you have udev, you could just remove the file and reboot. Otherwise, there's probably a "MAKEDEV" script in you /dev that you can use to recreate it.

Matir 07-25-2005 11:30 PM

I think just running "/dev/MAKEDEV.sh dvd" should work... it's been a while since I've used raw dev nodes... you could try googling for relevant info.

newmoon 07-25-2005 11:55 PM

Well, unfortunately:

Code:

MAKEDEV dvd
MAKEDEV: don't know how to make device "dvd"

What can I try next.

Thanks

newmoon



Quote:

Originally posted by Matir
I think just running "/dev/MAKEDEV.sh dvd" should work... it's been a while since I've used raw dev nodes... you could try googling for relevant info.

Matir 07-26-2005 12:19 AM

Which device is your dvd drive? hda, hdb, hdc, hdd? It should show up in 'dmesg' somewhere (dmesg | grep -i dvd). See if that exists. If so, just ln -s /dev/DRIVE_FROM_DMESG /dev/dvd

newmoon 07-26-2005 08:18 AM

Thanks.

But I'm confused. Don't I need the actual dvd device file there, as opposed to just a blank file with a link? If so, is this file standard? Perhaps if it is, I could just get another copy from someone with the exact same distrib?



newmoon



Quote:

Originally posted by Matir
Which device is your dvd drive? hda, hdb, hdc, hdd? It should show up in 'dmesg' somewhere (dmesg | grep -i dvd). See if that exists. If so, just ln -s /dev/DRIVE_FROM_DMESG /dev/dvd

Matir 07-26-2005 09:52 AM

Dev files don't actually do anything, per se. On my computer, /dev/dvd is a symbolic link to /dev/hdd, for example.

Chromezero 07-26-2005 11:42 AM

My setup is similar to Matir's. /dev/cdrom or /dev/dvd are just symbolic links to /dev/hde or whatever the physical drive is. My main system, for example, has 3 hard drives, 1 CD-RW, and 1 DVD-RW. Rather than trying to keep track of whether a drive is HDA, HDE, or whatever each drive is, I have sym links to keep them organized. This makes it easier to setup in Fstab or when mounting.

username17 07-26-2005 02:46 PM

If /dev/dvd is symbolically linked to the correct device (/dev/hdc), then reconnecting the link should work.

Code:

ln -s /dev/hdc /dev/dvd
That SHOULD work assuming /dev/hdc is your Optical drive (or the DVD one, if you have more than one Optical drive).
Someone correct me if I'm wrong, but if you create a symbolic link, doesn't it create the file that is linked? In my understanding, the above command should create a file called /dev/dvd and it would be linked to /dev/hdc.

Matir 07-26-2005 07:56 PM

Creating a symbolic link creates a special file of type link (on filesystems that support such operations). In effect, the only way to have a link is to have such a file, and the only way to have such a file is to have a link. :)

Creating a symlink does NOT create the destination of the symlink (/dev/hdc above).

Chromezero 07-27-2005 08:02 AM

It would not create /dev/hdc but you could use mknod /dev/hdc or makedev /dev/hdc to create the destination file correct? I'm still learning and thought it might help newmoon some as well.

Itzac 07-27-2005 08:27 AM

Chromezero is right. If hdc and hdd already exist in /dev (or whatever device is your dvd-rom), then all you have to do is link to it. If you also deleted the actual device file, you can use mknod to restore it. Look in /proc under under ide to determine the major and minor numbers. It's a little tricky, you'll need to cat a lot of the files in /proc/ide and compare them with the output of ls -l /dev/hd*. Or someone might just come along after me and post the numbers for you.

Hope this helps

newmoon 07-27-2005 10:44 AM

Thanks guys. I'm trying to understand something.

Let's say I were to use MAKEDEV (so I can learn how, and so I can say that I did). :-)

Would I use the device characteristics for hdc ? What repercussions would that have as opposed to using a symbolic link?


I checked this guide:
faqs.com: Linux Administrator guide

and according to that, I should consult my "devices.txt" file. I did that, and it specifies /dev/hdc as block device, major: 22 minor: 0 .

So would it work if I did:
Code:

MAKEDEV -v dvd
        create dvd b 22 0 root:cdrom 0660

What owner and group and perms are usually given for dvd-anyone know?


Thanks again.


newmoon

oneandoneis2 07-27-2005 10:48 AM

dvd is usually just a symbolic link to the hdx device - that *is* the norm. To have an actual dvd /dev entry, you'd have to change the way dev node names are assigned.


All times are GMT -5. The time now is 03:57 PM.