Linux system partitioning and mounting

Source: Internet
Author: User

Linux system partitioning and mounting
Linux system partition

Linux partitions are very different from Windows partitions. In Linux, there is no graphic partition interface. Therefore, we cannot see disk partition interfaces such as drive C and drive D in Windows.

1. Hard Disk partitioning

Objective of Hard Disk partitioning: Improves management efficiency. If everything is put in one partition, the OS management efficiency is relatively low. At the same time, the operating system obtains the partition of the operating system file through MBR at startup, so a bootable partition is indispensable. Partitions are irrelevant to the operating system.. The partition has started before the operating system is installed. We can simply think that partitioning is to split the hard disk into different areas. Partition Structure.
Hard Disk primary Boot Sector = Hard Disk primary Boot Record (MBR) + Hard Disk Partition Table (DPT), a total of 512 bytes, of which MBR occupies 446 bytes, partition table occupies 64 bytes, then there are two byte ending signs. The Boot Sector is stored in the hard drive's 0-header, 0-Sector, and 1-Sector, that is, the Boot Sector.

When the operating system is started, when the BIOS (the BIOS is actually a Basic Input/Output System) program sends the Boot SectZ kernel? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> keys + E1CUr/Y1saho01CUrXE1/keys/ex6ta + keys/keys + 1zbO1xMb0tq + keys/ XKvLuvo6zX7rrzsNHPtc2zvbu4 + M + weight + KOswKnVubfWx/Weight = "Image Description" src = "http://www.bkjia.com/uploads/allimg/160421/041034J34-1.jpg" title = "\"/>

The operating system can be installed on the primary partition.. Because the MBR records the information of the primary partition, and the system will go to the primary partition to find the operating system boot file at startup, the operating system boot file must be in the primary partition, otherwise, the system cannot start. Up to four primary partitions are supported. Since the hard disk only retains 64 bytes of storage space for the partition table, and the parameters of each partition occupy 16 bytes, the data in the original primary boot sector can be stored in a total of 4 primary partitions. The operating system can only store data in four primary partitions. To create more logical disks for the operating system, the system introduces the concept of extended partitions.. An extended partition is not a real partition. It is just a pointer in the memory management linked list, indicating which region is an extended partition. An extended partition is also a primary partition. System partitions are extended by dividing logical partitions in the extended partitions. In fact, all logical partitions are in one partition, but logically separated. But for users, everything is transparent. We seem to have many partitions in the system. Features of each partition:
A maximum of four primary and extended partitions are allowed (Hard Disk restrictions ). A maximum of one extended partition (limited by the operating system ). Extended partitions cannot be formatted. In Linux, the main Partition Number and the extended Partition Number 1-4 must start with 5.

3. linux partition
Compared with Windows partitions, the biggest difference in Linux is that we cannot see the so-called drive letter ., In Linux, use/dev/hda, hdb .. in this way, the hard disk is identified by/dev/hda1 and/dev/hda2. the last number indicates the partition number. The primary partition is 1-4, and the logical partition is a number after 5.
Liunx uses a tree-like file management system. In Linux, there is no partition concept. Partitions are just a file in Linux like other devices. To use a partition, you must load it into the file system.

4. linux mounting
The so-called Mount means to use a directory as the entry point, put the data in the disk partition under the change Directory, enter the directory to read the partition.
A tree-like file structure in Linux. The top-level directory is. When installing the system, you must mount a primary partition to the/directory, because the system needs to be installed in the/primary partition.
The entire Linux system structure is as follows. We have mounted partition 1 to the/directory when installing the system. at this time, no other partitions are mounted, so all other directories under the/directory are under this partition, that is, I actually perform read/write operations in any directory on this partition 1.
If we want to use other partitions, We must mount the partition to a directory, which can be an existing Directory, such as/home or a self-created directory, for example,/oracle.
Once other partitions are mounted, the OS cannot find the required files and the system will crash. For example, when we mount partition 2 to the/usr/X11 directory, the system will not be able to find the file on partition 1 through the X11 directory, and the system graphic interface will not be available at this time. although the file is still on the hard disk. As mentioned above, directory-partitions are connected by attaching them. If you change the partition, the contact is broken and the previous file cannot be found. We are looking at partition 5 and partition 6. We mount it to the/home/ftp and/oracle directories. At this time, we are operating on these two directories, the partition corresponding to the operation.

In Linux, we can use the df-h command to view the current partition of the system. Run the fdisk-l command to view information about all partitions in the current system. Common commands for mounting and detaching partitions and file systems are mount and umount. For example, mount/mount E/dev/hda5 means to mount partition 5 to the/oracle directory. The specific command format is not described. There are many online commands and you can use man to view them. You can edit the/etc/fstab file to automatically load the file when the system is started. This is not detailed here.

5. About swap partitions and/boot partitions
We recommend that you create separate partitions for/,/boot, and swap during system installation.

Swap: it can be understood as virtual memory. Generally, if the actual memory is smaller than 4 GB, the space allocated to the swap is twice the actual memory. If it exceeds 4 GB, the same size of space is allocated. /: System root directory. Generally, in the primary partition, it can also be divided into logical partitions of the extended partition. /Boot: mount it to a separate partition, generally MB. It is mainly used for system startup. Avoid system startup failure because the partitions in the root directory are full.

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.