In Linux, the full name of ext3 is "Third extended filesystem", which means "third generation extended file system" in Chinese. It is a log file system; its maximum supported capacity is 32TB, and the maximum limit for a single file is 16TB. , supports 32,000 subdirectories. The ext3 file system can greatly improve the integrity of the file system and avoid damage to the file system due to unexpected downtime.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
linux ext3 file
EXT3 is the third generation extended file system (English: Third extended filesystem, abbreviated as ext3), which is a log File system, commonly used in Linux operating systems. The maximum limit for a single file is 16TB, and the file system supports a maximum capacity of 32TB.
It is the default file system for many Linux distributions. Stephen Tweedie first showed his use of extended ext2 in the kernel mailing list in February 1999. The file system was merged into the mainline kernel starting with the 2.4.15 kernel.
Characteristics of EXT3 log file system
1. High availability
The system uses ext3 After the file system is installed, the system does not need to check the file system even after an abnormal shutdown. After a crash occurs, it only takes tens of seconds to restore the ext3 file system.
2. Data integrity
ext3 file system can greatly improve the integrity of the file system and avoid damage to the file system due to unexpected downtime. In terms of ensuring data integrity, the ext3 file system has 2 modes to choose from. One of them is the "maintain file system and data consistency simultaneously" mode. This way, you'll never see junk files stored on disk due to an abnormal shutdown.
3. File system speed
Although when using the ext3 file system, sometimes you may have to write data multiple times when storing data, but overall, , ext3 has better performance than ext2. This is because the logging function of ext3 optimizes the disk drive read and write heads. Therefore, the file system's read and write performance has not been reduced compared to the Ext2 file system.
4. Data conversion
It is very easy to convert the ext2 file system to the ext3 file system. The entire conversion process can be completed by simply typing two commands. The user does not need to Take the time to back up, restore, format partitions, etc. Use tune2fs, a small tool provided by the ext3 file system, which can easily convert the ext2 file system into an ext3 log file system. In addition, the ext3 file system can be directly loaded into an ext2 file system without any changes.
5. Multiple log modes
Ext3 has multiple log modes. One working mode is to log all file data and metadata (define the data in the file system). data, that is, the data of the data) for logging (data=journal mode); another working mode is to only log the metadata without logging the data, which is the so-called data=ordered or data=writeback mode. System administrators can choose between the system's working speed and the consistency of file data based on the actual working requirements of the system.
Why you need to migrate from ext2 to ext3 (Advantages of EXT3)
There are four main reasons: availability, data integrity flexibility, speed, and ease of migration.
1. Availability
After an abnormal crash (power outage, system crash), the ext2 file system can only be verified after consistency verification through e2fsck. Loaded for use. The time to run e2fsck mainly depends on the size of the ext2 file system. Verifying slightly larger file systems (tens of gigabytes) takes a long time. If there are many files on the file system, the verification will take longer. Verifying a file system of several hundred gigabytes can take an hour or more. This greatly limits usability. In contrast, unless a hardware failure occurs, ext3 does not require file system verification even if it is shut down abnormally. This is because data is written to disk in a manner that is consistent across the file system. After an abnormal shutdown, the time to restore an ext3 file system does not depend on the size of the file system or the number of files, but on the size of the "log" required to maintain consistency. With default log settings, recovery time is only one second (depending on hardware speed).
2. Data integrity
Using the ext3 file system, data integrity performance is reliably guaranteed during abnormal shutdown. You can choose the type and level of data protection. You can choose to keep the file system consistent, but allow the data on the file system to be damaged during an abnormal shutdown; this can provide some speed improvements in some situations (but not all situations). You can also choose to keep data reliability consistent with the file system; this means that after a crash, you won't see any data garbage in newly written files. This safe option, which maintains data integrity consistent with the file system, is the default setting.
3. Speed
Although ext3 writes data more times than ext2, ext3 is often faster than ext2 (high data flow). This is because the logging function of ext3 optimizes the rotation of the hard disk heads. You can choose from 1 of 3 logging modes to optimize speed, selectively sacrificing some data integrity.
4. Easy migration
You can easily migrate from ext2 to ext3 without reformatting the hard disk and enjoy the benefits of a reliable log file system. Yes, you can experience the advantages of ext3 without doing the long, boring, and potentially error-prone "backup-reformat-restore" operation.
There are two methods of migration: If you upgrade your system, the Red Hat Linux installer will assist with the migration. All you need to do is click the Select button for each file system.
Use the tune2fs program to add logging functionality to an existing ext2 file system. If the file system has been mounted during the conversion process, the file ".journal" will appear in the root directory; if the file system has not been mounted, the file will not appear in the file system.
To convert the file system, just run tune2fs –j /dev/hda1 (or any device name where the file system you want to convert is located), and change ext2 in the file /etc/fstab to ext3.
If you want to convert your own root file system, you must use initrd to boot. Run the program according to the manual description of mkinitrd, and confirm that initrd is loaded in your LILO or GRUB configuration (if it does not succeed, the system can still start, but the root file system will be loaded as ext2 instead of ext3. You can use the command cat / proc/mounts to confirm this.)
Extended knowledge: The main difference between EXT3 and EXT4
Linux kernel has been official since 2.6.28 Support new file system Ext4. Ext4 is an improved version of Ext3. It modifies some important data structures in Ext3, not just like Ext3 does to Ext2, it just adds a log function. Ext4 can provide better performance and reliability, as well as richer functions:
1. Compatible with Ext3
Execute several commands to get the Ext3 to Ext4 online migration without reformatting the disk or reinstalling the system. The original Ext3 data structure is still retained, and Ext4 acts on the new data. Of course, the entire file system thus obtains the larger capacity supported by Ext4.
2. Larger file systems and larger files
Compared with the maximum 16TB file system and maximum 2TB file currently supported by Ext3, Ext4 supports 1EB respectively. (1,048,576TB, 1EB=1024PB, 1PB=1024TB) file system, and 16TB files.
3. Unlimited number of subdirectories
Ext3 currently only supports 32,000 subdirectories, while Ext4 supports an unlimited number of subdirectories.
4.Extents
Ext3 uses indirect block mapping, which is extremely inefficient when operating large files. For example, for a 100MB file, a mapping table of 25,600 data blocks (each data block size is 4KB) needs to be established in Ext3. Ext4 introduces the popular concept of extents in modern file systems. Each extent is a set of continuous data blocks. The above file is expressed as "the file data is stored in the next 25,600 data blocks", which improves a lot of efficiency. .
5. Multi-block allocation
When writing data to the Ext3 file system, the Ext3 data block allocator can only allocate one 4KB block at a time. Writing a 100MB file requires calling the data block allocator 25,600 times, and Ext4's multiblock allocator "multiblock allocator" (mballoc) supports allocating multiple data blocks in one call.
6. Delayed allocation
The data block allocation strategy of Ext3 is to allocate as soon as possible, while the strategy of Ext4 and other modern file operating systems is to delay allocation as much as possible until The data blocks are allocated and written to the disk only after the file is written in the cache. This can optimize the data block allocation of the entire file, and can significantly improve performance when paired with the first two features.
7. Fast fsck
In the past, the first step of executing fsck would be very slow because it had to check all inodes. Now Ext4 gives the inode table of each group A list of unused inodes has been added to the fsck Ext4 file system. In the future, fsck Ext4 file system can skip them and only check those inodes in use.
8. Log verification
The log is the most commonly used part and can easily lead to disk hardware failure. Restoring data from a damaged log will cause more of data is corrupted. The log verification function of Ext4 can easily determine whether the log data is damaged, and it merges the two-stage logging mechanism of Ext3 into one stage, which improves performance while increasing security.
9. "No Journaling" mode
Logs always have some overhead. Ext4 allows you to turn off logs so that some users with special needs can borrow This improves performance.
10. Online defragmentation
Although delayed allocation, multi-block allocation and extents can effectively reduce file system fragmentation, fragmentation will inevitably occur. Ext4 supports online defragmentation and will provide the e4defrag tool for defragmentation of individual files or the entire file system.
11.inode related features
Ext4 supports larger inodes. Compared with Ext3’s default inode size of 128 bytes, Ext4 can accommodate more inodes. Extended attributes (such as nanosecond timestamp or inode version), default inode size is 256 bytes. Ext4 also supports fast extended attributes and inode reservation.
12. Persistent preallocation
In order to ensure that the downloaded file has enough space to store, P2P software often pre-creates a file with the same size as the downloaded file. empty file to avoid download failure due to lack of disk space in the next few hours or days. Ext4 implements persistent pre-allocation at the file system level and provides the corresponding API (posix_fallocate() in libc), which is more efficient than the application software itself.
13. Barrier is enabled by default
The disk is equipped with an internal cache to re-adjust the order of batch data write operations and optimize write performance, so the file system must be in The commit record can only be written after the log data is written to the disk. If the commit record is written first and the log may be damaged, data integrity will be affected. Ext4 enables barriers by default. Only when all the data before the barrier is written to disk can the data after the barrier be written. (This feature can be disabled through the "mount -o barrier=0" command.)
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of what is linux ext3. For more information, please follow other related articles on the PHP Chinese website!