Date: Thu, 13 Aug 2009 00:03:40 +1000 (EST) From: Ian Smith <smithi@nimnet.asn.au> To: PJ <af.gourmet@videotron.ca> Cc: Polytropon <freebsd@edvax.de>, wmoran@potentialtech.com, freebsd-questions@freebsd.org Subject: Re: boot sector f*ed Message-ID: <20090812224925.U19821@sola.nimnet.asn.au> In-Reply-To: <4A82A8D9.30406@videotron.ca> References: <20090811173211.6FE4D106567B@hub.freebsd.org> <20090812193008.F19821@sola.nimnet.asn.au> <4A82A8D9.30406@videotron.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 12 Aug 2009, PJ wrote: > Ian Smith wrote: > > On Tue, 11 Aug 2009 17:52:29 +0200 Polytropon <freebsd@edvax.de> wrote: [..] > > > Let's assume ad0 is your source disk and ad1 the target disk. > > > > > > You can use the sysinstall tool to slice and partition the target > > > disk. You can create the same layout as on the source disk. Of > > > course, using tools like bsdlabel and newfs is valid, too. If you're > > > done, things go like this: > > > > > > 1. Check the source. > > > > > > # fsck /dev/ad0s1a /dev/ad0s1e /dev/ad0s1f /dev/ad0s1g > > > /dev/ad0s1h > > > > Er, from PJ's original message (and the subject line) the boot sector, > > sector 0, is hosed. So the partition/slice table is hosed, or at least > > untrustworthy. So what then can /dev/ad0s1a and the others refer to? > > > > dd may indeed be the best way to at least get a raw copy of the existing > > disk. After which perhaps the boot sector can be rewritten with the > > right values (if available?) so that such as fsck and dump can proceed. > Thanks, Ian... > I'm actually at the stage of doing the save/copy/transfer or whatever > you can call it: here's what I am thinking and on which I need > clarification. > I ran HDD regenerator and it immediately flagged the very first sector > as being Bad. On bootint, just before the crash, the boot process > started... hesitated, lurched forward, hesitated and then proceeded to > load only some minutes later closing down with a 177mb dump. > I knew then there was a problem.. :-) The dump, presumably from a panic, may be related or a consequence of whatever hardware issue may have clobbered your boot sector, or it may not. Your disk may be really in trouble, or it may just need its boot sector rewriting, if not a 'hard' sector error. But first, backup .. > I have a 2nd disk just checked (with the regenerator - 12 hrs waiting on > 2.4ghz cpu). I don't know of this regenerator. dd'ing a drive to /dev/null is a pretty good way to surface test a disk, not taking a fraction that long. > If, indeed, the boot sector is the only thing mucked up, I should be > able to copy the rest onto the 2nd(target) disk NP. The question, then, Read man dd carefully, do some practice runs. You'll want conv=noerror to copy all but any bad sectors, or dd may fail. For any section with bad sectors, you may need to use bs=512 and maybe skip (source) and seek (destination) to keep things aligned. I'm no expert on dd, have't had to do that for years, nor am I so hot on fdisk, bsdlabel or boot0cfg on FreeBSD 7, but there are plenty of folks here that are. > is how to deal with the boot sector. As I understand it, the boot sector > has the partition information needed to run things for the rest of the > disk. So, copying the damaged source disk will not give me the boot > sector needed. That's right, and no, but if you salvage everything else, and you know which slice/s were used and how big its partition/s are, you should be ok. Once back up, apart from normal backups, having a copy of your boot sector plus fdisk / bsdlabel output on another disk - or even on paper - can be very handy :) > I happen to have a another instance of 7.2 installed on a smaller disk > but that boot sector, obviously will not be quite right, right? No, you don't want to copy another disk's boot sector; you'll want to use fdisk to make a new one that fits. If there's a jumper for it, write protect the bad drive first, and move it away from being ad0. Seek expert help on the commands, as above .. > I presume that I can just boot up the spare 7.2 disk, do the dd stuff > from source to target and we have stage 1 done. If the disk sizes match, should be good. > I get the impression to get this second stage (the boot stuff) I should > do a minimal setup of the original configuration on a third disk the > same size as the source and then copy the boot sector to the tartget. If > for some reason, I haven't got the slices/partitions right, then I can > just redo the whole shebang until I've got it right. > A little tortured, but could work, or have I got it wrong? > Of course, if there is a more elegant and simpler solution, shoot ! Again, I wouldn't copy a boot sector (though on identical disks, that should work). fdisk will write a new boot sector, and if you've got the slice sizes right, then your old bsdlabels should still be there for your various BSD partitions. Now .. exit the clown and bring on the fdisk / bsdlabel experts, please. Good luck, Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090812224925.U19821>