1 How to delete files
File deletion: Need to have the following two conditions at the same time to take effect
1 controlled by the hard connection of the file, there is a hard connection i_link+1, reducing a hard connection, i_link-1, when i_link=0, the file is deleted
Column: Create a file i_link=1, create a hard connection for this file, i_link=2, delete a hard connection, i_link-1, delete the source file i_link=0 the
2 subject to process occupancy control, when there is a process using this file, there is a process that consumes this file i_count+1, which is i_count=1. When you reduce a process that consumes i_count-1, that is, i_count=0, when no process is called i_count=0.
When the i_link=0 and i_count=0, the file will be really deleted.
There is a program to use the file when I_count + 1.
View file names that are deleted but are still occupied by the process
[Email protected] shell]# RM-RF aa/
[Email protected] shell]# Lsof | grep del
Bash 25710 root cwd DIR 253,0 0 2623611/hexudong/shell/aa (deleted)
[Email protected] shell]#
Inode Small Knot
1 disk partition formatting Ext4 file Hu will produce a certain number of Inode and the Block
2 Inode is the cable The function is to store the attribute information of the file and the index as the file.
3 Ext3/ext4 The file system block holds the actual contents of the file.
4 Inode is a piece of storage space, C6 non-boot partition inode default size 256,c5 is 128 bytes
5inode is a string of numbers, different files corresponding to the Inode (a string of numbers) is unique in the file system
6 Inode the same files, each other as hard connection files
7 when a file is created, it occupies at least one inode and one block
8 Block the size of the general has 1k,2k,4k several. Where the boot partition is 1 k, other normal partitions go 4K (C6)
9 If a file is large, it may account for multiple blocks, if the file is small, at least one. And the remaining space wasted.
Ten Inode size and Totals view
Dumpe2fs/dev/sda3|egrep-i "Block size| Inode size "
dumpe2fs/dev/sda1 | Egrep-i "Block Count|lnode count"
One View the total inode volume and usage command df–i
A how to generate and produce fixed inode size mkfs.ext4–b 2048–l 256/dev/sdb
Block Summary
1 ) disk read data is read per block.
2 a file may occupy more than one block. Disk I/O is consumed every time a block is read
3) If you want to raise the disk IIO, you should read as much as possible at once
4 a block can only hold the contents of a file, no matter how small the content, if the Block 4 K, the storage of 1K files, the remaining 3K is wasted.
5 block is not as big as possible. Block too big for small file storage will waste disk space, for example: 1000K file, Block 4K, occupy 250 Block,block 1 K, occupy 1000 blocks. Who is more efficient to access? Consumes IO 250 and 1000 times respectively
6: ) Large file (larger than 16K) general settings block larger, small files (less than 1K) generally set block dot
7 block too large for example 4 K, files are 0.1K, a lot of wasted disk space
8 The block setting is also formatted as a partition, mkfs.ext4–b 2048–l 256/dev/sdb
9) When the file is large, the block setting will increase the disk access efficiency, EXT3/EXT4 is generally set to 4K.
System operations must be knowledge points