From owner-freebsd-questions@FreeBSD.ORG Wed Nov 8 16:01:33 2006 Return-Path: X-Original-To: FreeBSD-Questions@freebsd.org 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 3607416A4F3 for ; Wed, 8 Nov 2006 16:01:33 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (gizmo.acns.msu.edu [35.8.1.43]) by mx1.FreeBSD.org (Postfix) with ESMTP id C52DE43D49 for ; Wed, 8 Nov 2006 16:01:24 +0000 (GMT) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (localhost [127.0.0.1]) by gizmo.acns.msu.edu (8.13.6/8.13.6) with ESMTP id kA8G0Q7E077998; Wed, 8 Nov 2006 11:00:26 -0500 (EST) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: (from jerrymc@localhost) by gizmo.acns.msu.edu (8.13.6/8.13.6/Submit) id kA8G0P7U077997; Wed, 8 Nov 2006 11:00:25 -0500 (EST) (envelope-from jerrymc) Date: Wed, 8 Nov 2006 11:00:25 -0500 From: Jerry McAllister To: Richard McIntyre Message-ID: <20061108160025.GA77859@gizmo.acns.msu.edu> References: <003a01c6ee0a$841e74f0$6908a8c0@pcmoperations> <20061012182206.GA81008@Grumpy.DynDNS.org> <452FE303.90002@tco2.thecompanyonline.com> <452FEAD6.7030800@tomjudge.com> <4550FF54.80908@tco2.thecompanyonline.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4550FF54.80908@tco2.thecompanyonline.com> User-Agent: Mutt/1.4.2.2i Cc: FreeBSD-Questions@freebsd.org Subject: Re: Hard Drive Issues X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2006 16:01:33 -0000 On Tue, Nov 07, 2006 at 04:49:08PM -0500, Richard McIntyre wrote: > Tom Judge wrote: > > >Richard McIntyre wrote: > > > >>I'm having a similar problem, > >>Oct 13 03:01:31 tco1 kernel: ad2: FAILURE - READ_DMA > >>status=51 error=40 LBA=181778119 > >>Oct 13 07:11:15 tco1 kernel: ad2: FAILURE - READ_DMA > >>status=51 error=40 LBA=181778119 > >> > >>I'm assuming that particular sector on the drive is dying, I have > >>backed everything up on the drive, can anyone give me more > >>information, should the drive simply be replaced or is it possible > >>that this is simply a TOC error and could be corrected by newfs to > >>the drive? > >> > >>I'm guessing it will need to be replaced, output of smartctl is > >>below.... > >> > >>Thanks > >>~Richard > >> > >>Error 7742 occurred at disk power-on lifetime: 16036 hours (668 days > >>+ 4 hours) > >> When the command that caused the error occurred, the device was > >>active or idle. > >> > >> After command completion occurred, registers were: > >> ER ST SC SN CL CH DH > >> -- -- -- -- -- -- -- > >> 40 51 04 c7 b6 d5 ea Error: UNC 4 sectors at LBA = 0x0ad5b6c7 = > >>181778119 > >> > > > > > >Looks like you disk is on its way out, from the look of the above > >errors, I would try dd'ing the disk onto a new disk the running an > >fsck to make sure everything is ok. I wouldnt hold out much hope for > >recovering the data on that sector though. > > > >Tom J > > > > All, > > I've put a new disk into the system, The current disk is 200 GB, the new > disk is 250 GB. > If I run the command: > dd if=/dev/ad2 of=/dev/ad3 conv=noerror > > Will this copy the (changing the appropriate device names of course) the > disk as a whole? Yes, but it is not the best way to do it. > Will I lose the 50 GB difference? Yes you will. >> (NOTE I swapped a couple of lines of you message for clarity in responding) > The drive is two partitions, one 100GB and the remainder on the other > partition. The files contained are backups of my virtual hosted sites > and the apache directories (including the apache/bin files). > > Any suggestions? I've read a good deal of forums online but they seem to > be contradicting. 1/2 say I will loose the remainder of the drive space, > 1/2 say that dd is not the best way to go. (there is roughly 35 GB of > data actually on the device). > I agree that dd is not the way to go. It doesn't do what you want it to do. It makes a sector for sector copy and you really want functionally identical filesystems and couldn't care less about the sector layout - only the file integrity. dd does nothing for file integrity and only gets the filesystems right by accident. > Is there another way? (like the dump, tar, or just plain copy command?) You should fdisk, bsdlabel and newfs the new disk the way you want it. If it is to be bootable, use -B switch on fdisk. If it is to be the only slice on the disk also use -I fdisk -BI ad3 Then do two bsdlabels - one to mark it and put in the slice boot code the other to create the partitions. bsdlabel -w -B ad3s1 bsdlabel -e ad3s1 That second bsdlabel will cause an edit session to open and you edit the partitions the way you want - maybe like the old one. Lets say you make the following: a: for root b: for swap d: for /tmp e: for /usr f: for /home look at your present disk with bsdlabel to see what it already has set up. Just running bsdlabel on a slice without any other parameters will cause it to print out its information, so try: bsdlabel ad2s1 Ignore all the stuff above where it displays the partition information. Use a star (*) for the size and offset of the last partition and it will just make it all the rest of the slice (drive if you made it one slice). Then use newfs(8) to create a filesystem on each partition you created with bsdlabel, except for swap. Swap doesn't get newfs-ed. Taking the defaults is probably good enough. Create new mount points for the new disk as needed, for example: mkdir /newroot mkdir /newusr mkdir /newhome Mount the new filesystems, given the above, do: mount /ad3s1a /newroot mount /ad3s1e /newusr mount /ad3s1f /newhome New copy the old file systems using dump/restore cd /newroot dump 0af - / | restore -rf - cd /newusr dump 0af - /usr | restore -rf - cd /newhome dump 0af - /home | restore -rf - Generally you wouldn't bother copying /tmp, but you could. This procedure will get you the copies you want which using dd will not. It will also correctly use up the whole drive which using dd will not. Your drive, no doubt, has a different layout than my examples above, but the process will be the same, just with appropriate name changes. If dump is unable to read some part of a file system due to a bad sector on the disk, then dd will also not be able to do it properly while reading the whole disk either. You will then have to play around trying to remove the file that is bad so dump will not attempt to read it, or, much more difficult, try to follow the chain manually and recover all of the file except the bad sector if it is important. I think there are some utilities that can help you do that, but I do not know them. If you get a list of all the sectors in the file, then you can also probably manually read each separately and put them back together manually. That can be very tedious to do by hand and you would have to think seriously about the importance of that particular file. Hopefully, you won't have to deal with this. Good luck, ////jerry > > FreeBSD tco1.thecompanyonline.com 5.3-RELEASE FreeBSD 5.3-RELEASE #0: > Mon May 2 22:32:50 EDT 2005 > rem@tco1.thecompanyonline.com:/usr/src/sys/i386/compile/TCO1.2005.05.02.001 > i386 > > Thank you for the help! > > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"