From owner-freebsd-questions@FreeBSD.ORG Mon Dec 29 02:23:11 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6A2C816A4CE for ; Mon, 29 Dec 2003 02:23:11 -0800 (PST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id 50A8743D2F for ; Mon, 29 Dec 2003 02:23:09 -0800 (PST) (envelope-from malcolm.kay@internode.on.net) Received: from beta.home (ppp109-47.lns1.adl1.internode.on.net [150.101.109.47])hBTAN6p5017126; Mon, 29 Dec 2003 20:53:06 +1030 (CST) Content-Type: text/plain; charset="iso-8859-1" From: Malcolm Kay Organization: At home To: "Francisco Reyes" , "FreeBSD questions" Date: Mon, 29 Dec 2003 20:53:06 +1030 User-Agent: KMail/1.4.3 References: <200312290635.hBT6ZCU6000355@mail1.acecape.com> In-Reply-To: <200312290635.hBT6ZCU6000355@mail1.acecape.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200312292053.06324.malcolm.kay@internode.on.net> Subject: Re: Fwd: Re: Please help. Can't see HD X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Dec 2003 10:23:11 -0000 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 . 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