1. Linux disk partitioning and mounting
1. Basic knowledge of partitioning
1.1 Partitioning method
mbr partition:
①Supports up to four primary partitions
②The system can only be installed in the primary partition
③The extended partition must occupy one primary partition
④MBR only supports up to 2TB, but has the best compatibility
gtp partition: superior
①Supports unlimited primary partitions (but the operating system may limit it, such as up to 128 partitions under Windows)
②Supports a maximum capacity of 18EB (1EB=1024 PB, 1PB=1024 TB)
③ Windows 7 64-bit and later support gtp
2.linux partition
2.1 Principle introduction
①Linux no matter how many partitions it is, which directory it is assigned to. After all, there is only one root directory . An independent and unique file structure. Each Linux partition forms part of the entire file system
②Linux adopts a " loading " processing method. The entire file system contains a complete set of files and directories. Let's practice a partition and a directory. A partition loaded at this time is obtained in a directory
2.2 Schematic diagram
2. Practical instructions for disk query
1 Disk status query disk free
①Syntax: df -h
②Application: Query the overall disk usage of the system
2. Query the disk usage of the specified directory disk usage
①Syntax: du -h / directory
-s specifies directory size summary
-h with measurement unit
-aincludes files
--max-depth=1 subdirectory depth
-c adds summary values while listing details
②Application: Query the disk usage of the /opt directory, the depth is 1
du -ach --max-depth=1 /opt
3. Count the number of files in the /home folder word count
ll /home | grep "^-" | wc -l
- is the beginning of the file
wc -l counts rows
4. Count the number of directories under the /home folder
ll /home | grep "^d" | wc -l
d is the beginning of the directory
5. Count the number of files in the /home folder, including those in subfolders
ls -lR /home | grep "^-" | wc -l
6. Count the number of directories under a folder, including those in subfolders
ls -lR /home | grep "^d" | wc -l