moving a disk

Tim Judd tajudd at gmail.com
Mon Aug 24 18:40:08 UTC 2009


On 8/24/09, Roland Smith <rsmith at xs4all.nl> wrote:
> On Mon, Aug 24, 2009 at 11:50:28AM -0400, PJ wrote:
>> PJ wrote:
>> > I am trying to move a 7.2 installation to another computer where it is
>> > to be the only OS acting as a server for the lan.
>> > On bootup I get the message:
>> > Using drive 0, partition 3.
>> > And there it hangs.
>
> Probably because the boot code can't find the 3rd stage loader... It is
> strange that it is trying partition 3 instead of partition 4.

0-based.  OpenBSD when set to install and use all of a disk, sets it
to the last primary partition (1-based = 4, 0-based = 3).

>
> Did you prepare the disk as explained in the handbook (§16.3 "Adding
> Disks")?
> I get the impression that you didn't. And that can have caused the problem.
>
> Try booting again, and press any key to interrupt the boot process to get to
> the boot prompt. You should see something like:
>
>     >> FreeBSD/i386 BOOT
>      Default: 0:ad(0,a)/boot/loader
>      boot:
>
> At this boot prompt, type
>
> 0:ad(0,4,a)/boot/loader<ENTER>
>
> This will try to boot from the 4th partition. See boot(8). N.B. the boot
> manpage uses the term 'slice' for partitions. By default the boot code looks
> for either the active slice or the first slice with the freebsd type.

This drive still is likely having OpenBSD bootblocks in the MBR and
track.  I don't expect OpenBSD to boot FreeBSD.

>
>> > I have tried to rewrite the mbr but that did absolutely nothing.
>
> That is not surprising, The mbr is only part of the boot process. The
> problem
> seems to be that it cannot locate the rest... Read the chapter "The FreeBSD
> Booting Process" from the FreeBSD Handbook. And see
> http://en.wikipedia.org/wiki/Master_boot_record
>
> This will provide insight into how FreeBSD actually boots. It is a bit of a
> convoluted process due to historical restrictions of the PC
> architecture. Reading the manual pages for fdisk(8), boot(8) and loader(8)
> might also prove enlightening.
>
>> > fik ad0 returns:
>> > partitions 1,2,3 are <UNUSED>
>> > Parrtition 4 give the cylinder, heads, sectors, blocks stuff
>
> Why did you install on partition 4? Normally one would use parition 1.

and sysinstall would use (0-based = 0, 1-based = 1) the first partition too.

>
>> > What should I do? And what information do I need to supply or look for
>> > to solve this.
>
> See below.
>
>> > I'd rathernot go through another installation even if this is farly
>> > elementary.
>
> With any luck you don't have to.
>
>> > Oh, yes... all my former problems were definitely software related as I
>> > have checked and double, triple checked my HDDs and cannot find any
>> > problems therewith.
>
>> here is what I have found in looking at the disk when it's mounted
>> on another FBSD system through an USB interface:
>> it is mounted on /dev/ad0
>> fdisk ad0 ---> returns partitions 1,2,3 as <UNUSED>; partition 4 is
>> marked for sysid 166 OpenBSD (this seems to be left over from an
>> installation that was never completed)
>
> It should be type 165 for FreeBSD! _Or_ partition 4 should be marked as
> active
> (flag 80). Is it? If not you can use the -a flag of fdisk to update the
> active
> partition.  I think you should use something like 'fdisk -u -a -4 ad0'. Look
> at the fdisk manual page to see what this does. I'm not sure if this is the
> right invocation. I have never dealt with this problem.
>
> Setting the active partition _should_ be enough. If that doesn't work,
> you're in
> trouble. As far as I know there is no easy way to just change the partition
> type, without starting over. In theory you can set the type by fiddling some
> bits in the partition table, but that is probably harder than it sounds.
> Maybe
> sysinstall can do it, but I haven't tried.
>
> Next time you want to install FreeBSD on a disk, read §16.3 "Adding Disks"
> of
> the FreeBSD handbook first, and follow the steps laid out there! That would
> create and active a single partition which would almost certainly have
> avoided
> this problem.
>
>> I also note that the other functioning FBSD 7.2 has partitions 2-4 as
>> <UNUSED> and partition 1 has the cylinder parameters.
>>
>> I get the impression that I should use the disklabel editor to change
>> all that but am not familiar with it and am not sure how to use it.
>
> No. The disklabel works at a lower level.
>
> Historically PC harddisks can be divided into 4 partitions (This is what
> fdisk
> does). So the disk ad0 can have partitions 1--4: ad0s1--ad0s4. In older
> FreeBSD
> literature these are called slices, hence the 's' in the partition name.
>
> FreeBSD can subdivide a partition in labeled sections. These sections are
> labeled with a letter, so partition ad0s1 can be divided (in 7.x) into
> labeled
> pieces a--g: ad0s1a--ad0s1g. This is what the bsdlabel(8) program does. And
> it
> is usually on these subdivisions that filesystems are created with newfs(8).
>
>> Is there a way to fix this thingy?
>
> Make sure that partition 4 is the active partition. That should fix it.
>
> Roland
> --
> R.F.Smith                                   http://www.xs4all.nl/~rsmith/
> [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
> pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
>


HTH


More information about the freebsd-questions mailing list