# Geometry Issues



## gulanito (Jul 10, 2009)

Hello. I'm have installed WindowsXP in a 50GB partition in the begining of the disc.
I want to install FREEBSD in a new partition after that. Before the FDISK partitioning tool in
the installation procedure, Sysinstall tells me the following:


```
USER CONFIRMATION REQUESTED

WARNING: it is safe to use a geometry of 31912102/16/63 for AD4 on computers with modern BIOS 
versions. If this disk is to be used on rather old machines, however, it is recomended to ensure
that is does not have more tham 65535 cylinders, or more than 255 heads or more than 63 sectors 
per track.
Would you like to keep using the current geometry?

YES (default) // NO
```

If I press "NO" then appears the following:


```
MESSAGE

A geometry of 20023/255/63 was detected for AD4. If your not sure about this, please consult the 
HardwareGuide in the documentation or use the (G)eometry command to change it. Remember: you need  
to enter wheatever you were told in the BIOS setup. For SCSI, it's the translation mode your 
controller is using.
Do not use a "physical geometry".

OK
```

I'm not sure if my PC is a "old machine",
I don't know if my PC have more tham 65535 cylinders, or more than 255 heads or more than 63 sectors per track.
I checked the BIOS but it not tell me what is the geometry it uses.

But:

The BIOS have the option "LBA/Large Mode" seted to [Auto]
I have a ASUS P5PE-VM motherboard.
I have a 160GB hard disk.
I have a Intel Dual core 3Ghz.


The questions are the following:

1)From where the Sysinstall obtains each of the two geometryes stated above? (31912102/16/63 and 20023/255/63)

2)What is the correct geometry that I have to use for install freebsd? 


NOTE: 	 	
I tried to install FreeBSD and WindowsXP, and I've done several tests, but so far I have not been able to achieve it
(see the thread "geometry problem maby? Boot problem" from July 7th)

Thanks guys!


----------



## graudeejs (Jul 10, 2009)

Ignore it and search forum for one of similar threads


----------



## Bunyan (Jul 10, 2009)

Your HDD is of SATA interface, that's why.(ad4). After a kernel rebuild you'll
boot your machine into single-user mode (what a pain to use *sh*) mount partitions rw and edit *fstab* with *vi* not *ee*. Are you ready for this?

Your *Windows* partition is too large. You should create a 10-12 Gb *C:* partition to house your system and apps. Then organize your FreeBSD slice and the rest an extended partition for miscellaneous files. FreeBSD will work faster.


----------



## gulanito (Jul 11, 2009)

Bunyan said:
			
		

> Your HDD is of SATA interface, that's why.(ad4). After a kernel rebuild you'll
> boot your machine into single-user mode (what a pain to use *sh*) mount partitions rw and edit *fstab* with *vi* not *ee*. Are you ready for this?



The problem is that I can't boot Freebsd in the boot manager!  Ence I don't have a chance to boot in single user mode.

What are the flags "vi" and "ee" ?


----------



## graudeejs (Jul 11, 2009)

vi and ee are text editors.


----------



## Bunyan (Jul 11, 2009)

gulanito said:
			
		

> The problem is that I can't boot Freebsd in the boot manager!


You don't need that stupid boot manager! Microsoft NT loader is better.
This is how I created a Windows XP + FreeBSD dual boot.
I have a 40 Gb PATA hdd.
The first 10 Gb is an NTFS partition. There lives Windows.
Before installing FreeBSD, I copied */boot/boot1* from the CD-ROM 
to the root of Windows installation and changed its name . C:\bootsect.bsd
Good. Now it's time to install FreeBSD. First I need to create that famous
BSD slice type A5. I use Slackware CD-ROM . Boot my computer off the CD,
*fdisk* or *cfdisk*.

```
fdisk /dev/hda
# Create new partition
n
# Primary/Logical ?
# FreeBSD requires primary
p
# What number? Windows is the 1st , BSD will be the second
2
# Parttion size?
+25000M
# Partition type?
a5
#Write the changes to disk
w
Ready now. 
reboot
```
Then install FreeBSD as usual.
To use the NT Loader, I have to edit C:\boot.ini. As far as I know, to perform this task from within Windows you have no chance. But from within Linux you can. For a FAT32 partition, Slackware is the best choice, for 
NTFS Gentoo, because it can mount NTFS partitions read write!
The Gentoo console with an open root account waits for my orders.

```
[b]mount -t ntfs-3g /dev/sda1 /mnt/gentoo[/b]
[b]mcedit /mnt/gentoo/boot.ini[/b]
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
C:\bootsect.bsd="FreeBSD"
```
Save changes and reboot machine.


----------



## gulanito (Jul 11, 2009)

First of all: thanks.

Now, I have some questions:

1)


			
				Bunyan said:
			
		

> Now it's time to install FreeBSD. First I need to create that famous
> BSD slice type A5. I use Slackware CD-ROM



Why you create the partitions with the Slackware CD-ROM?
To prevent the geometry WARNING that appears in sysinstall?

2)


			
				Bunyan said:
			
		

> To use the NT Loader, I have to edit C:\boot.ini. As far as I know, to perform this task from within Windows you have no chance.



I'm using windowsXP now and simply try to edit boot.ini, save the changes and everithing goes ok. 
Why not could edit boot.ini from windows? 	
(Maybe there is something that I did not understand)

3)


			
				Bunyan said:
			
		

> [boot loader]
> timeout=30
> default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
> [operating systems]
> ...



Really all that I need is add the "C:\bootsect.bsd="FreeBSD"" line and in the boot up I have the chance to select one of the two OS? (Of course, I have to copy boot1 in C:/ and edit it's name)
(The fact that windows have a "boot manager" is now for me, or maybe there is something that I did not understand)


Again: really thanks!


----------



## Bunyan (Jul 12, 2009)

1) I use Linux *fdisk* because it recognizes *BreeBSD* slices. *Slackware* install disk because *Slackware* is really fast.
2) I didn't know that *boot.ini* could be edited from within *Windows*. Please, show me, how you do it.
3) Yes, just do it as I showed you in my previous post.


----------



## Speedy (Jul 12, 2009)

Using ntloader ... hmm
IMO best solution for you would be installing GAG, it requires no partitions, lives entirely on the MBR. For every OS you install which comes with bootloader choose "install on partition". That's it.

http://gag.sourceforge.net/


----------



## SeanC (Jul 12, 2009)

Bunyan said:
			
		

> 2) I didn't know that *boot.ini* could be edited from within *Windows*. Please, show me, how you do it.



Option 1: Edit it directly at *C:\boot.ini*. It is a hidden OS file that will not be visible unless you go to Folder Options and uncheck "hide protected operating system files."

Option 2: Control Panel -> System -> Advanced -> Startup and Recovery "Settings" -> "to edit the startup options file, click Edit"


----------



## Bunyan (Jul 12, 2009)

gulanito said:
			
		

> First of all: thanks.
> To prevent the geometry WARNING that appears in sysinstall?



Don't worry about that silly WARNING. I have an old *IBM Pentium II*.
This is the only computer of mine that sysinstall doesn't complain about.
After an inevitable kernel rebuild, FreeBSD will recognize your SATA HDD,
as a normal PATA drive, so that *ad4* will switch to *ad0s2*.


----------



## gulanito (Jul 13, 2009)

1)  Thanks for the previous reply.

2)  Ahh...



			
				Bunyan said:
			
		

> After an inevitable kernel rebuild, FreeBSD will recognize your SATA HDD,
> as a normal PATA drive, so that *ad4* will switch to *ad0s2*.



I realized recently, the disk should be identified as ad0 (not ad4)  because is the unique hard disk in my PC, right? But, why sysinstall identify it as ad4? there is a problem whit that?
Is for that that i have problems whit boot0?

I'm new to freebsd, I try to install it (with winxp) and experiment, but, how I build a new kernel if I can`t install it (or, more correctly speaking, boot it)?, and  why?
I not understand really.

thanks


----------



## Bunyan (Jul 13, 2009)

Since you built and installed e new kernel, the old one automatically moves to
*/boot/kernel.old*
So, in case your new kernel is buggy, or not usable, you have the chance to start your system with the old, good kernel. To do this, select *Escape to loader prompt*, at the prompt type *unload*, then type *boot /boot/kernel.old/kernel*. Now your system boots the old kernel and you can do your job further.
*rm -rf /boot/kernel*
*cp -R /boot/kernel.old /boot/kernel*
NOTE: Do not use forward slash after .old !
Now edit your kernel config file.
P.S. SYSINSTALL complains about the disk geometry anyway. 
Look at this


----------



## gulanito (Jul 13, 2009)

Bunyan said:
			
		

> Since you built and installed e new kernel, the old one automatically moves to
> */boot/kernel.old*
> So, in case your new kernel is buggy, or not usable, you have the chance to ...................



Ok, ok , I appreciate your help, but maybe I not explain my problem properly:

1)
I do not understand why you are talking about compiling a new kernel.

2)
I just want Install WinXP and Freebsd , and boot any of them, but when I try to boot the system locks up

After:

F1 win
F2 freebsd
Boot: F1 (or F2)

I press a key (F1 or F2) and nothing happens (that's why I wonder if a problem of geometry)

3)
Besides I do not understand why Sysinstall recognizes my disk as ad4 (instead of ad0, remember is my only hard disk)


----------



## Bunyan (Jul 13, 2009)

1) Because it contains a lot of unneeded options and  devices for a certain machine,
   thus being really huge. Besides, you can add other options and devices into your
   kernel config file. I used to build custom kernels in Linux. What about you?
2) FreeBSD bootmanager is far fom being ideal. The alternative solution was    explained above. One thing I suppose you didn't do is to mount Windows partition
   when creating the FreeBSD partitions with SYSINSTALL.
3) Because SYSINSTALL is older than SATA hard drives. Ancient FreeBSD 3 or 4 used the
   same SYSINSTALL. SYSINSTALL has its own limitations, so we have to be a bit smar
   ter than he. Or, may be try *NetBSD*. That one won't complain about your  disk geometry, I assure you.

P.S. Unlike Linux, FreeBSD kernel doesn't contain explicit code for SATA controllers. Linux detects your hdd as */dev/sda*, as if it were a SCSI drive. FreeBSD detects it as an ATA drive with a bad geometry.
To make FreeBSD detect your hdd correctly, you have to reinstall the kernel.


----------

