Disk Management and file systems for the Linux learning path three

Source: Internet
Author: User
Tags reserved

What is the difference between the Ext3 file system and the Ext2 file system?

At some point, a user writes data to a Linux system, when the system is powered down or the system core is faulty, and the data written only has inode table and DataBlock, which may cause previously written data to not be saved on disk. When the system restarts, the system may recover data that is not saved. However, since the system does not know which file is incomplete, it iterates through the inode in the entire file system to see if the block is complete. However, when the data for a file is too large, the recovery time of the data may be longer, which is detrimental to the server. So in this case, the log file system was born.

How the log file system works: In a file system, there is a specific area called the logging area, when the data of a file is being written, the inode of the file is written to the log record area, and then the actual data is written to the block, if the power outage causes the data is not saved, Then when the system restarts, the system will only go to the log record area to find the incomplete files of the inode number, and then dedicated to these incomplete files for data recovery or deletion. If it is a normal write, the inode in the logging area will be re-written to the metadata area.


In the ext3 file system, there is a log file system, Ext2 file system is not, which is ext3 and ext2 file system is the fundamental difference.


In the previous article we covered many of the file systems, so how do you create a file system?

Before creating a file system, the first disk to partition, after getting multiple partitions, in the advanced format for each partition, you get a file system. so the result of advanced format partitioning is the creation of a filesystem.

Creating a file system using the MKFS command

Syntax format MKFS [-t Fstype] Appliance name

-T Fstype: Specifying the file system type

However, MKFS is a comprehensive command that can be used to create a wide variety of file systems, but our most common file system is the Ext2/ext3 file system, and the Linux system has a dedicated command to create the Ext2/ext3 file system, which is

MKE2FS command. So it is necessary for us to master this command.

The syntax format is: MKE2FS [option] Appliance name

-j: Specifies that the file system type is ext3 and the default file system type is ext2

-B Size: Specify block size, default is 4096Bytes, can be value 1024bytes,2048bytes,4096bytes

-L: Specifies the partition volume label (that is, the name of the file system)

-M #: Specifies the percentage of blocks reserved for super users

-I #: Specifies how many bytes of space create an inode number, which defaults to 8192

-N #: Specify the number of Inode

-F: Force file system creation

-E: User Specifies additional file system properties

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/38/AE/wKiom1O0Hh-SYXasAAHnZ3QnZHA167.jpg "title=" mk.png "alt=" Wkiom1o0hh-syxasaahnz3qnzha167.jpg "/>


After you have created the file system, you can use Blkid to view the related properties of the specified partition.

Syntax format:

Blkid Appliance Name: Used to view the lable, UUID, and file system type of the specified partition

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/38/AD/wKioL1O0H2yzfIFQAADymQV5y3k567.jpg "title=" id.png "alt=" Wkiol1o0h2yzfifqaadymqv5y3k567.jpg "/>


Of course, there is another command to view the volume label of a partition, which is e2lable

Syntax format: e2lable device name ( must be written ): Used to view or reset a partition's volume label

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/38/AE/wKiom1O0IdGiAa1TAAF91QdS_6c948.jpg "title=" e2.png "alt=" Wkiom1o0idgiaa1taaf91qds_6c948.jpg "/>

Of course, after creating the file system, if you want to modify the properties of a partition, you can use TUNE2FS to modify

Tune2fs to modify the properties of a file system

Syntax format tune2fs [option] Appliance name (must be written)

-j: Upgrade ext2 to ext3 without destroying the original data

-L lable: Set or modify the partition volume label

-M #: Adjust the percentage of blocks reserved for super users

-R #: Specifies the number of blocks left for the super user

-O: Set default mount Options

-C #: Specifies how many times the file system mounts for self-test, 0 or 1 To turn off this feature

-I #: Specify the number of days after each mount for self-test, 0 or 1 To turn this feature off

-L: Displays information in Superblock


To display a complete file system information, use DUMPE2FS to view

Syntax format:

DUMPE2FS Device Name: No option to display all information about the file system

Dumpe2fs-h Device Name: Displays only superblock information in the file system


As mentioned before, when the Linux system in operation, if the sudden power outage or failure of the system core, will cause our data in the hard disk and memory inconsistencies, may lead to file system confusion. When the file system is out of order, we can use the fsck command to fix

Syntax format: fsck [option] Appliance name used to check and repair Linux file system

-T Fstype: Specifies the type of file system to repair

-A: Automatic repair


In addition, E2FSCK is used specifically to check and repair the Ext2/ext3 file system.

Syntax format: e2fsck [option] Appliance name

-P: Automatic repair

-F: Forced check




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.