boot sector f*ed

PJ af.gourmet at videotron.ca
Tue Aug 11 17:31:58 UTC 2009


Polytropon wrote:
> On Tue, 11 Aug 2009 09:34:13 -0400, PJ <af.gourmet at videotron.ca> 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 ...



More information about the freebsd-questions mailing list