2.Linux system hard disk and partition basics

Source: Internet
Author: User

We are the Linux system installed on the virtual machine. During the installation process, you may encounter the problem of disk partitioning, let us briefly explain the principle of partitioning.

1. Basic knowledge of hard disk

The following is a blank hard drive:


This is a formatted hard drive:

Formatting is the establishment of order in a blank space.
Other formats (different file systems):

Data stored on disk:


The data is not stored sequentially from beginning to end, in fact, like our hash table, when our data is in a hash table, a hash code value is computed, and then the data is placed in the only place in the hash table (if the hash code is the same, The data will be stored in a list or array and placed in a single position, so it is not continuous data, it will form a sparse table. So when we look at the data, it will be easy, just calculate its hash code value, and then locate the data in a unique location, very fast.

The data on the hard disk is a bit like a hash table, sparse storage, not contiguous storage.

2. Knowledge of Partitioning

So why partition?
(1) Support multiple file systems
(2) Easier to manage

For example, we have four zones in our hard drive, and we want to remember the start and end of each zone. The information for the partition is recorded in 512 bytes of the first track of the hard disk's cylinder (the very beginning of the hard disk), which we generally call the hard disk partition table. Then, destroying a hard disk partition table is tantamount to destroying a hard disk.

The partition table records the partition information for the hard disk, but a hard disk partition table can only record four partitions.

The partitions on the hard disk are divided into three types:
(1) Primary partition
A partition with our most basic operating system installed. The primary partition + extended partition can only be divided into four extents, as mentioned above a hard disk partition table can only record four partitions.

(2) Extended partition
The above mentioned that the primary partition + extended partition can only be divided into four zones, generally everyone's computers are more than four partitions, because in the extended partition, you can also divide the logical partition. Similar to a tree structure.

(3) Logical partitioning
is to expand the partition division.

Next is the legend for several sets of partitions:
(1) Installing Linux with unpartitioned space

(2) Use a space that is not in use
After you have formatted the original partition, install the system

(3) The disk space of the operating system is already installed
Re-partition and then install, all the original data will be gone

There are also non-destructive partitioning techniques that compress the data from the previous partition into a contiguous space, dividing the remaining space:
Step One: Compress


Step Two: Partitioning


Step three: Install the system in the new partition

Finally, share a disk partition legend for a Windows system:


Windows vs. Linux partitions


Disk partitioning for Windows to coexist with Linux systems

Note: The naming rules for Linux hard disks:
/dev/xxyn
where XX:
The first two alphabet name partitions of the partition name are the type of device, usually HD (IDE disk) or SD (SCSI disk).
Y:
This letter indicates the device where the partition resides. For example,/dev/hda (the first IDE disk) or/DEV/SDB (a second SCSI disk)
N:
The last number represents the partition. The first four partitions (primary or extended), use the number 1 to arrange to 4. The logical partition starts at 5. For example,/dev/hda3 is the third primary or extended partition on the first IDE hard disk, and DEV/SDB6 is the second logical partition on the second SCSI hard disk.

2.Linux system hard disk and partition basics

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.