Linux Partitioning and Disk Management __linux

Source: Internet
Author: User
Tags diff disk usage ide hard drive
1. Overview

First of all, we want to make some preliminary understanding of the basic concept of hard disk partition, the partition of hard disk mainly divides into basic partition (primarypartion) and extended partition (Extension partion) Two kinds, the sum of basic partition and extend partition cannot exceed four. The basic partition can be used immediately but cannot be partitioned. The extended partition must be partitioned again before it can be used, meaning it must be partitioned two times. So what is divided by the extended partition? It is the logical partition (Logical partion), and the logical partition is not limited in number. 2, the first knowledge of Linux partitions

For users of Windows, several partitions have several drives, and each partition gets an alphabetic identifier, which can then be used to specify the files and directories on the partition, and their file structure is independent and very well understood. But for the first-mover Linux users, this is a bit annoying. Because for Linux users, regardless of the number of partitions, to which directory to use, it ultimately has only a root directory, a separate and unique file structure. Each partition in Linux is part of the entire file system, because it employs a processing method called "Load", which contains a complete set of files and directories and links a partition to a directory. A partition to load will make its storage space available in a directory. Let's take a look at how Linux drives are identified.

/dev/sda1

SDA1:SD hard disk type, a first hard drive, 1 for partition 3, drive

For IDE hard drives, the drive identifier is "hdx~", where "HD" indicates the type of device the partition is in, and this is the IDE hard drive. "X" is the disk number (A is the base disk, B is the basic subordinate disk, C is the secondary master disk, D is the secondary slave disk, "~" represents the partition, the first four partitions are numbers 1 through 4, they are primary or extended partitions, and logical partitions begin from 5. Example: Hda3 is represented as the third partition or extended partition on the first IDE hard disk, HDB2 as the second primary or extended partition on the second IDE hard disk. The SCSI hard drive is identified as "SDX", and the SCSI hard drive uses "SD" to indicate the type of device on which the partition is located, and the rest is the same as the IDE hard disk presentation method. 4. Common Commands

1. Mount command

mount[-parameters] [device name] [Mount Point], special note: When the optical drive is mounted, the mount/mnt/cdrom/can be used directly.

2. Uninstall command

umount[Device Name]: View disk usage.


3. Other Orders

The DF (disk free) command, DF [parameters] is often used when managing disk partitions. For example df–l: see which partition a directory is in; The df-k command can be used to view disk space usage (in kilobytes). You can format the output information in conjunction with the-H (Human readable) option to make it easier to read; DF [directory full path]: View the Linux system partition specifics.

FDISK–L: Hard disk partition status.

The Du (disk usage) command can be used to view the space usage of a particular directory. The du command displays the blocks of data that each directory occupies. Depending on the system, a block of data may be 512 bytes or 1024 bytes. Examples are as follows: $du/etc. Combining the-h option allows the information to be displayed more clearly.


You can use the Stat command to view the Inode information for a file: Statdemo.txt.

diff command to find the difference between two text files: diff[parameters] <file> <file>, parameter-W: Ignores all space differences,-I: Ignores case.


When the system shuts down properly and may not be able to enter the system, the Fsck repair disk can be performed.

fsck [option]< device name >

-F Fstype Specifies the type of file system to check

-N analog display, does not really check

-R requires user confirmation when repairing

-P automatically corrects problems that are safely corrected and do not cause data loss

Fsck-p-text2/dev/hda2

         Note: You should uninstall the file system before checking.

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.