Basic knowledge about Linux Disk System

Source: Internet
Author: User

In Linux, each disk has a device name corresponding to the four ide interfaces of the motherboard. The device names are/dev/hda,/dev/HDB, /dev/HDC,/dev/HDD, etc. If there is an ide raid card, it will be:/dev/HDE,/dev/HDF,/dev/hdg,/dev/hdh.

For SCSI hard disks, the device names are/dev/SDA,/dev/SDB,/dev/SDC, and so on.

For hard disks with raid, the system regards the entire raid as a physical disk. For example, four GB hard disks have a RAID 5, in the system, we can see a GB hard disk.

You can run the "fdisk-L" command to view the system disk information:

[Root @ A ~] # Fdisk-l

Disk/dev/hda: 3221 MB, 3221225472 bytes
16 Heads, 63 sectors/track, 6241 Cylinders
Units = cylinders of 1008*512 = 516096 bytes

Disk/dev/hda doesn't contain a valid Partition Table

Disk/dev/SDA: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device boot start end blocks ID system
/Dev/sda1*1 13 104391 83 Linux
/Dev/sda2 14 1044 8281507 + 8e Linux LVM

Disk/dev/SDB: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device boot start end blocks ID system
/Dev/sdb1 1 1 8001 8e Linux LVM
/Dev/sdb2 2 26 200812 + 83 Linux
[Root @ A ~] #

Based on the above information, we can see that three hard disks are attached to this machine. One of the two SCSI hard disks is SDA, the other is SDB, And the other IDE hard disk is hda. Hda is the newly added hard disk and has not been partitioned.

To view the status of a single hard disk, you can use fdisk-L/dev/SDA or fdisk-L/dev/SDB:

[Root @ A ~] # Fdisk-L/dev/SDA

Disk/dev/SDA: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device boot start end blocks ID system
/Dev/sda1*1 13 104391 83 Linux
/Dev/sda2 14 1044 8281507 + 8e Linux LVM
[Root @ A ~] # Fdisk-L/dev/sda1

Disk/dev/sda1: 106 MB, 106896384 bytes
255 heads, 63 sectors/track, 12 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Disk/dev/sda1 doesn' t contain a valid Partition Table
[Root @ A ~] #

SDA has two primary partitions: sda1 and sda2.

Description of some fdisk-L values

Disk/dev/SDA: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes

The hard disk has a capacity of 255 MB and 1044 magnetic surfaces; 63 sectors; 512 magnetic bars; and each cylinder has a capacity of bytes.

Partition sequence boot starts to terminate capacity partition type ID partition type
Device boot start end blocks ID system
/Dev/hda1*1 765 6144831 7 HPFs/NTFS
/Dev/hda2 766 2805 16386300 C w95 FAT32 (LBA)
/Dev/hda3 2806 9729 55617030 5 extended
/Dev/hda5 2806 3825 8193118 + 83 Linux
/Dev/hda6 3826 5100 10241406 83 Linux
/Dev/hda7 5101 5198 787153 + 82 Linux swap/Solaris
/Dev/hda8 5199 6657 11719386 83 Linux
/Dev/hda9 6658 7751 8787523 + 83 Linux
/Dev/hda10 7752 9729 15888253 + 83 Linux

Note:

Hard Disk Partition representation: in Linux, HD * X or SD * X is used, where * represents a, B, c ...... ...... Numbers 1, 2, 3, and so on ...... ...... Hdds are mostly IDE hard disks; SD is mostly SCSI or mobile storage;

Boot: indicates the boot partition. In the preceding example, hda1 is the boot partition;

Start (start): indicates that a partition starts from X cylinder (magnetic column;

End: indicates that a partition ends with y cylinder (magnetic column;

ID and system indicate the same meaning. ID does not seem intuitive. We need to specify the ID to confirm the partition type when fdisk is a partition. For example, if the ID is 7, NTFS is used; this must be specified through the T function in fdisk.

Blocks: It means capacity. The unit is K. The value of a partition capacity comes from the following formula;

Blocks = (end value of the corresponding partition-start value of the corresponding partition) Capacity of x unit cylinder (magnetic column)

So let's calculate the size of the blocks in hda1:

Hda1 blocks = (765-1) x8225.280 = 6284113.92 K = 6284.113.92m

Note: The conversion unit is counted from the 10th digit provided by the hard disk manufacturer. If the unit is measured in binary format of the operating system, the partition capacity should be less, the obtained value is roughly the same as the value of/dev/hda1 we can see through fdisk-L. Because the conversion method is different, it is impossible to be as accurate as possible; in addition, some loss occurs during partitioning, and sometimes large or small;

Estimate whether a storage device is fully divided

To estimate whether a hard disk is fully divided, we only need to check whether the end of the last partition and the start of the next partition are a continuous number in the cylinders (column) output by fdisk-L, in addition, let's take a look at the starting part of fdisk-L for each hard disk device and its cylinders value;

For example, for the SDA device, we see 1044 cylinders. Through the SDA partition table, we can see that the end value of the previous partition + 1 is the start value of the next partition; for example, the start value of sda2 is the end value of sda1 + 1, which proves that sda1 and sda2 have no blank partitions and are continuous. In sda2, we can see that the end value is 1044, in the fdisk-l header information, there are also 1044 cylinders, proving that the hard disk has been fully divided;

[Root @ A ~] # Fdisk-L/dev/SDA

Disk/dev/SDA: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device boot start end blocks ID system
/Dev/sda1*1 13 104391 83 Linux
/Dev/sda2 14 1044 8281507 + 8e Linux LVM

Reproduced http://www.liusuping.com/ubuntu-linux/linux-disk-basic.html

Mount mounted partitions

Fdisk-l hard disk partition

DF-H hard disk partition usage

Space occupied by the Du-SH directory

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.