Опубликован: 06.08.2012 | Уровень: специалист | Доступ: платный
Лекция 5:

Installing FreeBSD

Partitioning the disk

The first installation step is to set up space for FreeBSD on the disk. We looked at the technical background in Chapter 2, on page 39. In this section only, we’ll use the term partition to refer to a slice or BIOS partition, because that's the usual terminology.

Even if your disk is correctly partitioned, select the Partition menu: the installation routines need to enter this screen in order to read the partition information from the disk. If you like what you see, you can leave again immediately with q (quit), but you must first enter this menu. If you have more than one disk connected to your machine, you will next be asked to choose the drives that you want to use for FreeBSD.

#isDisk selection menu

This screen shows entries for each drive that sysinstall has detected; in this example, the system has one ATA (IDE) drive, /dev/ad0, and one SCSI drive, Dao. You only get this screen if you have at least two drives connected to your machine; otherwise sysinstall automatically goes to the next screen.

If you intend to use more than one disk for FreeBSD, you have the choice of setting up all disks now, or setting the others up after the system is up and running. We'll look at the latter option in "Disks" , on page 199.

To select the disk on which you want to install FreeBSD, move the cursor to the appropriate line and press the space bar. The screen you get will probably look like Figure 5-5. Table 5-1 explains the meanings of the columns in this display. The first partition contains the Master Boot Record, which is exactly one sector long, and the bootstrap, which can be up to 15 sectors long. The partitioning tools use the complete first track: in this case, the geometry information from BIOS says that it has 63 sectors per track.

In this case, the Microsoft file system uses up the whole disk except for the last track, 1008 sectors (504 kB) at the end of the disk. Clearly there's not much left to share. We have the option of removing the Microsoft partition, which we'll look at here, or we can shorten it with FIPS.We looked at FIPS in "Shared OS installation" , page 52, and we'll look at what to do with the resultant layout on page 66.

 Partition editor menu

Рис. 5.4. Partition editor menu

Don't forget that if you remove a partition, you lose all the data in it. If the partition contains anything you want to keep, make sure you have a readable backup.

You remove the partition with the d command. After this, your display looks like:


Рис. 5.5.

The next step is to allocate a FreeBSD partition. There are two ways to do this: if you want to have more than one partition on the drive (for example, if you share the disk with another operating system), you use the c (create) command. We'll look at that on page 66. In this case, though, you want to use the entire disk for FreeBSD, so you choose the a option. The resultant display is effectively the same as in Figure 5-5 : the only difference is that the Desc field now shows freebsd instead of fat.

That's all you need to do here: leave /disk by pressing the q key.

Don't use the W (Write Changes) command here. It's intended for use only once the system is up and running.

Таблица 5.1. fdisk information
Column Description
Offset The number of the first sector in the partition
Size The length of the partition in sectors
End The number of the last sector in the partition
Name Where present, this is the device name that FreeBSD assigns to the partition. In this example, only the second entry has a name.
Ptype The partition type. Partition type 6 is the Master Boot Record, which is exactly one track long (note that the header says that this drive has 63 sectors per track). Type 2 is a regular partition.
Desc Atextual description of the kind of partition. fat stands for File Allocation Table, a central part of the Microsoft disk space allocation strategy
Subtype The partition subtype. This corresponds to the descriptive text
Flags Can be one or more of the following characters
  • = The partition is correctly aligned.
  • > The partition finishes after cylinder 1024, which used to cause problems for Microsoft.
  • A This is the active (bootable) partition.
  • B The partition employs BAD144 bad-spot handling.
  • C This is a FreeBSD compatibility partition.
  • R This partition contains a root file system

On a PC, the next screen asks what kind of boot selector (in other words, MBR) you want. You don't get this on an Alpha.

Boot selector menu

Рис. 5.6. Boot selector menu

If you plan to have only one operating system on this disk, select Standard .If you are sharing with another operating system, you should choose BootMgr instead. We'll look at this in more detail in the section on booting the system on page 529. Exit by pressing the tab key until the OK tab is highlighted, then press Enter.

Таблица 5.2. MBR choices
Choice Description
BootMgr Install the FreeBSD boot manager in the MBR. This will enable you choose which partition to boot every time you start the system.
Standard Use a standard MBR. Youwill be able to boot only from the active partition
None Don't change the MBR. This is useful if you already have another boot manager installed. If no MBR is installed, though, you won't be able to boot from this disk.
Shared partition

If you are installing on a disk shared with another operating system, things are a little different. The section continues the example started in "Shared OS installation" . When you enter the partition editor, you will see something like:

Shared partitions

Рис. 5.7. Shared partitions

This display shows the two Microsoft partitions, adOsl and ad0s2,which is what you see after using FIPS; if you have just installed Microsoft on one partition, the partition ad0s2 will not be present. If it is, you first need to remove it. Be very careful to remove the correct partition. It's always the second of the two partitions, in this case ad0s2.

Remove the partition by moving the highlight to the second partition and pressing d. After this, the display looks like:


Рис. 5.8.

The next step is to allocate a FreeBSD partition with the c command. The menu asks for the size of the partition, and suggests a value of 35899920 sectors, the size of the unused area at the end. You can edit this value if you wish, but in this case it's what you want, so just press ENTER. You get another window asking you for the partition type, and suggesting type 165, the FreeBSD partition table. When you accept that, you get:


Рис. 5.9.

The new partition now has a partition type 8 and subtype 165 (0xa5), which identifies it as a FreeBSD partition.

After this, select a boot method as described on page 66 and exit the menu with the q command. There are two operating systems on the disk, so select the BootMgr option.

Бехзод Сайфуллаев
Бехзод Сайфуллаев
Узбекистан, Бухара, Бухарский институт высоких технологий, 2013
Василь Остапенко
Василь Остапенко
Россия