LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Hope to save unbootable system (https://www.linuxquestions.org/questions/linux-general-1/hope-to-save-unbootable-system-16386/)

Ethan 03-16-2002 01:41 AM

Hope to save unbootable system
 
I apologise in advance for the lack of detail in this query. I'm at home right now and the problem is at work. Nonetheless, I'm posting this in the hope that the answer will be obvious to someone. If not, I'll be at work this weekend, and I'll try again with better detail, such as the exact wording of error messages.

Anyway, I have a Mandrake 7.1 system with /var on its own partition. That partition became full. I went in and started removing thousands of .gz files using rm. However, it was incredibly tedious because rm couldn't just remove all the files in a directory at once. If I tried to do that, it would return an error saying "too many arguments." So I had to use wildcards to remove smaller groups of files at a time.

I remembered reading that data sent to /dev/null vanishes, so I decided to try using the cp command instead, like so:

cp -R /var/logs/mail/* /dev/null/

Apparently I'm not the world's leading Linux expert. The result was that the files were actually copied into /dev/null and existed there like files in any ordinary directory. I gathered this immediatly, so I cancelled the command, removed the files from /dev/null, and went back to using rm.

After I had wiped out everything in /var (which took a while), I tried to reboot the machine, but many of the steps in the boot up process failed and it came to a halt with a prompt saying "Type cmd-D for normal bootup". But doing so simply caused the prompt to repeat itself. While the machine was struggling to boot up and I was watching errors go by, I noticed several saying "/dev/null is a directory". That's why I think that thing I did earlier might have hosed up the system.

Maybe I destroyed the special nature of /dev/null and the boot process requires it for some reason. On the other hand, maybe I accidentally removed some file or files from /var that are essential for booting up. Is that possible?

I can boot the machine from a rescue disk and mount my partitions. Is there anything I can do from there to get it to boot normally? What if I copied /dev/null from the rescue disc over the one on the hard drive.

Any help would be greatly appreciated.

Thanks,

Ethan

zmedico 03-16-2002 02:58 PM

Your definately on the right track Ethan!
To remove the /dev/null directory, do this(assuming your linux root partition is mounted on /mnt):
"rm -rf /mnt/dev/null"

Tc copy the special device file from your floppy, you probably need the "-a" switch:
"cp -a /dev/null /mnt/dev/null"

Hopefully thats the only problem...

Here is a duplicate thread:

http://www.linuxquestions.org/questi...threadid=18986


Ethan 03-16-2002 09:20 PM

/dev/null
 
Thanks zmedico. I'll try that on Sunday when I go in to work.

Ethan

Ethan 03-17-2002 05:02 PM

/dev/null restored
 
Copying /dev/null from the emergency boot CD worked. System boots now.

Thanks!

Ethan

tge 03-20-2002 05:08 PM

Ethan:

Three comments:

1. The syntax of your cp -R command copies multiple files to a directory, which is the correct syntax. However, /dev/null should not be a directory. It is a character device file. How did you create directory /dev/null/ ?

2. The mknod command can help create/recreate special device files. See man mknod. I used mknod to create a bogus device
file called /dev/junk and tried your cp -R of a bunch of files from
/tmp. It failed telling me the last arg was not a directory.

3. I seem to remember that
find . whatever exec rm {}\;
will get around the limitations of line length in the shell.
Been awhile since I ran that (check man find for syntax)
and it wasn't on Linux. We used to have 24x7 apps
in Unix run away and generate hundreds of useless log files
and we used that to get rid of them.

HTH.

Tom Eischeid


All times are GMT -5. The time now is 09:39 AM.