Cainiao class: Linux system disk and File System Management (1)

Source: Internet
Author: User

1. Partition

MBR (Master Boot Recorder) Primary Boot partitions only provide up to four partitions, Primary partitions (Primary, P) and Extended partitions (Extended, E), such as 3 P + 1E, up to one extended partition can be created.

2. File System

Ext2: Standard File System

Ext3: added the log function, which is an upgraded version of ext2.

To learn about the file systems supported by linux: ls-l/lib/module/'uname-R'/kernel/fs

You need to know the file system currently enabled: cat/proc/filesystems

Minimum disk storage unit: Sector (1 sector = 512 bytes)

Logical Block: the "minimum storage unit" specified when the partition is formatted by the file system"

One block can accommodate up to one file

During partitioning, each partition is a file system. The block at the beginning of each file system is called a superblock (superblock). When accessing data, superblock is first passed, therefore, if the superblock is broken, the disk cannot work.

3. EXT2 File System (inode)

1) Ext2 plan the inode table and block area.

Inode: stores file attributes and the block in which the file content is stored (pointer). One inode: 128 byte

Block: stores File Content

2) The inode table records the following information:

File owner and user group (owner/group)

File Access Mode (read/write/excute)

File type)

File Creation or state change time (ctime), Recent read time (atime), recent modification time (mtime)

File Size

Flag for defining file attributes)

Pointer to the file's actual content (pointer)

** The default time of the Ls command is mtime (ex: ls-la-time = atime PATH)

3) How does one Read File Content in Linux?

(1) Directory: When an ext2 directory is created, ext2 will allocate an inode and at least one block to the directory.

Inode: records the attributes of the Directory and points to the allocated block.

Block: records the relevance of files or directories in this directory.

(2) file: When an ext2 file is created, ext2 will allocate at least one inode and the number of blocks relative to the file size.

Inode: records the related attributes of a file, and does not record the file name.

Block: record file name, file-related connections

4) How To Read File System Information

Dumpe2fs/dev/hda1

4. load point

The loading point is the entry to the file system. It must be a directory rather than a file.

5. Disk and directory capacity

View the maximum allowed capacity, used capacity, and used capacity of the current directory of the current Disk: df and du

/Dev/hda one partition

/Dev/hda1,/dev/hda2,/dev/hda3 as the primary partition,/dev/hda5 +/dev/hda6 +... =/Dev/hda4 is an extended partition

Du is similar to the resource manager in windows.

6. Connection file: ln (similar to the shortcut in windows)

Multiple link files may point to the same source file. Connection Files are divided into hard connections and symbolic connections.

1) Hard connection (actual connection): adds the associated data of the file in a directory and does not use inode and disk space.

2) Symbolic connection (shortcut): create an independent file to read the file content directed to it. (Mostly used). After the source file is deleted, the connection file cannot be opened.

Re-create the connection file: ln


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.