Linux disk and file system management

Source: Internet
Author: User

1. Partition of the hard disk

In Linux we know a very important concept, that is, "Everything is file", where everything represents all the objects in the Linux system, naturally also includes the hard disk device in Linux. All the devices in Linux are abstracted into one file and stored in the/dev directory.

The hard drive device name in the Linux system is typically hd[a-z] or sd[a-z] (A-Z is the partition number), such as Hda,hdb,sda,sdb

So what's the difference between this different device name?
In Linux, IDE devices are abstracted into hd[a-z] name files, and STAT, SCSI, SAS, USB and other devices are abstracted into sd[a-z] names.
Note: The IDE is a data transfer method, which is parallel. Parallel is like multiple lanes on a freeway, serial is a multi-person row across the bridge.
IDE device in the computer is mainly the same-mouth hard disk and CD-ROM, is now all replaced by the serial port, that is, ATA hard disk, serial port with SATA to express. and read and write speed of the hard disk is about 80M per second, and the serial port has reached more than 150 m per second.

For example: Our system now has a hard disk, then the abstract file in Linux for/DEV/SDA add a hard disk is abstracted into a file/dev/sdb

Of course in the system we see/DEV/SDA or/DEV/SDB now still can not use, this hard disk on a bare device, but also need to partition, this is like our ordinary windows on a hard disk on the partition of C, D disk, the hard disk partitions its essence is to the hard disk installation file system. After dividing the hard drive into several zones, each zone can be used as a standalone disk for easy management. In this article we will also describe the partitioning method.

Partition naming rules: Device name + partition number, such as SDA1, Sda2, and so on.

2. Partition mechanism of hard disk

At present, the main partition mechanism is divided into MBR and GPT two kinds

The so-called MBR is the main boot loader (master boot record), this partitioning method in front of the hard disk has a partition table, partition table size is 64 bytes, where every 16 bytes can define a partition, so the MBR partition table has a maximum of 4 partitions.

However, the computer's hard disk size is growing rapidly, 4 partitions obviously can not meet the needs of the use, so there is the MBR partition table of the multi-partition scheme-logical drive (logical partition). To mention the logical partition, you have to say the type of partition under the MBR partition. There are two types of partitions under MBR format, primary and extended partitions. The primary partition can be accessed directly from my computer and the extended partition must be divided into logical drives that can be accessed directly from the computer. Because the MBR partition table limits the number of partitions, it is up to 4 primary partitions or 3 primary partitions + one extended partition.

The MBR (Master Boot Record) is a traditional partitioning mechanism that is applied to most PC devices booting with the BIOS (basic input and output system) (Apple uses EFI), and many server servers support the BIOS as well as the EFI boot mode

Features of MBR partitioning:

<1>MBR supports 32bit and 64bit systems;

The number of partitions supported by <2>MBR is limited;

The number of partitions supported by <3>MBR is limited;

<4>MBR only supports hard drives up to 2TB, more than 2TB drives can only use 2TB of space (with third-party solutions)


If the MBR occupies a total of 512 bytes of hard disk, the first 446 bytes are: Boot code (BOOTSTRAP) (Boot different operating systems, different operating systems, boot code is not the same), followed by 4 16 bytes: corresponding to 4 primary partition table information ( Primary Partition Table), last 2 bytes: The boot flag (boot Signature), always 55 and aa;55 and AA is a permanent indication that the hard drive is bootable.

The partition of a hard disk using the MBR partitioning mechanism is divided into: primary partition, extended partition, logical partition

Primary partition: A hard disk can only create up to 4 primary partitions (because you can create up to 4 primary partition table information in the MBR partitioned table structure, which is 4 16-byte space, for example)

Extended partition: An extended partition occupies the location of a primary partition (because you can create up to 4 primary partition table information in the MBR partitioned table structure, so take out a primary partition as an extended partition)

Logical partition:

<1> is created based on an extended partition, preceded by an extended partition, and then the logical partition is created on the basis of the extended partition, which means that we have to create the extended partition before using the logical partition;

<2> the space of the extended partition cannot be used directly, we must establish the logical partition on the basis of the extended partition to be able to be used;

<3>linux supports up to 63 IDE partitions and 15 SCSI partitions

Pel:primary Partition; Extended Partition; Logical Partition

-------------------------
The so-called GPT is the GUID partition table (global partition identifier), which is a newer partitioning mechanism that solves many of the drawbacks of the MBR.
Features of GRP partitioning:
<1> support for more than 2TB of disk: GPT has 64bit addressing space, and MBR to the hard disk space address addressing up to only 32 32bit,2, hard disk space is identified by the address method, so the MBR only support the disk capacity is less than 2TB
<2> Backward compatible MBR
<3> However, the underlying hardware must support UEFI (Intel's next-generation boot system that replaces the BIOS) to use, which means that the underlying hardware must use UEFI
<4> must use 64-bit operating system
<5>mac, Linux system can support GPT partition format
<6>windows 7 64bit, Windows Server2008 64bit support GPT

The above section references http://www.linuxidc.com/Linux/2013-06/85717.htm

--not to be continued

Linux disk and file system management

Related Article

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.