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?).
>
> 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 |
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GU d-@ s:+ a- C++>$ UL++ P+ L+++ E W++ N++ !o w--- O- !M V-- PS+ PE+
Y+ R+ !tv b+++(++++) DI+ D--- G e*>++ h! r++ y++++
------END GEEK CODE BLOCK------