# Installing FreeBSD 9 rendered hard drive unusable



## NewGuy (Jan 8, 2012)

Today I tried installing FreeBSD 9 (32-bit) on a machine which had been booting into Windows XP without any trouble. I went through the FreeBSD installer, took all the defaults, let FreeBSD take over the entire drive, and the install appeared to complete without any problems. I rebooted the machine and now, if the internal hard drive is connected, the computer will not proceed past the POST screen. The keyboard doesn't respond, I can't access the BIOS, the boot device menu, anything. If I disconnect the internal hard drive that has a fresh install of FreeBSD 9 on it, then I can boot from a CD or USB key, access the BIOS, change boot devices, etc.

Somehow it seems installing FreeBSD 9 rendered the computer unusable as long as that drive is attached. I've performed installs of FreeBSD before (along with Linux, Windows, etc) and I've never seen this happen before. Any suggestions as to what happened and what I can do to fix it?


----------



## fbsd1 (Jan 8, 2012)

This is a known problem with bsdinstall in 9.0. Newer pc's have bios that use gpart format disk partition layouts (IE windows7) so for FreeBSD to be compatible with new PC hardware, Bsdinstall defaults to using the gpart format disk partition layouts. Bsdinstall provides no automatic way to create (mbr, Dos) format partitions. The user is suppose to know before installing 9.0 that their pc hardware requires (mbr, Dos) format partitions and instead of using the automatic gpart format disk partition layouts they must select the manual option which opens a shell where the installer must enter the native commands to create the (mbr, Dos) format partitions like sysinstall did in 8.2 and older releases. This puts a unfair burden on users to know beforehand whether their pc bios are gpart aware. Bsdinstall provides no displayed information informing the user of what they need to know about their equipment before selecting the disk format to use.

At this time the only way to automate the creation of the (mbr, Dos) format partitions using the 9.0 bsdinstall is to select the manual option in the disk config screen and them launch "sade", this is the disk configuration dialog from sysinstall that has been turned into a standalone utility.

The bsdinstall has absolutely no built in HELP, But there is some new documentation in the online FreeBSD manual.
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/bsdinstall.html
It's under constant revision so it may not be totally accurate, but it will provide you some insight to your disk config problems.

Note: before you can use that gpart disk to create mbr you have to delete the (crap) gpart writes at the end of the physical disk. This script works great to do that.

http://www.wonkity.com/~wblock/docs/html/disksetup.html

After running the script, then on same disk pc install 8.2 and reboot.
If it boots fine then you know for sure your pc bios is not gpart aware, and you will always have to use mbr disk format on that pc hardware combination. The SADE utility will become your long time friend.


----------



## NewGuy (Jan 8, 2012)

Thank you, that makes sense. I'm pretty sure this box is old enough it wouldn't be gpart-aware. I will try the install again with sade and see how it goes.


----------



## wblock@ (Jan 8, 2012)

fbsd1 said:
			
		

> This is a known problem with bsdinstall in 9.0.



Um, no.



> Newer pc's have bios that use gpart format disk partition layouts (IE windows7) so for FreeBSD to be compatible with new PC hardware, Bsdinstall defaults to using the gpart format disk partition layouts.



This is not correct.  A GPT partition table has a "protective MBR".  As far as the BIOS boot code is concerned, it looks just like a normal MBR with one large partition that fills the disk.  http://en.wikipedia.org/wiki/GUID_Partition_Table is pretty good.

In other words, GPT is compatible with old or new computers.  There is no requirement for newer systems.



> Bsdinstall provides no automatic way to create (mbr, Dos) format partitions.



Agreed.  Because of the above, MBR creation is rarely needed.  An MBR layout can be manually created with the bsdinstall partition editor; I've documented that here.



> The user is suppose to know before installing 9.0 that their pc hardware requires (mbr, Dos) format partitions and instead of using the automatic gpart format disk partition layouts they must select the manual option which opens a shell where the installer must enter the native commands to create the (mbr, Dos) format partitions like sysinstall did in 8.2 and older releases. This puts a unfair burden on users to know beforehand whether their pc bios are gpart aware.



Fortunately, that is not the case.  A special BIOS is not needed to boot a GPT disk.

So if GPT is (probably) not the problem, what is?

As I posted when this question was first asked on the mailing list, some particular computers expect a certain disk layout.  Old Compaq computers kept the BIOS on the drive.  Very new computers have a special partition layout for UEFI.  Some Acer machines expect certain partitions.  If we knew the brand and model of the computer in question (still a mystery), someone may know more about what it wants.  Or maybe there was a hardware failure at just that time.  Or maybe that make and model of hard drive has problems.  Or maybe the controller in the computer has problems with the 9.0 driver.


----------



## NewGuy (Jan 8, 2012)

Quick update to this issue... I tried wiping the drive and then attempted another install, this time doing the partitioning manually and using MBR instead of GPT. The end result was the same, the computer refused to proceed past the POST screen with the hard drive connected.

Curious as to whether the drive could have developed a problem in such a short time (since yesterday), I wiped it again and performed an install of Ubuntu Server, taking all the defaults. That OS installed and I was able to boot into it without any problems. My conclusion is the hardware is OK, there is something specific to FreeBSD (a driver or disk layout or something) which doesn't work with this machine.

The machine is an old eMachines W3107 with a 100GB hard drive ATA hard drive. Not sure of the exact model of the drive as I haven't removed it, only disconnected it during my tests.

At any rate, it's not particularly important. I have a server install on there now, not with my first choice of OS, but at least it's up and running.


----------



## wblock@ (Jan 8, 2012)

Wait...  How did you wipe the drive if it prevented booting the computer it was connected to?


----------



## NewGuy (Jan 8, 2012)

I disconnected the drive long enough to get past the POST screen. Then selected my USB stick from the boot device menu and then reconnected the internal drive. I was able to manipulate the drive from the OS on the USB stick. The internal drive only prevented using the machine at start-up, once the machine was up and running accessing the drive didn't cause any problems.


----------



## wblock@ (Jan 8, 2012)

Hot-swap on IDE drives is not good, but obviously it worked.  It tells a little more about what is going on, too.  It was not a problem with the drive, but with what the BIOS found on it.  That a plain MBR didn't work is really weird.  It might have done that if the MBR bootloader wasn't installed, but most BIOSes will give a "No operating system" message.


----------



## NewGuy (Jan 8, 2012)

Agreed, on all points.


----------



## fluca1978 (Jan 12, 2012)

wblock@ said:
			
		

> Hot-swap on IDE drives is not good, but obviously it worked.  It tells a little more about what is going on, too.  It was not a problem with the drive, but with what the BIOS found on it.  That a plain MBR didn't work is really weird.  It might have done that if the MBR bootloader wasn't installed, but most BIOSes will give a "No operating system" message.



It would be interesting to install Linux using GPT (I think Ubuntu did not use it as default) to see what happens. While GPT should not be the cause, it is the only thing that changes from FreeBSD and Ubuntu installation, so it must be related to it. Could it also be a wrong block size set up in the BIOS? Just a guess.


----------



## jstarcher (Mar 14, 2012)

fbsd1 said:
			
		

> This is a known problem with bsdinstall in 9.0. Newer pc's have bios that use gpart format disk partition layouts (IE windows7) so for FreeBSD to be compatible with new PC hardware, Bsdinstall defaults to using the gpart format disk partition layouts. Bsdinstall provides no automatic way to create (mbr, Dos) format partitions. The user is suppose to know before installing 9.0 that their pc hardware requires (mbr, Dos) format partitions and instead of using the automatic gpart format disk partition layouts they must select the manual option which opens a shell where the installer must enter the native commands to create the (mbr, Dos) format partitions like sysinstall did in 8.2 and older releases. This puts a unfair burden on users to know beforehand whether their pc bios are gpart aware. Bsdinstall provides no displayed information informing the user of what they need to know about their equipment before selecting the disk format to use.
> 
> At this time the only way to automate the creation of the (mbr, Dos) format partitions using the 9.0 bsdinstall is to select the manual option in the disk config screen and them launch "sade", this is the disk configuration dialog from sysinstall that has been turned into a standalone utility.
> 
> ...



Thank you so much for this post! I have having the exact same issues described above with the following system:

DFI Ultra-D Motherboard (BIOS without EFI)
AMD Opteron 165
4 GB Ram
Seagate Barracuda 7200.10 500GB SATA

Whatever the default installation did with GPT my BIOS did not like at all. It would freeze on the initial bios screen where it detects the drives, just as described above. To unbrick after initial installation I had to unplug the SATA cable, boot PartedMagic, clear the disk with gparted and reset the drive to MBR inside gparted. I was then able to get back to the FreeBSD installation where I used your instructions to drop into shell mode when it asked how to partition, and I used SADE to partition. However, the installation crashed on extraction using SADE so I switched to the the built-in partition editor but did it manually and used MBR for the slice. After installation I dropped into shell mode and ran:

```
boot0cfg -B /dev/ada0
```

Rebooted and it worked! What a headache but I'm so happy I stuck with it. Thanks for the support, your site is great and I'd love to see a 9.x version of the installation guide.


----------



## fonz (Mar 14, 2012)

jstarcher said:
			
		

> I'd love to see a 9.x version of the installation guide.


http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/bsdinstall.html


----------



## Juanitou (Nov 18, 2012)

Hi!

Newcomer to FreeBSD, it's difficult to understand why this is not considered a bug. I had exactly the same problem: New install using the whole of a 40GB disk went well but the computer stops on reboot, after POST messages detecting the drives. Only solution is to remove the disk. I've tried all solutions proposed here and elsewhere with no avail: GPT or MBR, guided, shell or manual paartitioning... nothing to do!

Then I modified the 'Access Mode' in the BIOS for this IDE channel from Auto to CHS/LBA/Large (all of them work) and FreeBSD booted at last.

How this could become a sensible bug report? I understand that it's the old BIOS (AWARD v6, MSI K8MM-V fully updated, ca. 2006) which is faulty, but it's a pity to decourage new FreeBSD users...

Hope it helps,
Juan


----------



## nakal (Nov 18, 2012)

I consider this a wrong implementation in the mainboard firmware.

I know this problem, too. Some boards are trying to understand the partition table of the hard drive instead of "just boot this thing". They try to evalutate the information because some manufacturers are adding recovery partitions and even extended firmware functionality (small Linux installations).

Check for firmware updates for your mainboard or use the original bootloader with the recovery partitions and all stuff which has been given to you by the manufacturer. Optionally: don't buy from this manufacturer anymore.


----------



## Juanitou (Nov 18, 2012)

nakal said:
			
		

> Check for firmware updates for your mainboard or use the original bootloader with the recovery partitions and all stuff which has been given to you by the manufacturer. Optionally: don't buy from this manufacturer anymore.



I took this MB from a pile of used ones, I'm just trying to rebuild a hobby system from spare parts. Well, I hope at least somebody will find useful the hack of changing the IDE access mode.

Thanks for the explanation!
Juan


----------



## Terry_Kennedy (Nov 18, 2012)

nakal said:
			
		

> Some boards are trying to understand the partition table of the hard drive instead of "just boot this thing". They try to evalutate the information because some manufacturers are adding recovery partitions and even extended firmware functionality (small Linux installations).


This may be an interaction with any "boot sector virus detection" in the BIOS, since that tries to look at the drive as having MBR boot and partitions.

I've also found some BIOS implementations (not recently) that just load the first sector and jump to it without verifying that there's actually a good signature and reasonable code in the boot sector.

This is liable to get worse, not better, with a different set of problems when Windows 8 machines with UEFI get re-purposed to run a non-Windows OS.


----------



## NewGuy (Nov 19, 2012)

I don't think this should be passed off as "the motherboard's problem". While it may technically be the motherboard's fault, if other operating systems (eg Linux and Windows) work on the same hardware and FreeBSD doesn't, then people will (correctly, I feel) see this as a FreeBSD-specific problem. FreeBSD has a fairly small community and equipment makers are not going to cater to the FreeBSD crowd, the developers are going to have to either fix this or accept a loss of users.


----------



## jstarcher (Nov 19, 2012)

I agree and feel that a simple warning during the installation would be enough to resolve this issue.


----------



## jb_fvwm2 (Nov 19, 2012)

I see this as mostly a lack of a flowchart-guided install.  Maybe a huge flowchart, but I recall (the general idea... applied to software, anyway...) more or less standard back in the windows 3.1 shareware days.  Whatever problem or newfound hardware anomaly exists, it is simply blended into the flowchart with a few more lines and persons doing any install migrate from side to side or side to top or...
Similarly as a "perl cookbook" may accomplish more, more readily than .c code; (several days rather than several weeks...) 
Though it would need a team of experts.  I'm certainly nowhere near expert mode on any install methodology, even having had to do it multiple times (mostly due to hard disk failures) over the years.  Thus, proprietary motherboard? If it does not fit into the flowchart, a simple footnoted box would point, maybe to a link where alternative motherboards may be found...


----------



## nakal (Nov 19, 2012)

Terry_Kennedy said:
			
		

> I've also found some BIOS implementations (not recently) that just load the first sector and jump to it without verifying that there's actually a good signature and reasonable code in the boot sector.



They should only execute the code if there is 0x55 0xaa at the end of the first sector. In this case there will be code for bootloader or just code for displaying "Cannot boot this" in the MBR.

It *is* is the motherboard's firmware problem, because it hangs before you can even enter the BIOS settings. Such a behavior is not defined and of course not acceptable.

Also, as far as I understood, you should not use UEFI setting in your BIOS firmware. Set it to PC BIOS, because UEFI requires different kind of startup code, which FreeBSD does not provide.


----------



## mrdodo (Mar 30, 2013)

Juanitou said:
			
		

> Hi!
> 
> Newcomer to FreeBSD, it's difficult to understand why this is not considered a bug. I had exactly the same problem: New install using the whole of a 40GB disk went well but the computer stops on reboot, after POST messages detecting the drives. Only solution is to remove the disk. I've tried all solutions proposed here and elsewhere with no avail: GPT or MBR, guided, shell or manual paartitioning... nothing to do!
> 
> ...




Thank you so much for this! Changing the Access Mode on the BIOS got my system to boot too. I am still kind of new to FreeBSD as well (used it off and on for years) and am a little disappointed by this issue. My general assumption has always been that it should be a pretty safe bet that FreeBSD will work on older hardware, which it is seeming this is issue is occurring on. I was almost discouraged myself from getting back on the bandwagon of using it, so if there is anyway to workaround this I think it would be a big win.


----------

