当前位置:网站首页>File system and log analysis
File system and log analysis
2022-07-24 06:36:00 【Walking Di five flowers】
Catalog
3、 ... and 、 Access file process
6、 ... and 、 Classification of log files
One 、inode And block
1、 File data consists of meta information and actual data .
2、 The files are stored on the hard disk , The smallest unit on the hard disk is “ A sector ”, Each sector stores 512 byte
block( block ): Eight consecutive sectors make up one block block , Is the smallest unit of file access
inode( The index node ): Also called inode node , Used to store file meta information ( Meta information is quite Window Documents in / Properties of directories and so on )
( The smallest unit on the hard disk is sector 512 byte
The smallest unit of file storage is block 4K
Successive 8 Sectors make up a block block 512x8=4096 byte =4k )
3、 see inode Value method ① ls -i file / Catalog
②stat file / Catalog : stat Inquire about inode Value contains information

In use find When searching ,time Represents days , also min It means minute, which means it was modified a few minutes ago
atime Represents the access time of the file
mtime Indicates the content modification time of the file
ctime Indicates the attribute modification time of the file
Two 、 Hard and soft links
1、 The difference between hard link and soft link
Soft link :
type : Shortcut ; Operating range : It can be used across regions ; Occupancy space : Just occupy inode Value size ; Action object : You can create a directory
Hard to connect :
type : copy ; Operating range : Non cross region ; Occupancy space : The size is the same as the original file ; Action object : You cannot create a directory

experimental data



3、 ... and 、 Access file process

1、 When the range has a soft connection , First find the file name ——》 Soft connection inode node ——》 original file name ——》 The original document inode node ——》block block data
analysis : When deleting the original file , The soft connection fails , Flashing red , When a file with the same name is created, it will be restored

2、 Hard links
Hard links and original documents inode The value is the same . All point to the same inode It's worth it , All deleting soft links or hard links has no effect on each other . But if you delete inode value , There will be no documents .

Four 、 Delete inode value
1、 Normally, delete a file . System operation flow
rm -rf file name
Find the filename ——》 Find according to the file name inode value ——》 Finally, delete the data
2、 Delete inode value , The data is deleted ( The file name is only for users , The system recognizes inode value )

The delete command ①:find ./ -inum Numerical value -exec rm -i {} \; Find the items that need to be deleted under the current directory inode value , And delete
②:find ./ -inum Numerical value -delete Find the items that need to be deleted under the current directory inode value , And delete
3、 Delete inode Usefulness ( Use scenarios )
① The filename contains special characters , It may not be deleted properly . In this case, you can directly delete inode, Can play the role of deleting files
② Move or rename files , Just change the filename , No effect inode number
③ After opening a file , The system is based on inode Number to identify this file , Don't think about file names anymore .
④ After the file data is modified and saved , Will generate a new inode number .
⑤ When the system disk resources are insufficient , When data cannot be deleted by deleting the file name , We can delete inode Value to delete .
5、 ... and 、inode Value size
inode It also consumes hard disk space , When the hard disk is formatted , The operating system automatically divides the hard disk into two areas . One is the data area , Store file data ; The other is inode District (inode table) , Deposit inode The information contained .
6、 ... and 、 Classification of log files
Log files are used to record Linux Files of various running messages in the operating system , Be the host first “ Diary ”.
1、 The role of logs : Auxiliary obstacle removal ; Data recovery ; Data analysis
2、 Classification of log :
Kernel and system log : This kind of log data is served by the system rsyslog Unified management , According to its main configuration file ./etc/rsyslog.conf The settings in determine where to record kernel messages and various system program messages
User logs : This kind of log data is used to record Linux. Operating system information about user login and logout , Include user name 、 Logged in terminal 、 The login time 、 Source host 、 Process operations in use, etc
Program log : Some applications choose to manage a log file independently ( Not to rsyslog)) Service management ), Used to record all kinds of event information in the process of running this program .
3、 The level of system kernel log messages , common 8 level , We use 3 Level and 4 Level 2 .
The more important the program or service , The log information with lower priority should be saved , In this way, it is convenient to check the fault
Linux Priority of system kernel log messages ( The lower the number level , The higher the priority , The more important the news is ):
0 EMERG( emergency ): It will lead to the unavailability of the host system .
1 ALERT( Warning ): A problem that must be solved immediately .
2 CRIT( serious ): A more serious situation .
3 ERR( error ): There was an error running .
4 WARNING( remind ): It may affect the function of the system , Important events that need to alert users .
5 NOTICE( Be careful ): It doesn't affect normal function , But the things that need attention .
6 INFO( Information ): General information .
7 DEBUG( debugging ): A program or system i Debugging information, etc .
summary :
To study the inode value , His differences and usage , And delete inode Value to delete the file , Classification of logs and viewing logs
边栏推荐
- 【217】#!/ The meaning of usr/bin/env
- Windows下bat脚本备份MySQL数据库
- Transition effect
- Remember 20 classic interview questions of performance test in three minutes
- Do not rent a server, build your own personal business website (how to buy a domain name)
- Summary of common working methods (7S, SWOT analysis, PDCA cycle, smart principle, 6w2h, time management, WBS, 28 principles)
- [214] what is an automation framework
- 【218】CS架构和BS架构以及数据放在服务端和客户端的利与弊?
- Customize MVC 3.0
- Heap overflow of kernel PWN basic tutorial
猜你喜欢

Tensorflow GPU installation -- 056

The public network uses Microsoft Remote Desktop remote desktop to work remotely at any time

力扣986.区间列表的交集

Website B video is embedded in the web page, and relevant controls are hidden

Install Apache manually

IP notes (10)
![[214] what is an automation framework](/img/bb/24c35613c49357258876ce3f1611ee.jpg)
[214] what is an automation framework

Leetcode does not add, subtract, multiply, divide, and calculate the number of 1 in binary
![Public access intranet IIS website server [no public IP required]](/img/e5/45d7c59ed30bbf901f793f25e229e2.png)
Public access intranet IIS website server [no public IP required]

Maximum value of jz47 gifts (dynamic planning ideas)
随机推荐
Remember to get the password of college student account once, from scratch
Responsive page
Li Kou 986. Intersection of interval lists
[214] what is an automation framework
Leetcode sword finger offer jz23: the entry node of the link in the linked list
API process and code structure
Batch implementation of key based authentication using sshpass
object-oriented
Wasm vs EVM, Boca's choice predicts the future of the public chain
一批面试题及答案_20180403最新整理
Leetcode sword finger offer jz42 maximum sum of continuous subarrays
SSH远程访问及控制
Common commands and package management of go language
Customize MVC 3.0
XML parsing
[test tool]
DNS域名解析服务
【217】#!/usr/bin/env 的意义
Sed command
Ia class summary (1)