Fwd: Re: Please help. Can't see HD
Malcolm Kay
malcolm.kay at internode.on.net
Mon Dec 29 02:23:11 PST 2003
On Mon, 29 Dec 2003 17:09, Francisco Reyes wrote:
> On Mon, 29 Dec 2003 14:57:13 +1030, Malcolm Kay wrote:
> >How big was the image you copied to the disk? -- that should tell
> >you how much of your drive is overwritten.
>
> The image was about 4MB.
Before or after decompression;
It probably doesn't matter anyway. If you were using the slice partition
for BSD (not necessarily slice slice 1; but) the first one physically after
the MBR then then it is likely you have overwritten the disklabel and a
substantial part of the 'a' or root partition whether 4Mb is the
compressed or expanded size. And without some form of dual boot we
can guess that this is the only slice carrying a file-system (or systems).
Given that the above assumptions are valid we are lead to the
conclusion that the first sector of the BSD slice has gone along with the
disklabel information and a substantial prt of the root file system.
> >It is probable your disklabel has also disappeared, so you
> >probably need to reconstruct both the slice table in the MBR and
> >the disklabel in the first slice. With some vague recollections of
> >what you did originally to install FBSD it is possible that some
> >lucky guesses might work.
>
> How would I go about that?
OK; how did you install initially? Was the whole disk used for BSD?
Did you follow the defaults during installation?
If both the latter questions are answered in the affirmative then you
might go back to installation and try to create the same slices, partitions
and mount points. It looks as though the root partition has been
destroyed but you might hope that the rest are intact. Make sure that
you mark the 'a' partition for a new file system and all others as already
existing. The partitions are marked 'Y' or 'N' in the installation menu
but I can't remember which is which -- read the help explanation.
Proceed with a minimum installation and you should (with luck) retain
anything you have added to the non-root partitions.
After booting into the recreated system
you'll need to recreate users with their original UIDs. You can see what
these are by using ls -l in the user directories /usr/home/{user-name}
when the numericl uid will be displayed instead of the user name.]
If either of the questions were answered in the negative we'll need to look
for a different approach and some more difficult guesses!
>
> >If you can find the first sector of a slice carrying an installed file
> >system then this might hold a copy of the slice table allowing
> >reconstruction of the original MBR with some confidence.
>
> How?
Hopefully as above.
>
> Other than not playing around with dd how can one safeguard from
> something like this in the future?
Only issue instructions as 'root' when you are fully awake and thinking clearly
about what you are doing and then double chheck evry command before
hitting <Enter>. Keep operation under user root to an absolute
minimum. You are unlikely to be permitted to create this degree of havoc as
an ordinary user.
> Is there a way to backup the disklable and slice info?
>
Yes, disklabel and fdisk have facilities for outputting their current state and this
can be redirected to file and then stored on your backup media or a floppy disk.
I do this on a regular basis for a number of machines under my control. I also
include a copy of /etc/fstab and the output from df.
> After all this is cleared I am also going to check what is the
> best way to keep a working copy of my entire system. On windows
> I have a program, driveimage, which I use to every night keep an
> image of the entire disk while the system is on. Has saved me
> many times..
In my opinion dump and restore are the best backup and recovery mechanisms
for BSD. But to duplicate, in its entirety, the original setup you need to also save
fdisk and disklabel information. Disk images are unreasonably expensive in time
since they also backup empty space, require a physically identical disk for recovery
and can give some difficlties as the image
is usually of an open file system which checks out as unclean.
Malcolm Kay
More information about the freebsd-questions
mailing list