Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Dec 2003 20:53:06 +1030
From:      Malcolm Kay <malcolm.kay@internode.on.net>
To:        "Francisco Reyes" <francisco@natserv.com>, "FreeBSD questions" <questions@freebsd.org>
Subject:   Re: Fwd: Re: Please help.  Can't see HD
Message-ID:  <200312292053.06324.malcolm.kay@internode.on.net>
In-Reply-To: <200312290635.hBT6ZCU6000355@mail1.acecape.com>
References:  <200312290635.hBT6ZCU6000355@mail1.acecape.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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=20
for BSD (not necessarily slice slice 1; but) the first one physically aft=
er=20
the MBR then then it  is likely you have overwritten the disklabel and a=20
substantial part of the 'a' or root partition whether 4Mb is the=20
compressed or expanded size. And without some form of dual boot we=20
can guess that this is the only slice carrying a file-system (or systems)=
=2E

Given that the above assumptions are valid we are lead to the=20
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=20
might go back to installation and try to create the same slices, partitio=
ns
and mount points. It looks as though the root partition has been=20
destroyed but you might hope that the rest are intact. Make sure that=20
you mark the 'a' partition for a new file system and all others as alread=
y=20
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=20
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 lo=
ok=20
for a different approach and some more difficult guesses!
  =20
>
> >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 c=
learly
about what you are doing and then double chheck evry command before=20
hitting <Enter>. Keep operation under user root to an absolute=20
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 st=
ate and this
can be redirected to file and then stored on your backup media or a flopp=
y 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 mechanism=
s=20
for BSD. But to duplicate, in its entirety, the original setup you need t=
o also save
fdisk and disklabel information. Disk images are unreasonably expensive i=
n time
since they also backup empty space, require a physically identical disk f=
or recovery
and can give some difficlties as the image=20
is usually of an open file system which checks out as unclean.

Malcolm Kay



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312292053.06324.malcolm.kay>