# FreeBSD 7.2 install issues on SATA



## mat17 (Jun 8, 2009)

Hi,

I have just tried to install FreeBSD 7.2 i386.
_Hard disk:_ 160Gb SATA II with windows 2000 pro sp4 on the 1st partition (NTFS).
_Sysinstall:_ minimal, with mbr untouched. I had to load if_ae for netinstall. Have noticed this warning when fdisk launched :

```
WARNING:  It is safe to use a geometry of 310101/16/63 for ad4 on
computers with modern BIOS versions.  If this disk is to be used
on rather old machines, however, it is recommended to ensure that
it does not have more than 65535 cylinders, or more than 255 heads
or more than 63 sectors per track.

Would you like that to keep using the current geometry?
```
I chose 'Yes'. After the installation, the freebsd slice not being active, the bios launched w2k partition. On the screen: just an underscore flashing. It skiped two lines then nothing.

Then I tried the same install but with freebsd boot managed and with the freebsd slice marked active. After rebooting, the freebsd boot manager launches.
If I try to load the w2k partition, I get: "Err. lecture disque Entrez Ctrl+Alt+Suppr pour redÃ©marrer" (ie "A Disk Read Error Occured. Press CTRL+ALT+DEL to restart"). As the message is in french, i believe that it comes from w2k.
If I try to load freebsd, nothing happens. The boot loader screen does not change and the underscore is still flashing on and off.

I am able to access my w2k partition with live cds and retrieve data. I ran w2k install cd in autorecovery mode but nothing fixed. I have really no idea about the origin of this issue and how to fix it. Any help would be greatly appreciated.

Here is what I get from fdisk when running sysinstall again:

```
Disk name: ad4
DISK Geometry: 310101 cyls/16 heads/63 sectors = 312581808 (152627MB)
Offset    Size(ST)  End       Name  PType Desc          Subtype     Flags
0         63        62        -     12    unused        0
63        30716217  30716279  ad4s1 4     NTFS/HPFS/QNX 7
(...) other partitions
153597465 25165287  178762751 ad4s4 8     freebsd       165
178762752 133819056 312581807 -     12    unused        0
```


----------



## graudeejs (Jun 9, 2009)

ignore


----------



## Beastie (Jun 9, 2009)

I've always experienced this problem. It's as old as FreeBSD 5 at the very least.

There's a problem with DOS/Win MBR partition entry C/H/S values (Microsoft did some f*ck ups 20 years ago) and FreeBSD's setup always tries to fix it no matter what you do, thus effectively rendering the Windows partition unbootable.

But usually when I install FreeBSD only the Windows partition is unbootable while the FreeBSD one boots fine, so I don't know exactly what happened in your case.

Anyway, what I do is boot from a Fixit CD BEFORE starting the FreeBSD setup, use fdisk to get the exact start and end C/H/S values for the Windows partition, install FreeBSD and finally restore the original values using "fdisk -u".

You wouldn't by chance have a backup of your MBR, would you?

As a last resort, try TestDisk. But before you do, read its documentation VERY carefully.

And for next time, do yourself a favor and make proper backups.


----------



## mat17 (Jun 9, 2009)

Beastie said:
			
		

> You wouldn't by chance have a backup of your MBR, would you?


Unfortunatly, no. Do you think that 'fixmbr' from w2k recovery console (install cd) can solve the problem? or it can be worse?



			
				Beastie said:
			
		

> As a last resort, try TestDisk. But before you do, read its documentation VERY carefully.


Which kind of problems can result from its use?

The mbr problem caused by fdisk/sysinstall always appears with an existing windows partition?


----------



## Beastie (Jun 9, 2009)

mat17 said:
			
		

> Do you think that 'fixmbr' from w2k recovery console (install cd) can solve the problem?


I very much doubt it. AFAIK, _fixmbr_ only re-writes the boot record and either leaves the partition table alone or even overwrites it with junk, just like its MS-DOS counterpart _fdisk /mbr_.




			
				mat17 said:
			
		

> Which kind of problems can result from its use?


None, as far as I can tell. But you should read the documentation to be aware of every option you got and know every step in the re-construction of your MBR. You should also be able to recognize your previous partitions (type, approximate size and location), because TestDisk searches the entire disk for boot records and if you re/installed many operating systems in the past, it might find former boot records that were never overwritten.




			
				mat17 said:
			
		

> The mbr problem caused by fdisk/sysinstall always appears with an existing windows partition?


Well, every time I did a dual-boot with Win98SE and Win2K, I got the same problem. However, it installs just fine alone. And it seems many people dual-boot with Linux without any problem.


----------



## mat17 (Jun 10, 2009)

*strange geometries*

I have tried 'testdisk' under linux 2.6.28.4 (knoppix). I am a bit confused because I don't really know what sysinstall has changed in the partition table. All my partitions are listed, with the right size. But freebsd's fdisk and linux 2.6's fdisk don't give me the same geometry.

My hard disk is an 160Gb SATA II. With linux's fdisk, I get

```
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
```
so a geometry of 19457/255/63 = 312592833 sectors with 512 bytes per sector, that is (63*(255*19457 + 255) + 63)*512 bytes = 160047530496 bytes = 160Gb.


But with sysinstall's fdisk, I get this geometry :

```
DISK Geometry: 310101 cyls/16 heads/63 sectors = 312581808 (152627MB)
```
so a geometry of 310101/16/63 = 4981773636 sectors != 312581808 (???).

Any ideas about these differents geometries? What sysinstall can have changed? Any issue related so SATA?


----------



## mat17 (Jun 11, 2009)

mat17 said:
			
		

> But with sysinstall's fdisk, I get this geometry :
> 
> ```
> DISK Geometry: 310101 cyls/16 heads/63 sectors = 312581808 (152627MB)
> ...



Well, I am wrong. FreeBSD detects 63*16*310101=312581808 sectors (and not 63*(16*310101+16)+63?) against 312592833 for linux. I have just checked the manufacturer's geometry : 312581808 LBA sectors.

Maybe the problem comes from the fact of using different CHS/LBA : */16/63 CHS for freebsd and */255/63 CHS for windows 2000, who initially created my three partitions.

It seems there is a bug related to sysinstall: http://lists.freebsd.org/pipermail/freebsd-questions/2004-June/048171.html


----------



## Beastie (Jun 11, 2009)

The geometry message is very common, and I doubt it's the culprit in your case. On one of my dual-boot computers, I recently did NOT get the message, yet Windows partitions still became unbootable after installing FreeBSD.




			
				mat17 said:
			
		

> I have tried 'testdisk' under linux 2.6.28.4 (knoppix). I am a bit confused because I don't really know what sysinstall has changed in the partition table. All my partitions are listed, with the right size.


I already told you, it's not the LBA values but the C/H/S ones.
Let TestDisk find the right values for you: open it, Proceed, choose an Intel PT, Analyze, write down C/H/S values for damaged PT entries and finally do a Quick Search. You should already see the differences between the two.
Now, either fix it directly with TestDisk or by using `# fdisk -u <your_disk>` from a fixit disk.


----------



## Erratus (Jun 11, 2009)

mat17 said:
			
		

> ```
> WARNING:  It is safe to use a geometry of 310101/16/63 for ad4 on
> computers with modern BIOS versions.  If this disk is to be used
> on rather old machines, however, it is recommended to ensure that
> ...



I use sade(8) for slicing. And I choose "No" resulting in a */cyls/255 heads/63 sectors geometry.


```
Disk name:      ad4                                    FDISK Partition Editor
DISK Geometry:  30401 cyls/255 heads/63 sectors = 488392065 sectors (238472MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0         63         62        -     12     unused        0
        63   81915372   81915434    ad4s1      4 NTFS/HPFS/QNX        7
  81915435  190466640  272382074    ad4s2      4 extended DOS, LBA       15
 272382075   16771860  289153934    ad4s3      4 linux_swap      130
 289153935  157196025  446349959    ad4s4      8    freebsd      165
 446349960   42047208  488397167        -     12     unused        0
```

Leaving MBR untouched and using XP bootmanager with no problems.


----------

