From owner-freebsd-questions@FreeBSD.ORG Tue Aug 11 17:31:57 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6B3D1065679 for ; Tue, 11 Aug 2009 17:31:57 +0000 (UTC) (envelope-from af.gourmet@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.freebsd.org (Postfix) with ESMTP id BD9568FC3F for ; Tue, 11 Aug 2009 17:31:57 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=UTF-8 Received: from [192.168.0.51] ([96.21.103.185]) by VL-MH-MR002.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-4.01 (built Aug 3 2007; 32bit)) with ESMTP id <0KO800J2I3CZMIW0@VL-MH-MR002.ip.videotron.ca> for freebsd-questions@freebsd.org; Tue, 11 Aug 2009 13:31:47 -0400 (EDT) Message-id: <4A81AB08.2050205@videotron.ca> Date: Tue, 11 Aug 2009 13:31:52 -0400 From: PJ User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) To: Polytropon References: <4A816EC9.7070408@videotron.ca> <20090811092214.e38fd90c.wmoran@potentialtech.com> <4A817355.20006@videotron.ca> <20090811175229.8c3eb361.freebsd@edvax.de> In-reply-to: <20090811175229.8c3eb361.freebsd@edvax.de> Cc: Bill Moran , freebsd-questions@freebsd.org Subject: Re: boot sector f*ed 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: Tue, 11 Aug 2009 17:31:58 -0000 Polytropon wrote: > On Tue, 11 Aug 2009 09:34:13 -0400, PJ wrote: > >> I've got another disk about the same size on the machine and I'm >> wonderiing how could I transfer the whole shebang to it? >> > > Maybe an 1:1 copy using dd with a bs=1m would work. > Sorry for my ignorance, but what language is that? :-) What's "dd with a bs=1m"? > > > >> Would doing a minimum 7.2 install be enough, followed by copying all the >> slices to the corresponding slices on the new disk? >> I'm thinking of mounting the broken drive on the new one and then >> copying... does that sound about right? >> > > No. Does not. :-) > > The proper way of doing this - or at least ONE of the proper ways - > is to use the intended tools for this task. These are dump and > restore. > > First of all, you use a FreeBSD live system (such as FreeSBIE) or > the livefs CD of the FreeBSD OS to run the OS. The goal is: Most > minimal interaction with the drives. > > 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. I'm being ultra careful and checking/regenerating the target disk and that will t ake another 4 or 5 hours. I don't expect any difficulties, but would like to "triple check" the procedure... Ok - boot up livefs, slice & partition the target disk; but how do I continue? Do I go to the shell? If that is all it is, then I don't see much difficulty. I'll read the man pages to check all the commands below so I am clear on everything. > 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 > > Add -f (and dangerous -y) if intended. > > > > 2. You don't mount the source disk. Instead, you first prepare > the target disk which you mount. Then you use dump and restore > to transfer the data from the unmounted source partition to > the mounted target partition. > > # mount /dev/ad1s1a /mnt > # cd /mnt > # dump -0 -f - /dev/ad0s1a | restore -r -f - > > Keep an eye on where you mount it. Maybe the live system you > use already employs /mnt for its own purposes. Create /target > instead, or anything else you like. > > > > 3. After transferting /, continue with /tmp /var /usr and /home. > > # mount /dev/ad1s1a /mnt > # cd /mnt > # dump -0 -f - /dev/ad0s1a | restore -r -f - > > # mount /dev/ad1s1e /mnt/tmp > # cd /mnt/tmp > # dump -0 -f - /dev/ad0s1e | restore -r -f - > > # mount /dev/ad1s1f /mnt/var > # cd /mnt/var > # dump -0 -f - /dev/ad0s1f | restore -r -f - > > # mount /dev/ad1s1g /mnt/usr > # cd /mnt/usr > # dump -0 -f - /dev/ad0s1g | restore -r -f - > > # mount /dev/ad1s1h /mnt/home > # cd /mnt/home > # dump -0 -f - /dev/ad0s1h | restore -r -f - > > Of course, triplepluscheck the commands before running them! > > > > 4. Unmount the target disks. > > # cd / > # umount /mnt/home > # umount /mnt/usr > # umount /mnt/var > # umount /mnt/tmp > # umount /mnt > # sync > # halt > > Replace the disks and start using your target. > > > > >> I haven't looked at the broken one yet; I'll have to see what theat >> 177mg dump was.. >> > > Kernel image? > If it is, do I need it or what do I do with it? It is obviously(?) saved somewhere like /tmp ...