On 1/8/99 9:54 AM, Richard Adams at [EMAIL PROTECTED] wrote:
>
>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
>
[results of fsck snipped]
>
>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.?????
>
[several sigs snipped]
OK, I've been kind of following this thread, because I am trying to get a
dual boot system set up with two hard drives, each with only one os on
it. One hard drive, /dev/hda, has multiple partitions on it, but it is
used exclusively for linux (SuSE 5.3). The other drive, /dev/hdb, has
MSDOS 6.22 and WfW 3.11 on it. The linux system was installed first, and
for a long time was the only system I was running. (Why I am now
poluting the system with MSDOS and Windows is a long story which I won't
go into now. Suffice to say, it is the only way it seems I can get a
MediaMarkt scanner to work.)
Since MSDOS wants to install itself on the first drive it finds, in this
case my linux system, I disconnected the drive with linux on it and
connected the other drive as the only hard drive on the system. I then
installed MSDOS and WfW, and moved the drive back to its position as the
second drive on the first IIDE controller. The linux drive went back on
as the first drive on the first IDE controller. I adjusted
/etc/lilo.conf to include an option to boot dos. Just for grins, I
mounted the DOS/WfW drive on a directory, /dos, using the command 'mount
-t vfat /dev/hdb /dos' and then did the command 'ls -alF /dos'. This
last command showed me the contents of the DOS/WfW drive (as it should).
After all this, I rebooted and gave LILO the command to boot 'dos'.
'dos' refused to boot, and the computer claimed that it had been given a
non-system disk ("change disks and hit any key...yadda yadda") (I know
that it was at one time bootable because I booted DOS and played around
with WfW for a while before switching the drives back.) Is this refusal
to boot due to:
a) My having mounted the drive as vfat or my having used ls to list the
contents of the drive? (I do realize that in the example Richard gave
above, he used 'ls > /dev/fd0' which would write to the drive, rather
than what I did 'ls -alF /dev/hdb' which read *from* the drive.)
b) My having moved the DOS drive to the second position, thereby
confusing the drive's MBR?
c) Some other possibility I haven't thought of?
Cheers,
Sean
T. Sean (Theo) Schulze
[EMAIL PROTECTED] [EMAIL PROTECTED]
*****************************************************
There is, however, a limit at which forbearance ceases
to be a virtue. -- Edmund Burke