Inode node introduction, view and delete

1. inode index node

Files are stored on the hard disk, and the smallest storage unit of the hard disk is called a "sector". Each sector stores 512 bytes (equivalent to 0.5KB).

When the operating system reads the hard disk, it reads multiple sectors continuously at one time, that is, reads one "block" at a time.
This "block" composed of multiple sectors is the smallest unit of file access.
The most common size of a "block" is 4KB, that is, eight consecutive sectors form a block.
Insert picture description here

File data is stored in "blocks", so obviously, we must also find a place to store the "meta information" of the file, such as the creator of the file, the creation date of the file, the size of the file, and so on.
This area for storing file meta information is called inode, which is translated as "index node" in Chinese.
Each file has a corresponding inode, which contains some information related to the file.

2. View the inode information of the file

[root@host-136 ~]# ls -i a.txt 
67146822 a.txt

3. Innode usage of the system

[root@host-136 ~]# df -i
Filesystem                Inodes IUsed    IFree IUse% Mounted on
devtmpfs                  229874   371   229503    1% /dev
tmpfs                     232888     1   232887    1% /dev/shm
tmpfs                     232888   696   232192    1% /run
tmpfs                     232888    16   232872    1% /sys/fs/cgroup
/dev/mapper/centos-root 19394560 37807 19356753    1% /
/dev/sda1                 524288   327   523961    1% /boot
tmpfs                     232888     1   232887    1% /run/user/0

4. Use rsync command to quickly delete files

4.1 Install rsync command

yum install rsync

4.2 Create an empty directory

mkdir /root/empty

4.3 Use rsync to delete the target directory test

rsync --delete-before --force -r empty/  test/

Option description:

--delete-before 接收者在传输之前进行删除操作
-r              递归处理
--force         强制删除

Guess you like

Origin blog.csdn.net/m0_46674735/article/details/112563537