According to Mike Werner: While burning my CPU.
>
> Jayatheerthan Venkatramanan wrote:
> >
> > hi,
> > i have got a system with win95(hda1) and linux(hda5). i didnt mount the win95
> > partition. but i was fiddling with /dev directory as root. at one point of
> > time i redirected ls to /dev/hda1. because of that the win95 partition got
> > corrupted and was not getting booted.
> >
> > my question is:
> > when i havent mounted the win95 partition, how is it that that partition
> > is accessible?
> > how /dev/file is related to the device when not mounted?
>
> The way I understand it is that if the /dev/hd** is directly accessed -
> as you did - then it does not matter whether or not the partition is
> mounted. By accessing the /dev/hd** as root you are doing a direct
> access of the device itself, completely bypassing the userlevel system
> functions - like directory structures and filesystems - that are usually
> in place to prevent such mishaps. There are some system utilities that
> rely on such operations - such as fsck and mke2fs.
>
> Basically, any time that a /dev/* file is directly accessed by the root
> user, all the system safeguards get thrown right out the window. What
> is happening is a direct low level access of the physical device. There
> are certain times when such is needed, but usually with a system call
> such as fsck or mke2fs acting as somewhat of a buffer. Or when doing
> system programming - such as deep in the kernel. Under ordinary use,
> about the closest that anyone should get is along the lines of 'cat
> sound.au > /dev/sound' or some such thing (I'm not sure of that one -
> haven't got a sound card yet. Corrections?).
No comment on the above, it explanes the situation well, however i did a
little experiment to "try" to simulate the origanal problem.
I placed a clean floppy in /dev/fd0 and created a ext2 filesystem, i then
copied a few executable scripts and did what was explained in the origanal
post 'ls > /dev/fd0' floppy was not mounted, the 'ls > /dev/fd0' was done
from/in the root '/' filesystem.
Before i did the 'ls' i could execute the scripts from the floppy no
problem, now after doing the 'ls' when i try to mount the floppy;
mount /dev/fd0
VFS: Can't find an ext2 filesystem on dev 02:00.
mount: wrong fs type, bad option, bad superblock on /dev/fd0,
or too many mounted file systems
fsck /dev/fd0
Parallelizing fsck version 1.10 (24-Apr-97)
e2fsck 1.10, 24-Apr-97 for EXT2 FS 0.5b, 95/08/09
Couldn't find ext2 superblock, trying backup blocks...
fsck.ext2: Attempt to read block from filesystem resulted in short read
while trying to open /dev/fd0
Could this be a zero-length partition?
Ah!, now one would imagen that the origanal posters winhoze parition has
now been rendered utterly useless.
Let this be a warning to everyone who insists on logging into thier system
as root while they don't really know what they are doing.
Now why did i use a floppy for my experiment.?????
>
> >
> > Thanx
> > Jay
> --
> Mike Werner KA8YSD | "Where do you want to go today?"
> ICQ# 12934898 | "As far from Redmond as possible!"
> AIM Screen Name Reznaeous |
> '91 GS500E |
> Morgantown WV |
>
--
Regards Richard.
[EMAIL PROTECTED]
Happy New Year, and may all your troubles be small (ones).