Linux disk partition (9)


Basic knowledge of partitioning:

Mode: MBR partition:

1. Supporting up to four primary partitions

2. The system can only install the main partition

3. Extended partition should occupy one main partition

4. MBR supports only 2TB at most, but has the best compatibility.

GTP partition:

1, support unlimited number of main partitions (but the operating system may be limited, for example, up to 128 partitions under Windows).

2. Large capacity with maximum support of 18EB (EB = 1024PB, PB = 1024TB)

3. Support GTP after Windows 7 64 bits

Disk partition under windows:


Linux partition:

1, for Linux, regardless of several partitions, which directory is allocated to use, it basically has only one root directory, an independent and unique file structure, and each partition in Linux is used to form part of the entire file system.

2. Linux adopts a method called “loading”, which includes a whole set of files and directories in the whole file system, and links a partition with a directory. A partition to be loaded at this time will make its storage space available in a directory

3. Sketch


    Disk Description:

1) Linux disk is divided into IDE hard disk and SCSI hard disk. At present, it is basically a SCSI hard disk.

2) For IDE hard drives, the driver identifier bit “hdx ~” and “hd” indicate the type of device in which the partition is located. This refers to IDE hard drives. “X” is the disk number (a is the basic disk, B is the basic subordinate disk, C is the auxiliary disk, D is the auxiliary subordinate disk), “~” represents the partition, the first four partitions are represented by the number 1-4, they are the main partition or extended partition, starting from 5 is the logical partition.

3) For SCSI hard disk, the identifier is “sdx~”


Add a new hard disk:

1. Adding Hard Disk to Virtual Machine

2. Partition: fdisk/dev/sdb

3. Formatting: mkfs-t ext4/dev/sdb1

4. Mount: First create the directory / home / newdisk, then mount the partition to the directory mount / dev / sdb1 / home / newdisk

Uninstall: umount/dev/sdb1

5. Settings can be mounted automatically: vim/etc/fstab=> Mount-a

Disk status query:

1. Query the overall disk usage of the system


2. Query the disk occupancy of the specified directory


3. Disk Conditions – Working Practical Instructions

1) Number of files in the statistics/home directory

      ls -l /home | grep “^-” | wc -l


2) Statistics of the number of directories of files under the / home directory

      ls -l /home | grep “^d” | wc -l

3) Statistics of the number of files in the / home directory, including those in subfolders

      ls -lR /home | grep “^-” | wc -l

4) Statistics the number of directories of files in the / home directory, including those in subfolders

      ls -lR /home | grep “^d” | wc -l

5) Tree display directory structure