Disk partition, mount
-
- (1) Basic knowledge of partition
- (2) Linux partition
- (3) Classic case of mounting
-
- ① Description
- ② How to add a hard disk
- ③ Step 1 of adding hard disk to virtual machine (add hard disk to virtual machine)
- ④ Step 2 of adding hard disk to the virtual machine (partition)
- ⑤ Step 3 of adding hard disk to the virtual machine (formatting)
- ⑥ Step 4 of adding a hard disk to the virtual machine (mounting)
- ⑦ Step 5 of adding a hard disk to the virtual machine (permanently mount)
- (4) Disk condition query
- (5) Disk situation-practical instructions for work
-
- ① Count the number of files in the /home folder
- ② Count the number of directories in the /home folder
- ③ Count the number of files in the /home folder, including those in subfolders
- ④ Count the number of directories under the folder, including those in subfolders
- ⑤ Display the directory structure in a tree
(1) Basic knowledge of partition
① The way of partition
② Disk partition under windows
(2) Linux partition
① Principle introduction
② Hard disk description
③ View the mounting status of all devices
指令:lsblk -f
指令:lsblk
(3) Classic case of mounting
① Description
② How to add a hard disk
③ Step 1 of adding hard disk to virtual machine (add hard disk to virtual machine)
After restarting the system:
④ Step 2 of adding hard disk to the virtual machine (partition)
说明: 开始分区后输入n,新增分区,然后选择p ,分区类型为主分区。
两次回车默认剩余全部空间。最后输入w写入分区并退出,若不保存退出输入q。
Step diagram:
⑤ Step 3 of adding hard disk to the virtual machine (formatting)
(You can use lsblk -f to check, that is, success)
⑥ Step 4 of adding a hard disk to the virtual machine (mounting)
ps: mount on the command line, it will be invalid after restart
⑦ Step 5 of adding a hard disk to the virtual machine (permanently mount)
Modify /etc/fstab to realize the mount and
add content
added, execute mount -a to take effect
(4) Disk condition query
① Query the overall disk usage of the system
② Query the disk occupancy of the specified directory
(5) Disk situation-practical instructions for work
① Count the number of files in the /home folder
wc -l :统计行
| :管道符,将前面的结果交给后面处理
grep “^-” :筛选,只保留一般的文件
grep "^d" :筛选,只保留目录
-R :递归统计子文件夹下的文件或目录
② Count the number of directories in the /home folder
③ Count the number of files in the /home folder, including those in subfolders
④ Count the number of directories under the folder, including those in subfolders
⑤ Display the directory structure in a tree
Install tree first