Use Ext3 File System in Linux

Source: Internet
Author: User
Article Title: Use the Ext3 File System in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
By default, the file system used in Linux is Ext2, which is indeed efficient and stable. However, with the application of the Linux System in key services, the weakness of the Linux file system is gradually revealed. The ext2 file system used by the system by default is not a log file system. This is a fatal weakness in key industries. This article describes how to use the ext3 Log File System in Linux.
  
The Ext3 file system is developed directly from the Ext2 file system. Currently, the ext3 file system is very stable and reliable. It is fully compatible with the ext2 file system. You can smoothly transition to a file system with sound log functions. This is actually the original intention of the initial design of the ext3 log file system.
  
   I. Ext3 log file system features
1. High Availability
  
After the system uses the ext3 file system, the system does not need to check the file system even after it is shut down abnormally. After a crash occurs, it takes tens of seconds to restore the ext3 file system.
  
2. Data Integrity:
  
The ext3 file system can greatly improve the integrity of the file system and avoid unexpected downtime damage to the file system. There are two modes available for ext3 file systems to ensure data integrity. One of them is the "Maintain file system and data consistency at the same time" mode. In this way, you will never see junk files stored on the disk due to abnormal shutdown.
  
3. File System speed:
  
Although the ext3 file system may have to write data multiple times during data storage, in general, ext3 is better than ext2. This is because the log function of ext3 optimizes the disk drive read/write headers. Therefore, the read/write performance of the file system is not lower than that of the Ext2 file system.
  
4. Data Conversion
  
It is very easy to convert an ext2 file system to an ext3 file system. Simply Type Two commands to complete the conversion process. You do not need to take the time to back up, restore, and format partitions. Use the tune2fs tool provided by an ext3 File System to easily convert the ext2 file system to an ext3 log file system. In addition, the ext3 file system can be directly loaded into the ext2 file system without any changes.
  
5. Multiple log Modes
  
Ext3 has multiple log modes, one of which is to define the data in the file system, that is, the data of all file data and metadata) logging (data = journal mode); another mode is to record logs only for metadata, but not for data, that is, the so-called data = ordered or data = writeback mode. System Administrators can choose between system speed and file data consistency based on the actual work requirements of the system.
  
   Ii. Use the Ext3 File System
1. Download and compile the core
  
Install patches on the core and run the following patches:
  
# Make menuconfig
  
In the Filesystem menu, the following options are displayed: select the kernel to support the Ext3 File System:
  
<*> Ext3 journalling file system support (EXPERIMENTAL)
  
JBD (ext3) debugging support
  
Select the Ext3 file system, save the core configuration file, and recompile the core.
  
# Make bzImage
# Make module
# Make module_install
# Make install
  
The kernel compilation and installation are complete. After starting the system with the new kernel, you can create an ext3 file system.
  
2. actually use the Ext3 File System
  
Create a new ext3 file system. For example, to format the hda5 partition on the disk to the ext3 file system and record the logs in the/dev/hda1 partition, the procedure is as follows:
  
[Root @ test/sbin] #./mke2fs-j/dev/sda5
Mke2fs 1.24a (02-Sep-2001)
Filesystem label =
OS type: Linux
Block size = 1024 (log = 0)
......
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs-c or-I to override.
  
When creating a new file system, you can see that when the ext3 file system performs an automatic detection for 180 days or 31st times is mounted, this parameter can be adjusted as needed.
  
Mount the new file system to the ext3 directory of the primary partition:
  
# [Root @ test/sbin] # mount-t ext3/dev/sda5/ext3
  
Note: The/dev/sda5 partition formatted as the ext3 file system is loaded to the/ext3 directory.
  
The ext3 code is based on ext2, and its disk format is the same as that of ext2. This means that an ext3 file system with a clean unload can be remounted as an ext2 file system. The Ext3 file system can still be loaded into the ext2 file system. You can switch a file system between ext3 and ext2. The ext3 log file still exists in the ext2 file system, but ext2 cannot recognize the log.
  
3. Convert the ext2 File System to the ext3 File System
  
Transferring the file system of linux from ext2 to ext3 has the following advantages: first, the availability of the system is enhanced, second, the data integration is improved, and third, the startup speed is improved, the fourth ext2 and ext3 file systems are easy to convert each other.
  
Take the conversion file system as an example to convert the ext2 File System to the ext3 file system. The command is as follows:
  
[Root @ test/sbin] #./tune2fs-j/dev/sda6
Tune2fs 1.24a (02-Sep-2001)
Creating journal inode: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs-c or-I to override.
  
In this way, the original ext2 file system is converted to the ext3 file system. Note: When you convert an ext2 file system to an ext3 file system, Do you not need to partition it? .
  
After the conversion, do not forget to change the file system of the corresponding partition in the/etc/fstab file from the original ext2 to ext3. If the partition you are converting is the root partition, you should also use initrd to start the system and run mkinitrd to ensure that lilo or grub can load initrd normally. If you do not perform the preceding steps, the root will still be loaded as an ext2 file system at the next startup. To view the current file system of the root partition, Run "cat/proc/mounts" to view the result, detailed descriptions can be found in the Instruction Manual of the software package with ext3
  
4. log storage location
  
Logs can be stored on another storage device, such as/dev/hda9. For example, to create an ext3 File System on/dev/hda5 and store logs on an external device/dev/hda9, run the following command:
  
# Mke2fs-J device =/dev/hda9/dev/hda5
  
5. File System Repair
  
The e2fsck in the new e2fsprogs supports the ext3 file system. When an ext3 file system is damaged, uninstall the device and fix it with e2fsck:
  
# Umount/dev/hda6
# E2fsck-fy/dev/hda6
  
In short, the ext3 Log File System is currently the most simple option for linux from the ext2 File System to the log file system, and the implementation method is also the most concise. Because it is developed directly from the ext2 file system, the system is smoothly upgraded from the ext2 File System to the ext3 log file system, ensuring the security of system data to the maximum extent. Currently, the log file system is used in linux. The safest way is to select the ext3 file system.
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.