Allocate disk space

Source: Internet
Author: User

The first task is to allocate hard disk space for FreeBSDSysinstallMake some preparations first. To do this, you must first understand how FreeBSD finds disk information.

2.6.1 BIOS disk number

Before you install and configure FreeBSD on the system, pay attention to one important thing, especially when you have multiple hard disks.

In a PC architecture, when you run BIOS-related operating systems like MS-DOS or Microsoft Windows, the BIOS has the ability to change the order of the disk, and these operating systems will change with the BIOS. This makes the user do not have to start the so-called "primary master" hard disk. Many people find that the simplest and cheapest way to back up the system is to buy an identical hard disk, and then regularly copy data from the first hard disk to the second hard disk.GhostOrXcopy. Therefore, when the first hard disk is dead, damaged by viruses, or has a bad track, they can adjust the boot sequence in the bios and boot the second hard disk directly. It is like switching the data cable of the hard disk, but you do not need to open the chassis.

Expensive. Systems with SCSI control cards can generally extend the BIOS function to allow SCSI devices (up to seven) to achieve similar sequential change functions.

Users who are used to this method may be surprised, because this is not the case in FreeBSD. FreeBSD does not refer to the bios, and does not know what the so-called "BIOS Logical Disk correspondence" is. This can be confusing. It is clearly the same hard disk and the data is completely copied from the other disk, but the results cannot be used as they used previously.

Before using FreeBSD, please change the hard disk boot sequence in the BIOS back to the normal order and do not change it later. If you must switch the hard disk sequence, use hardware to open the chassis and adjust the adjustment line.

Example: Installation adventure of Bill and Fred

Bill installed FreeBSD on the old Wintel machine for Fred. He installed a SCSI hard disk with a ID of 0 and then installed FreeBSD on it.

Fred started to use his new FreeBSD system, but several days later, he found that the old SCSI hard disk had many minor problems. Then he talked to Bill about it.

After a few days, Bill decided it was time to solve the problem, so he found an identical hard disk from the hard disk "favorites" in the back room, after the surface test, it is displayed that this hard disk is correct. Therefore, Bill adjusted its ID to 4, installed it on Fred's machine, and copied the data from disk 0 to disk 4. Now the new hard disk is installed, and it seems everything is normal; So Bill thinks it should be ready to use it now. Bill went to the SCSI bios and set scsi id 4 as the boot disk. After disk 4 was restarted, everything went smoothly.

After a few days, Bill and Fred decided to bring a new one: FreeBSD upgrade. Bill removed the hard disk with ID 0 (because of a problem) and took the same hard disk from the favorites area. Then he used Fred's magic network FTP disk to install the new FreeBSD version on this hard disk. There was no problem with the installation process.

After using the new version for a few days, Fred thinks it is suitable for engineering... It is time to copy the work documents that were previously stored in the old system. So Fred mounted the SCSI hard disk of ID4 (which contains the latest information copied from the old system) and found it on the hard disk of id4, all his previous documents are missing!

Where did the data go?

When Bill copied the id0 hard disk data to ID4, ID4 became a "new copy ". When he calls the scsi bios to set ID4 as the boot disk and wants to enable the system to boot from ID4, he is actually stupid because most systems can directly tune the bios and change the boot sequence, however, FreeBSD restores the boot sequence to the normal mode, so Fred's FreeBSD is still starting from the original id0 hard disk. All the materials are still on that hard disk, rather than the ID4 hard disk.

Fortunately, when we found out that the materials were still there, we took the materials from the earliest id0 hard disk and handed them back to Fred, bill also learned that the computer count starts from 0.

Although the SCSI hard disk is used in this example, the same concept can also be applied to the IDE hard disk.

2.6.2 use fdisk to create a partition

Note:If no changes are made, the data will be written into the hard disk. If you make a mistake and want to start again, please selectSysinstallExit the installer ). Or pressUKey for Undo operations. If your operation fails, you can always restart your computer to achieve your goal.

When youSysinstallAfter standard installation is selected in the main menu, you will see the following information:

                                 Message In the next menu, you will need to set up a DOS-style ("fdisk") partitioning scheme for your hard disk. If you simply wish to devote all disk space to FreeBSD (overwriting anything else that might be on the disk(s) selected) then use the (A)ll command to select the default partitioning scheme followed by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a partition marked "unused" and use the (C)reate command.                                [  OK  ]                      [ Press enter or space ]

As instructed on the screen, pressEnterThen you will see a list of all hard disks found during device detection. Figure 2-13 shows that two IDE Hard Disks are availableAd0AndAd2.

Select the hard disk to be partitioned

 

You may be wondering whyAD1Not listed? Why is it lost?

Imagine what would happen if you had two IDE hard disks, one in the first primary master and the other in the second Master? If FreeBSD names them in the order they are found, for exampleAd0AndAD1Then there will be no problems.

But now the problem is coming. If you want to add a third hard disk to primary slave, the name of the hard disk will beAD1, PreviousAD1It will becomeAd2. What problems will this cause? Because the device name (suchAd1s1a) Is used to find the file system, so you may find that, suddenly, some of your file systems cannot be correctly displayed, you must modify the FreeBSD configuration file (:/etc/fstab) can be correctly displayed.

To solve these problems, we can call FreeBSD to directly name the kernel based on the location of the IDE device, rather than in the order of discovery. In this wayAlways Ad2, Even if your system does notAd0OrAD1Is not affected.

This is the default value of FreeBSD kernel, which is why the above picture only showsAd0AndAd2. On the screen, the two hard disks of this machine are mounted on the master of primary and secondary. No hard disk is installed on the slave slot.

You should select the hard disk you want to install FreeBSD, and then press [OK]. AfterFdiskYou will see a picture similar to Figure 2-14.

  FdiskIs divided into three parts.

The first part is the top two lines on the screen, showing the information of the selected hard disk. Including FreeBSD name, hard disk distribution, and total disk capacity.

The second part shows the selected partitions on the hard disk, the start and end locations of each partition, the occupied capacity, the FreeBSD name, their descriptions, and the type (sub-type ). This example shows two unused small partitions and a large fatPartition, (probably a MS-DOS or WindowsC:), And an extended partition (logical partitions can also be included in the MS-DOS or windows ).

The third part is displayed.Fdisk.

Typical fdisk partition table before editing

 

What you need to do next depends on how you want to partition your hard disk.

If you want FreeBSD to use the entire hard diskSysinstallAfter the installation continues, all information on the hard disk will be deleted .)AUse entire disk all existing partitions are deleted and replaced with a small one, markedUnusedAnd a large FreeBSD partition. Then, move the cursor to the FreeBSD partition with the direction key, and then pressSTo mark this partition as a startup partition. You will see a picture similar to Figure 2-15. Note thatFlagsColumnAMark indicates that this partition isActivate.

To delete an existing partition to free up space for FreeBSD, you can move the cursor to the partition to be deleted and then pressDKey. Then you can pressCIn the dialog box that appears, enter the size of the partition to be created. Enter a proper size and then pressEnterKey. In general, the initial values in this dialog box are the maximum values that can be allocated to the partition. It may be the largest adjacent partition or the unallocated size of the entire hard disk.

If you have created a partition for FreeBSDPartitionmagic), You can pressCTo create a new partition. Similarly, a dialog box is displayed asking you about the size of the partition to be created.

Fdisk partitions use the entire hard disk

After completion, pressQKey. Your change will existSysinstallBut it will not be written into your hard disk.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.