Boot block, super fast, I node table

Source: Internet
Author: User

Guide block



Located in the first sector of the file volume, which is 512
Byte is the Boot Code of the file system, which is unique to the root file system.
The byte is null.

Data Recovery
 

 

Super Block

(
Superblock
)

Data Recovery

 
 

A file system is always defined by its super block. Therefore, when a file system is created, the super block is also created. It contains some basic parameters of the file system, such as data blocks
) And the maximum number of files. Super blocks contain critical data for catastrophic recovery. The default Super block is always at the beginning of the disk partition where the file system is located. The super block also has a backup called redundant super block, just like DoS
The copy of the file allocation table in. The redundant super block is different from the default Super block. It is stored in the disk partition discretely.

  
The super block is located in the second sector of the file system, followed by the boot block, used to describe the structure of the file system. For example, I-
The node length and file system size are stored in/usr/include/sys/filsys. h.
, The specific structure is as follows:


Struct filsys


{

Ushort s_isize ;/*
Number of data blocks occupied by the disk index node area */


Daddr_t s_fsize ;/*
Number of data blocks in the entire file system */


Short s_nfree ;/*
Number of currently registered idle blocks in the idle block logon table */


Daddr_t s_free [nicfree];/*
Free block Registration Form */


Short s_ninode ;/*
Number of idle index nodes */


Ino_t s_inode [nicinod];/*
Idle node Registration Form */


Char s_flock ;/*
Lock flag space */


Char s_ilock ;/*
Node lock flag */


Char s_fmod ;/*
Super block modification flag */


Char s_ronly ;/*
File System read-only flag */


Time_t s_time ;/*
Time when the super block was last modified */


Short s_dinfo [4];/*
Device information */


Daddr_t s_tfree ;/*
Total number of idle blocks */


Ino_t s_tinode ;/*
Total number of idle nodes */


Char s_fname [6];/*
File System name */


Char s_fpack [6];


Long s_fill [13];/*
Blank Space */


Long s_magic ;/*
Indicates the magic number of the file system */


Long s_type ;/*
New file system type */


};

 

I-

Node table

(I-node
)

A specific file is regarded as a directory or contains a pointer to its content. Each file has an I-
The descriptor associated with the node. One I-
The node contains the attributes of the file, such as the file owner, last modification time, last access time, And pointer to the data block of the file. If the first 12
Data blocks are replaced by I-
The variables in the node Structure direct to, then I-
The node structure may also contain pointers to indirect file data blocks to expand the file content in the future. Actually I-
The node structure contains 3
Data Block pointers at different levels. Each file has 4096
The second level indirect data block contains 1024 bytes.
Second-level indirect data block contains 1024 bytes
Second-level indirect data blocks point to the second-level indirect data block. Similarly, the second-level indirect data block points to the third-level data block with a size of 1024.
Bytes of indirect data blocks. However, in practical applications, Level 3 indirect data blocks are rarely used, because they are generally not that large files. The data block size of the file system is stored in the super block, which makes it possible to access the file system of different data blocks in the same system at the same time.

I-
After a node table is stored in a super block, its length is calculated by s_isize in the super block.
Fields are used to describe the attributes, length, owner, group, and data block table of a file. The data structure of the file is/usr/include/sys/ino. h.
, As follows:


Struct dinode


{


Ushort di_mode;


Short di_nlink;


Ushort di_uid;


Ushort di_gid;


Off_t di_size;


Char di_addr [40];


Time_t di_atime;


Time_t di_mtime;


Time_t di_ctime;


};

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.