Linux disk and archival system management--Learning notes

Source: Internet
Author: User

1.0, about the Linux disk learning

Physical hard disk Concept:

Magnetic region (Sector)

Magnetic tracks (track)

Magnetic column (Cylinder): consists of multiple disks of the same magnetic track.

Head (head)

Sector (sector): the minimum amount of physical storage, and the size of a sector is approximately 512Bytes.

Calculation formula for hard disk storage: Cylinder*head*sector*512bytes


Boot sector (MBR): This sector records the start and end of the data storage location of the magnetic column, MBR on the hard disk of the ground

On the 0 rail. where all the partition information of the hard disk is stored, and the boot manager can write the data

The location of the information.

Limitations of MBR:

The storage space is too small, resulting in the inability to fully store the disk's split information and boot manager information.

The MBR can store up to four partitions of information. This will have the partition type of primary and extended.

File system:

1. Archives: The properties of archives, contents of archives

2, the properties of the file content:

A, owner and group (Owner/group)

B, access mode of the file (Read/write/excute)

C, the type of the file (type)

D, time of the file establishment or state change (CTime), last read time (atime), recent repair

Time of modification

E, change the capacity of the file

F, define the file characteristics of flags (flag), such as setuid .... ;

G, the real content of the file point (pointer)

3, ext2 plan out the inode and block to store the attributes of the file and the contents of the file separately

A, the inode itself does not log file names, and the file names are recorded in the block blocks that the directory belongs to.

4. ext2 File system features:

A, block, and Inode are fixed at the beginning of the formatting

b, the number of files that can be accommodated in a partition is related to the number of inode

c, generally, no 4Kbytes of hard disk space allocated an inode

D, the size of an inode is 128bytes

C, block for fixed size, currently supports 1024/2048/4096bytes

D. The larger the block, the more disk space it consumes

E, about a single file:

If block size=1024, maximum capacity is 16G, if block size=2048, maximum capacity 2TB

F, file name up to 255 characters, full file name grows 4096 characters

5, ext2 find the file location process:

First, the system will read the Inode attributes from the original root location according to the file path given by the user, and get to the '/' directory

The data content in block to find the next inode position, then loop back to the last step until the final location

To the location of the file's block data, reading the data.

6. Minimum storage unit in file system: Logical block (block)

A, logical block: Refers to the file system format on the partition

B, block size is the sector of 2 of the sub-square multiples. namely: Block=1k,1block=2sector=1024bytes

C, there can only be one file in a block, if the file is smaller than block, then the disk storage space will be wasted.

D, so the size of the block when the file system was created is based on its actual use of the situation to set, if normally stored

If the file is small, you can set the block size to be smaller so that you don't waste disk space

Super Block (Superblock): Refers to the first block that starts each partition

1, role: The size of the file system, empty and filled chunks, and his respective total number of information.

2. Recorded Information:

A, block and inode total

B. Number of unused and used inode and block

C, the size of a blcok with an inode

D, the mount time of the filesystem, the last time the data was written, the last check (fsck) disk

Time and other information about the file system.

E, a valid bit value, if this file system has been mounted, then the valid bit is 0, if not mounted, then valid

The bit value is 1.

View details of the archive system: Dumpe2fs/dev/sdax

Ext3 the log function of the file system:

Refers to a specific area in the file system that is used to record the steps of a write or revision, namely:

1, when the system to write to the file, will now log record area records, a file ready to write to disk

2. Start writing permissions and data for the file

3. Start updating metadata data

4, after the completion of the data and metadata update, in the log record area to complete the record of the change file.

In such a program, if the data in the process of recording problems, then our file system just check the log records

Chunks can know that the file has a problem, so you can do a consistent check on the problem.

To view the time status information for a file:

Mtime: File modification time (ls default display)

CTime: File creation time

Atime: Last access time for files

View command: Ls-al--time=ctime/atime PATH

Link:

Hard Links:

Meaning: A hard link is a copy of the Inode attribute of a file

Advantages: So in the deletion of the previous file, in fact, the data is not really deleted, only the link and the original text

Deleted before you can actually delete the data.

Cons: You can only link to the file, you cannot link to the directory, and you cannot link across partitions.

ls-l filename Look at the second domain value can know a file made a few links, only the second domain value equals 0 is then

This file can be considered deleted.

Soft connection:

Meaning: A soft connection is an index to the inode of a file, similar to a shortcut in Windows;

Once deleted, the soft connection becomes invalid.

Pros: You can make a soft connection to a directory, or you can make a soft connection across partitions


Example For:ln-s file File_link



This note will be written here for the time being.




This article is from the It Learning Notes blog, so be sure to keep this source http://mcl9243.blog.51cto.com/10046015/1910309

Linux disk and archival system management--Learning notes

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.