Laruence's Linux Private food-Basic Learning (third edition) (4)

Source: Internet
Author: User

Laruence's Linux Private food-Basic Learning (third edition) (4)

Chapter 2 host planning and disk partitioning

1. Linux and hardware combination

First, let's talk aboutUnderstanding computer hardware configuration.

Then I talked aboutSelect the host configuration with Linux. In Linux servers, memory is much more important than CPU.

FinallyFile Name of each Hardware Device in Linux. In Linux, almost all hardware device files are stored in the/dev directory.

1) IDE Hard Drive:/dev/hd [a-d]

2) SCSI/SATA/USB hard drive:/dev/sd [a-p]

3) USB flash drive:/dev/sd [a-p]

4) soft drive:/dev/fd [0-1]

5) printer: 25 pins:/dev/lp [0-2]; USB:/dev/usb/lp [0-15]

6) mouse: USB:/dev/usb/mouse [0-15]; PS2:/dev/psaux

7) Current cd rom/vd rom:/dev/cdrom

8) current mouse:/dev/mouse

9) tape drive: IDE:/dev/ht0; SCSI:/dev/st0

For a hard disk, if the disk partition of each disk drive is different, its disk file name will change.

2. Disk partitioning

First, let's talk aboutRelationship between the disk connection method and the device file name. The device that can connect to the IDE interface is an IDE device, whether it is a disk or a CD. An IDE flat cable can be used to connect two IDE devices. Generally, the host provides two IDE interfaces, so you can connect up to four IDE devices. These two IDE interfaces are generally referred to as IDE1 (primary) and IDE2 (secondary). The IDE devices on each flattened cable can be divided into Master devices) and Slave (Slave device ).

 

IDE/JUMPER Master Slave
IDE1 (Primary) /Dev/hda /Dev/hdb
IDE2 (Secondary) /Dev/hdc /Dev/hdd

 

Disk interfaces such as SATA, USB, and SCSI are all driven by the SCSI module. Their device file names must follow the order in which disks are detected by Linux.

Then I talked aboutDisk composition review. The first sector of a disk is very important. It mainly records two important information:

1) Master Boot Record (MBR): 446 bytes of Boot loader can be installed. The system takes the initiative to read the content of this block when starting the system.

2) partition table: records the status of the entire disk partition, with 64 bytes.

Then I talked about it again.Disk Partition Table. In the 64-bytes capacity of the partition table, the table is divided into four groups of record areas (up to four partitions can be accommodated). Each record area records the start and end cylindrical numbers of the segment. After the file name of the disk device, a number is followed to indicate the location of the partition, such as P1:/dev/hda1. These four partitions are called Primary or Extended partitions. The smallest unit of a partition is a cylindrical disk. The purpose of an extended partition is to use an additional sector to record the partition information. A maximum of one extended partition can be used and cannot be formatted. In this way, more than four partitions can be divided. The IDE Hard Disk can have a maximum of 59 logical partitions (numbers 5 to 63 ), the SATA hard drive has 11 logical partitions (numbers 5 to 15 ). Partitions that continue to be cut out by extended partitions are called logical partitions. The device name number in the logical partition starts from the 5th, for example, L1:/dev/hda5. If the extended partition is damaged, all the logical partitions will be deleted because the information of the logical partitions is recorded in the extended partition. If the first sector of the entire hard disk is physically broken, the hard disk will probably be useless.

Also talked aboutBoot Process and primary boot partition (MBR). BIOS is the first program automatically executed when the system starts up. It analyzes the storage devices in the computer. Find the MBR in the first sector of the hard disk and start the Boot loader (the purpose is to load the Kernel File and start the operating system function ). The boot process is BIOS> MBR> Boot Loader> kernel file. The function of guiding and loading a program is as follows:

1) provides menus. You can select different boot options.

2) load the Kernel File. Direct to the program segment that can be started to start the operating system.

3) Transfer to another loader. Transfers the bootstrap load function to other loaders. In addition to MBR, the boot loader can also be installed in the boot sector of each partition. This enables multiple guidance.

Each partition has its own boot sector. The actual boot kernel files are placed in each partition. Note that if you install multiple boot times, you 'd better install Windows before installing Linux.

FinallySelection of disk partitions in Linux installation mode (very important). The most important part of the entire directory tree structure is the root directory. The representation of this root directory is a slash (/). How to combine the directory tree architecture with the data in the disk involves the "mount ). The so-called mount is to use a directory as the entry point, put the data in the disk partition under this directory, that is, enter this directory to read the partition, the Directory of the entry point is called the "Mount directory". To determine which partiton a file is under, you can use reverse tracing to check which "entry point" is found first, that is, the entry point used. We strongly recommend that you use the "Custom installation, Custom" installation mode during installation. For the first time, we recommend that you only need to partition "/" and "swap", and reserve a spare disk capacity. Select the default disk partitioning method provided by the Linux installer.

3. plan before installing Linux

First, let's talk aboutSelect the appropriate distribution. This book uses centos.

Then I talked aboutRelationship between host service planning and hardware.

Next we talked aboutMain planning of host hard disk. It provides the simplest partitioning method and a slightly more troublesome method.

So we talked aboutHow to install the exercise machine. We recommend that you install all the kits for new users.

AndTwo cases of laruence.

Finally, let's talk aboutFailure to boot due to the combination of large hard disks and old hosts. The solution is the/boot directory. The key is to keep the partition where the boot Sector is located within 1024 cylinders. Three sectors planned during installation:/boot,/, and swap. And/boot should be placed at the top of the entire 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.