Everything from “/” Start

stay Linux In the system , Catalog 、 Character device 、 Socket 、 Hard disk 、 CD drive 、 Printers and so on will be abstracted into the form of files , namely Liu Chuang What the teacher has been emphasizing “Linux Everything in the system is a file ”. Since we usually deal with documents , So how to find them ? stay Windows Operating system , Want to find a file , To enter the partition where the file is located in turn ( It’s also called drive letter ), Then enter the specific directory under the partition , Finally found this file . But in Linux It doesn’t exist in the system C/D/E/F Equal drive letter ,Linux All files in the system are from “ root (/)” The directory starts with , And according to the file system hierarchy standard (FHS:Filesystem Hierarchy Standard) Inverted tree structure is used to store files , And defines the purpose of common directories .

 The first 6 Chapter Storage structure and management of hard disk part 6 Chapter Storage structure and management of hard disk


Naming rules for physical devices

stay Linux Everything in the system is a file , Hardware is no exception . Since it’s a document , You have to have a file name . In the system kernel udev Device manager will automatically standardize the hardware name , The purpose is to let the user guess the general attributes and partition information of the device through the name of the device file ; This is especially convenient for unfamiliar equipment . in addition ,udev The services of the device manager will always run as daemons and listen for signals from the kernel to manage /dev Device files in directory .Linux The file names of common hardware devices in the system are shown in table 6-2 Shown .


File systems and data

Students can take out one A4 paper , Come across , Then write a few lines on it , Slowly you will find that the words will be more and more crooked , In the end, the whole line of words has an upward or downward slope . In order to write more neatly 、 Reading is more comfortable , There will be different kinds of books in the stationery shop —— One line book 、 Two line book 、 Tian Zi Ge Ben 、 Staff and so on . After leaving the format , Completely out of our subjective control . And the file creation performed by the user in the hardware storage device 、 write in 、 Read 、 modify 、 Transfer and control operations rely on the file system to complete . The purpose of the file system is to plan the hard disk properly , To ensure the normal use of users .


  Mount hardware

I’m used to it Windows After the system, I always take everything for granted , Usually U After the disk is inserted into the computer, it has never been considered Windows What does the system do , So that we can access this U Discoid . Next, we will learn one by one Linux How to mount and unload storage devices in the system , So that we can better understand Linux The working principle and process of adding hardware to the system . As mentioned earlier , After getting a new hard disk storage device, partition it first , Then format , Finally, it can be mounted and used normally .


Add a hard disk device

According to the theoretical knowledge related to the management of hardware equipment explained above , Let’s clarify the operation idea of adding hard disk device first : First, you need to simulate adding a new hard disk storage device to the virtual machine , And then partition 、 format 、 Mount, etc , Finally, by checking the mount status of the system and using the hard disk to verify whether the hard disk device is added successfully .


Add swap

SWAP Swap partition is a kind of partition by dividing a certain space in the hard disk in advance , The data that is not used in memory is then temporarily stored on the hard disk , A technique to free up physical memory space for more active program services to use , It is designed to solve real physical memory problems . Generally speaking, let the hard disk help the memory share the pressure . But since swap partitions are, after all, read and write data from a hard disk device , It must be slower than physical memory , So the swap’s resources are invoked only when the real physical memory runs out .


Disk capacity quota

This book has talked about ,Linux The original intention of the system is to let many people use and perform their own tasks together , To become a multi-user 、 A multitasking operating system . however , Hardware resources are fixed and limited , If some users are constantly Linux Create files or store movies on the system , Hard disk space will one day be full . In this case ,root The administrator needs to use the disk capacity quota service to limit the maximum hard disk space or the maximum number of files that a user or a user group can use for a specific folder , Once this maximum value is reached, it is no longer allowed to continue using . have access to quota Technology for disk capacity quota management , In this way, the available capacity of the user’s hard disk or the maximum number of files that can be created is limited .quota Technology also has the function of soft limit and hard limit .


VDO Virtual data optimization

Virtual Data Optimize It is a technology to optimize the storage space by compressing or deleting the data on the storage device , abbreviation VDO, It’s called virtual data optimization in Chinese . It was acquired by red hat Permabit New technology acquired after the company , stay 2019 – 2020 Around the year , Many times in RHEL7.5/7.6/7.7 Test on , At last RHEL 8 The system is officially announced .VDO The key of the technology is to delete and duplicate the original data in the hard disk , In theory, only half of the original space is enough , It’s a bit similar to the network disk service you usually use , The first normal upload is very slow , The second upload can almost reach “ Second transmission ” The effect of , No need to take up more space and wait for a long time . Except for the delete and duplicate operation , You can also compress logs and databases automatically , Further reduce storage waste .


Hard and soft links

After leading you to learn all the knowledge of hard disk management in this chapter , Finally, I can explain it boldly Linux In the system “ Shortcut ” 了 . stay Windows In the system , A shortcut is a link file to the original file , Allows users to access the original files from different locations ; Once the original file is deleted or cut to other places , Will cause the link file to be invalid . however , This seemingly simple thing is Linux It’s different in the system .

 Wechat pictures _20210423212558.jpg