Linux learning --- disk partition/relationship + mounting + Representation

Source: Internet
Author: User

Linux learning --- disk partition/relationship + mounting + Representation

Hda1:

Hd: IDE hard drive. If it is a SCSI hard disk, It is sd. This can only be remembered, there is no better way.

A: The first hard disk. If it is the second hard disk, It is B, and c, d ......

1: Primary partition. Among them, 1, 2, 3, 4 are all primary partitions, starting from 5th as logical partitions, up to 16

Relationship between disk capacity and primary partition, extended partition, and logical partition:

Hard disk capacity = primary partition capacity + extended partition capacity

Capacity of extended partitions = total capacity of each logical Partition

--------------------------------------
Cd/mnt
Mkdir winc
Mkdir wind
Mkdir wine
Mount/dev/hda1/mnt/winc
Mount/dev/hda5/mnt/wind
Mount/dev/hda6/mnt/wine
A maximum of four primary partitions exist. Therefore, logical partitions start from 5.
----------------------------------------
In the linux partition representation, the hard disk is hd, the first hard disk is hda, and the second is hdb. A hard disk can be divided into up to four primary partitions, namely, the dos primary partition, the dos extended partition, the linux Root partition and the linux swap partition both belong to the primary partition, and the four primary partitions are represented by numbers respectively, for the first hard disk, hda1, hda2, hda3, and hda4. the extended partitions can also be divided into logical partitions, with labels arranged in sequence from 5. in windows, drive C is the primary dos partition, which is hda1. Drive D is generally the first logical partition on the extended dos partition, which is hda5, drive e is hda6, and f is hda7. in linux, you can use the mount command to mount windows partitions to a folder (this folder is called a mount point), and then you can access windows partitions through this folder.

Mount-t vfat/dev/hda1/mnt/winc-o codepage = 936 iocharset = 936

By the way, you can use the following command to mount a CD, an iso image, and a USB flash disk:

Attach a CD and an iso Image

Mount-t iso 9660-o loop name. iso mount point

Mount a USB flash drive

Mount-t vfat/dev/sda1/mnt/usb

I encountered a question on the Internet:

In Linux, partitions are the primary partitions, extended partitions, and logical partitions. Use the fdisk-l command to obtain the partition information as follows:
Disk/dev/hda: 240 heads, 63 sectors, 140 cylinders.
Units = cylinders of 15120*512 bites
Device Boot Start End Blocks Id System
/Dev/hda 1 286 2162128 + c Win95 FAT32 (LBA)
/Dev/hda2*288 1960 12496680 5 Extended
/Dev/hda8 984 1816 6297448 + 83 Linux
/Dev/hda9 1817 1940 937408 + 83 Linux
Which is (5) of the extended partitions ).
The information obtained by running the df-T command is as follows:
Filesystem Type 1 k Blocks Used Avallable Use % Mounted on
/Dev/hda6 relserfs 4195632 2015020 2180612 49%/
/Dev/hda1 vfat 2159992 1854192 305800 86%/windows/c
Which does not belong to Linux system partition (6 ).
Answer:
(5)/dev/hda2, (6)/dev/hda1

There are two methods to express the hard disk in Linux:

Method 1: The entire hard disk in the IDE interface is expressed as/dev/hd [a-z] in Linux, such as/dev/hda, /dev/hdb ...... similarly, sometimes/dev/hdc may represent CDROM. This method actually represents the physical location of the hard disk, as long as the hard disk connection location remains unchanged, the label will not change.
It is no stranger to the representation of/dev/hda. in Linux, we can use fdisk-l to check whether the hard disk is/dev/hda or/dev/hdb.

Another representation method is: hd [0-n], where n is a positive integer, such as hd0, hd1, hd2 ...... hdn; numbers start from 0 and are arranged in the order of hard disks found in BIOS. If there is only one hard disk in the machine, whether we use fdisk-l to list/dev/hda or/dev/hdb, hd0 is used. If two or more hard disks exist in the machine, the first hard disk/dev/hda, the other method is hd0, the second Hard Disk/dev/hdb, And the other method is hd1.
Now, for new machines, in BIOS, the hard disk is set to hd0 or hd1, which is one of the hard disk representation methods.

In Linux, the hard disk representation of the SATA and SCSI interfaces is the same as that of the IDE interface, except that hd is replaced with sd; for example, if one hard disk is/dev/hda or another hard disk is/dev/sda, the hard disk of/dev/sda should be sd0; the Representation Method (sd [0-n], y) for each partition is the same as the algorithm in the IDE interface. For example,/dev/sda1 is (sd0, 0 ).

>>> The following are from Baidu Baike

Disk and partition device management in Linux, each hardware device is mapped to a system file, which is no exception for hard disks, optical drives, and other IDE or SCSI devices. Linux allocates a file consisting of hd prefixes to various IDE devices, while a file consisting of sd prefixes to various SCSI devices.

For example, for the first IDE device, Linux is defined as hda; for the second IDE device, hdb; and so on. The SCSI devices should be sda, sdb, and sdc.

To partition the number of partitions, you must operate on each hardware device. This may be an IDE hard disk or a SCSI hard disk. For each hard disk (IDE or SCSI) device, Linux assigns a serial number ranging from 1 to 16, which indicates the Partition Number on the hard disk.

For example, the first partition of the first IDE Hard Disk maps hda1 in Linux, and the second partition is called hda2. For SCSI hard disks, such as sda1 and sdb1.

This article permanently updates the link address:

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.