Article View: comp.os.linux.setup
Article #383Re: Help Desperately Needed!
From: Brett Gersekowski
Date: Fri, 29 Sep 1995 00:00
Date: Fri, 29 Sep 1995 00:00
95 lines
5334 bytes
5334 bytes
~ AnTY ~ (s9507584@yallara.cs.rmit.edu.au) wrote: : Well i've recently install linux on my p.c, trying to config and set : things up...everything was going as planned...but ARGH!!!! i accidently copied : the lodlin.zip for dos file to /dev/hda1 (thinking it would be the way Let's see... You typed cp lodlin.zip /dev/hda1 ??? Did you have much on C:??? : Is there any way to rectify this somewhat distressing problem without : formatting my hdd??? <with my luck probably not!> First - this is what you've done. /dev/hda1 is what's known as a block-special file. On unix-like systems (such as linux) this acts somewhat as an alias for a device. Special files are something like CON: or LPT1: under DOS. You can open a file to them, and now you're talking to the device - via the kernel. A block special file appears as a series of block of a certain size - sectors in this case. /dev/hda1 refers to the first partition on your hard drive. When you read it, you are actually reading the contents of the partition - sector by sector, from the first sector in the first cylinder, to the last sector in the last cylinder. Writing to this file writes to the same place. The very first sector (512 bytes) is the boot sector. On an MSDOS filesystem, this contains information about the partition geometry, as well as the loader routine. Things such as the number of number of sectors, sectors per cluster, sectors per FAT, etc. This you will have overwritten. Also, the loader routine - which is why you get the Missing Operating system message. These things are easily replaced. How big is lodlin.zip?? Each 512 bytes will be another sector you have corrupted. From here on in, it gets a bit harder to fix... Immediately after the boot sector is the File Allocation Table - FAT. This records the usage of clusters on the partition. Usually there will be two or more copies kept - in case the main one becomes corrupted. Each FAT will be (2*Number of Clusters) bytes long. If you haven't corrupted further than the first FAT, you may be able to restore the partition. If you have gone further, well, there's probably not much more you can do... My guess is that SYS will not work - because DOS will not recognise the partition, because the BIOS parameter Block has been corrupted. *DO NOT* try FDISK /MBR. This only rewrites the master boot record (or partition table if you like). It will try and set it up to boot DOS. The problem is not in your master boot record (you'd use cp loadlin.zip /dev/hda for that!!! sorry... :) If you know - or are willing to learn real fast - a little about filesystems, there is a possibility. It kinda requires that there still exists an uncorrupted version of the FAT and root directory, though. Don't think for a second, though, that I know what I'm talking about. I'm no expert - just a bit of a tinkerer, I guess - but I get away with it, usually. Perhaps if you told me how big loadlin.zip is (I don't have it handy, and I'm not about to dig it out...), how big the dead partition is and any other system information which you may think is handy I could tell you more. I hope this experience hasn't put you off using Linux. It is a *GREAT* OS, in my opinion, and has been quite stable in my experience (as long as you don't get too close to that cutting edge of development). As for what you should've done - First you must mount the partition. You use the mount command (as root) to do this, something like this :- mount -t msdos /dev/hda1 /mnt It may already be mounted. I know slackware 2.3 offers to setup so that your first dos partition is mounted at bootup as /dosc. After this the partition will be just like any other part of the directory tree, so you would use something like :- cp loadlin.zip /mnt OR cp loadlin.zip /dosc NEVER, EVER write to anything in /dev unless you know what you're doing, cos you'll probably break something!!! Check out the manual page for mount for more details on mounting filesystems - ie type 'man mount'. Also, you might read up on /etc/fstab. There might be something in the fstab manual page - not sure. Brett :)
Technical Details
Message-ID:
<44g2fs$pmr@enterprise.powerup.com.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4426df$5kr@goanna.cs.rmit.EDU.AU>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1103af,4916f53e7c2fb68a X-Google-Attributes: gid1103af,public X-Google-Thread: 10e2b3,4916f53e7c2fb68a X-Google-Attributes: gid10e2b3,public X-Google-Thread: 102983,4916f53e7c2fb68a X-Google-Attributes: gid102983,public X-Google-Thread: f9b51,4916f53e7c2fb68a X-Google-Attributes: gidf9b51,public X-Google-Thread: faa64,4916f53e7c2fb68a X-Google-Attributes: gidfaa64,public X-Google-Thread: 10a997,4916f53e7c2fb68a X-Google-Attributes: gid10a997,public From: bgerseko@powerup.com.au (Brett Gersekowski) Subject: Re: Help Desperately Needed! Date: 1995/09/29 Message-ID: <44g2fs$pmr@enterprise.powerup.com.au> X-Deja-AN: 110984491 references: <4426df$5kr@goanna.cs.rmit.EDU.AU> followup-to: comp.os.linux.setup,aus.computers.linux,alt.os.linux,alt.uu.comp.os.linux.questions,comp.os.linux.misc,de.comp.os.linux organization: PowerUp reply-to: bgerseko@mail.powerup.com.au newsgroups: comp.os.linux.setup,aus.computers.linux,alt.os.linux,alt.uu.comp.os.linux.questions,comp.os.linux.misc,de.comp.os.linux