Operation notes: Linux hard disk partition

Source: Internet
Author: User
Tags ide hard drive

When learning Linux, we often encounter some problems. Only by solving these problems can we better learn Linux. What is Linux hard disk partition? What is Linux hard disk partition used? Partition is the "section" of the hard disk ". Windows partition has its own drive letter C:, D:, etc.), these partitions look like a separate hard disk.

The simplest case is to use the entire hard disk as a unique partition. This is basically the case if you have purchased a machine with window pre-installed.

If you want to install more operating systems on your machine, more partitions are required. You cannot install linux in this separate partition. If you want to install Windows ME and Windows at the same time, you need two partitions. The reason is that the unused operating system uses different file systems in principle. If several operating systems support the same file system, they are usually installed in different disk partitions to avoid having the same system directory under a partition.

In Linux, there are different situations where there are more partitions, for example, the root partition "/" and the swap partition "swap ".

Note: When installing Linux, you should not consider how much space is available in windows partition, because Linux cannot be used in windows partition. Create a new partition outside Windows partition.

Partition type
There are three hard disk partitions: Primary partition, extended partition, and logical partition.

A hard disk can have up to four primary partitions. You can create another extended partition to replace one of the four primary partitions. Then, you can create more logical partitions under the extended partition.

Extended partitions are only the "containers" of logical partitions ". In fact, only primary and logical partitions are used for data storage.
Tip: the built-in partition program fdisk in Windows 9x/ME can only define one primary partition. That is to say, in Windows 9x/ME, you can only define up to one primary partition, one extended partition, and more logical partitions under the extended partition. If you want to use more primary partitions, you must partition them in Linux.

Partitioning and formatting
Each operating system has its own FDISK in Windows9x/M, which is used to change the hard disk partition. It has a very convenient graphic interface tool in Windows NT/2000/XP, his location is slightly different in different Windows versions, for example, control panel-management tools-Computer Management-disk management under 2000 ). In Linux, FDISK can be used for partitioning, or a graphic interface program with the same functions.

Each primary partition and logical partition are stored with additional information that identifies the file system. Operating System Windows, Linux, and so on) it is easy to identify and confirm which partition should be used through this information. Unrecognized operating system partitions are ignored.

Of course, no file system can be generated by partitioning. After partitioning, the disk space on the hard disk is reserved and cannot be used directly. After that, the partition must be formatted. In Windows, you can use the File menu or FOMATE program in the resource manager. in Linux, mke2fs is used in most cases.

Tip: Linux supports different file systems. Ext2 is the most widely used one. Ext2 is built with the mke2fs program we mentioned above. Linux also supports the reiserfs file system.

Note: any changes to the disk partition or size will result in loss of previous data. Data must be backed up before partitioning.
Partition name in Dos/Windows
In Windows, the partitions used by the operating system are represented by the drive letter. A: And B: reserved for the soft drive. The primary and logical partitions on other disks are arranged in sequence from C. The extended partition does not have any drive letters and cannot be seen. I cannot see Linux partitions in indowsx)

If a machine has many hard disks, optical drives, and hard drives, the naming of disk partitions will be messy. In this case, the primary and logical partitions on the first hard disk will first get the name drive letter, then the second and third disks. For example, if you have three hard disks, each of which has a primary partition and two logical partitions, the first disk is named C:, F :, g:, the second is D:, H:, I:, and the third is E:, J:, K :.

In WindowsNT/2000/XP, you can change the names automatically named by these systems. For example, you can name an optical drive X, so that the name of the new partition will not change.

Partitions In unfamiliar file systems will not be named, and cannot be seen in most programs, such as resource managers. These partitions can only be displayed under FDISK in Windows 9x/ME, and Computer Management in Win2000-command interpreter.
Partition name in Linux
The partition name in Linux is clearer and more detailed than that in Windows, but the resulting name is not easy to remember. Different from the drive letter in Windows, Linux usually uses the device-name ). General hard disks, such as IDE hard disks, are named by/dev/hdxy. X indicates that hard disk a is the first hard disk, disk B is the second hard disk, and so on), and disk y is the Partition Number starting from 0, 1, 2, 3, and so on ). The SCSI hard disk is named by/dev/sdxy. The optical drive, whether it is an IDE type or SCSI, will be named like the hard disk.

Tip: IDE integrated circuit device) and SCSI small computer system interface) are currently two of the most popular computer hard drive, optical drive or soft drive systems. SCSI is faster than IDE, but it is more expensive. SCSI can be used on file servers and database servers. Linux supports these two systems. Of course, you can have both the IDE and SCSI devices on one machine)

The internal connection between the IDE hard drive and the optical drive device will be used to differentiate the device. /Dev/hda indicates the first device master of the first ide channel),/dev/hdb indicates the second device slave of the first IDE channel ). According to this principle,/dev/hdc and/dev/hdd are the master and slave devices of the second IDE channel. The two devices named "/dev/had" and "/dev/hdc" are theoretically the same. In this case, "/dev/hdb" is not used. In this case, the device is connected to the first and second IDE channels as the master)

The SCSI hard drive or optical drive device depends on the device ID. The missing ID number is not considered. For example, the IDs of the three SCSI devices are 0, 2, 5, and the device names are/dev/sda,/dev/sdb, And/dev/sdc. If you add another device with ID 3, the device will be named "/dev/sdc". The device with ID 5 will be called "/dev/sdd.

The partition number does not depend on the name of the IDE or SCSI device. Numbers 1 to 4 are reserved for the primary partition or extended partition. It is used to name the logical partition from 5. For this reason, there are often number vulnerabilities. For example, 1, 2, 5, 6, where 3 and 4 are number vulnerabilities. For example, the primary partition of the first hard disk is hda1 and the extended partition is hda2, A logical partition under the extended partition is hda5.

Here are some examples to help you understand

/Dev/hda indicates the entire IDE Hard Disk
/Dev/hda1 indicates the first primary partition of the first IDE hard disk.
/Dev/hda2 indicates the extended partition of the first IDE hard disk.
/Dev/hda5 indicates the first logical partition of the first IDE hard disk.
/Dev/hda8 indicates the fourth logical partition of the first IDE hard disk.
/Dev/hdb indicates the second IDE Hard Disk
/Dev/hdb1 indicates the first primary partition of the second IDE hard disk.
/Dev/sda indicates the first SCSI hard disk
/Dev/sda1 indicates the first primary partition of the first SCSI hard disk.
/Dev/sdd3 indicates the third primary partition of the fourth SCSI hard disk.

Complete Linux hard disk partitioning to better learn and apply Linux.

  1. Symantec BERS 2010 New Linux Backup Recovery
  2. A fog in front of Linux
  3. Linux Desktop is no longer an ugly duckling
  4. New Users learn Linux OS
  5. Linux terminal command usage Selection

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.