当前位置:网站首页>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
边栏推荐
- Sword finger offer jz10 Fibonacci sequence
- List of problems in the re disk guidance of the project
- Function application of MySQL
- 一批面试题及答案_20180403最新整理
- 【222】内存溢出及定位
- Backup MySQL database with bat script under Windows
- go语言的快速上手
- Restful API introduction
- IP notes (11)
- Do not rent servers, build your own personal business website (2)
猜你喜欢

Quick start of go language

IP notes (10)

go的环境搭建和起步

sed命令

LuckyFrameWeb测试平台(一款支持接口自动化、WEB UI自动化、APP自动化,并且支持分布式测试的全纬度免费开源测试平台)

Summary of ten common vulnerabilities (principle, harm, defense)

Jenkins automated unattended operation (up / down)

Do not rent servers, build your own personal business website (4)
![[226] instructions for Wireshark parameters](/img/47/0d3fd221695920e02b1f690a2a21c1.png)
[226] instructions for Wireshark parameters

RAID5 and LVM are used in combination
随机推荐
Remote connection to Qunhui NAS at home [no public IP, free intranet penetration]
Polkadot | interprets how liberty plan, which subverts traditional social media, will be launched in Poka
Leetcode sword finger offer JZ9 dual stack implementation queue
Flex layout
MySQL批量修改数据表编码及字符集为utf8mb4
使用自定义zabbix包(4.0.5版本)安装agent和proxy
Write blog at leisure ~ briefly talk about let, VaR and Const
Quickly and simply set up FTP server, and achieve public network access through intranet [no need for public IP]
Do not rent servers, build your own personal business website (3)
awk的使用
实验:磁盘配额操作
General paging 01
Map the intranet to the public network [no public IP required]
NFS共享服务及实验
微信TBS在线安装内核失败的解决方法
Log collection and analysis platform
[301] grotesque behavior - predictable irrationality
Sed command
Metersphere one stop open source continuous testing platform
LuckyFrameWeb测试平台(一款支持接口自动化、WEB UI自动化、APP自动化,并且支持分布式测试的全纬度免费开源测试平台)