[Svc]linux inode and block-soft-hard links

Source: Internet
Author: User
Tags parent directory

Disk structure capacity
    • Disk structure

Disk capacity = one cylinder size total number of cylinders = number of headsNumber of sectors on each track a Sector sizeTotal number of cylinders
存储容量=磁头数 × 磁道(柱面)数 × 每道扇区数 × 每扇区字节数
Understand-what is CHS (cylinder head sector)
磁盘存储最小单位是sector,那么如何对sector进行定位?CHS是早期在IBM PC架构上面用来进行磁盘寻址的办法。CHS是一个三元组,组成如下:1.      一共24个 bit位。2.      其中前10位表示cylinder,中间8位表示head,后面6位表示sector。3.      最大寻址空间

Linux Disk capacity Calculation

Inode and block of disk

Reference: http://www.ruanyifeng.com/blog/2011/12/inode.html
Http://www.cnblogs.com/iiiiher/p/5327642.html

This article is very clear.

Each directory has a. And... two directories-Interesting here

. The directory itself is counted on behalf of the current directory, so his inode is 2.
.. Top level Directory

Here, by the way, the "number of links" to the catalog file. When you create a catalog, two catalog entries are generated by default: "." and ".". The inode number of the former is the inode number of the current directory, which is equivalent to the "hard link" of the current directory, and the inode number is the inode number of the parent directory of the current directory, which is equivalent to the "hard link" of the parent directory. Therefore, the total number of "hard links" in any directory is always equal to 2 plus the total number of subdirectories (with hidden directories).

In addition to hard links, there is a special case.
The inode number for file A and file B is different, but the content of file A is the path to file B. When you read file A, the system automatically directs the visitor to file B. Therefore, regardless of which file you open, the final read is file B. At this point, file A is referred to as the "soft link" of File B (soft link) or "Symbolic link" (symbolic).
This means that file a depends on file B and if file B is deleted, opening file A will cause an error: "No such file or directory". This is the biggest difference between soft links and hard links: file a points to file B's file name, not file B's inode number, and file B's Inode "link count" does not change.
Reference: http://www.ruanyifeng.com/blog/2011/12/inode.html

Hard joins like reference data types, JS prototypes, all object sharing

Soft link Hard link

Http://www.cnblogs.com/adforce/p/3522433.html

Summary

1, the disk partition format file system, will be divided into inode and block
2,inode the properties of the file and pointers to the file entities, the file name is no longer in the inode. Block of General Opportunity directory
3. Access files via file-->inode-->blocks
4,inode General case Default size 256B block size 1 2 4k default is 4k, except boot partition
5, view the number and usage of the inode through Df-i. Dumpe2fs/dev/sda3 View the size and number of inode and block
6, a file occupies at least one inode and one block, and a single file can occupy the same inode (hard link)
7, a block can only be used by a file, if the file is small, block is large, the remaining space is wasted, can not continue to be used by other files
8,block is not the bigger the better, to choose according to the size of the business file, the general default 4k
9, you can change the size of the inode and block at the time of formatting.

Note that this is for the Ext4 file system.

Other file systems such as overlay federated file System reference:

http://blog.csdn.net/styshoo/article/details/60715942

[Svc]linux inode and block-soft-hard links

Related Article

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.