How to choose a file system under Linux: EXT4, Btrfs, and XFS

Source: Internet
Author: User
Tags account security

To be honest, one of the things people never think about is what file systems they use on their PCs. Windows and Mac OS X users have no reason to think about it because there is only one option for their operating system, NTFS and hfs+. Conversely, for Linux systems, there are many file systems to choose from, and now the default is the widely adopted EXT4. However, there is now a tendency to use a trend called Btrfs file system. What makes Btrfs better, what other file systems are, and when can we see a change in the Linux distribution?

Let's start with a general understanding of the filesystem and what they really do, and then we'll make a detailed comparison of some of the well-known file systems.

What is a file system?

If you're not sure what the file system does, it's easy to sum up in one sentence. File systems are primarily used to control how data is stored, how data is accessed, and what other information (metadata) is associated with the data itself, and so on, when no data is used. It sounds like programming is not an easy thing to do, actually. The file system has been improved, including more functionality and more efficient completion of what it needs to do. All in all, it's a basic requirement for all computers, but it's not as simple as it sounds.

Why partition?

Because each operating system can create or delete partitions, many people have a vague understanding of the partition. Even with the standard installation process, the Linux operating system still uses multiple partitions on the same disk, which looks strange and requires some explanation. One of the main purposes of having different partitions is to achieve better data security in the event of a disaster.

By dividing the hard disk into partitions, the data is separated and reorganized. When an accident occurs, only the data stored on the damaged partition is destroyed, and the data on the other partitions is likely to be retained. This can be traced back to the fact that the Linux operating system does not have a log file system, and any power failures can lead to a disaster.

The use of partitioning also takes into account security and robustness reasons, so partial damage to the operating system does not mean that the entire computer is risky or compromised. This is also one of the most important factors that are currently being used for partitioning. For example, a user creates a script, program, or Web application that fills a disk, and if the disk has only one large partition, the entire system will not work if the disk is full. If the user saves the data in a different partition, then only that partition is affected, and the system partition or other data partition will still work.

Remember that having a log file system can only provide data security when power is off or when the storage device disconnects unexpectedly, and it does not protect the data when a bad block or a logic error occurs on the file system. For this scenario, the user can use a redundant array of inexpensive disks (raid:redundant array of inexpensive Disks) scenarios.

Why do I need to switch the file system?

The Ext4 file system was improved by the Ext3 file system, which was improved from the Ext2 file system. Although the Ext4 file system is very stable, it is the default choice for most distributions in the last few years, but it is based on outdated code development. In addition, Linux operating system users also need a lot of new features that the Ext4 file system itself does not provide. While these requirements can be met through some software, performance can be impacted and better performance is achieved at the file system level.

EXT4 File System

EXT4 also has some obvious limitations. The maximum file size is tebibytes (presumably 17.6 terabytes), which is much larger than the hard drives that ordinary users can buy at the moment. The maximum volume/partition that can be created with EXT4 is 1 exbibyte (approximately 1,152,921.5 terabytes). By using a variety of techniques, EXT4 has a great speed boost over ext3. Like some of the most advanced file systems, it is a log file system, which means that it records the location of the file on disk and any other changes to the disk. Throughout its capabilities, it does not support transparent compression, data deduplication, or transparent encryption. Snapshots are technically supported, but this feature is still in the experimental phase.

Btrfs File System

Btrfs has a number of different names, such as Better FS, Butter FS, or B-tree FS. It is a file system that has been developed almost entirely from scratch. Btrfs appears because its developers initially wanted to extend the functionality of the file system to include snapshots, pooling (pooling), checksums, and other functions. Although unrelated to EXT4, it also wants to preserve the features that benefit consumers and businesses in Ext4, and to integrate additional features that will benefit everyone, especially the business. For businesses using large software and large-scale databases, a file system that looks consistent across multiple hard drives can benefit them and make data consolidation easier. Removing duplicate data can reduce the amount of space your data actually uses, and using Btrfs to mirror a single, huge file system can make data mirroring simple.

The user can of course continue to choose to create multiple partitions without having to mirror anything. With this in mind, Btrfs can span multiple hard disks, and it can support more than 16 times times more disk space than EXT4. Btrfs file System A partition of the largest is Exbibytes, the largest file size is also exbibytes.

XFS File System

The XFS file system is an extension of the extended FileSystem (extent file system). XFS is a 64-bit high Performance log file system. The support for XFS probably merged into the Linux kernel in 2002, and for 2009 years, Red Hat Enterprise Linux 5.4 also supported the XFS file system. For 64-bit file systems, XFS supports a maximum file system size of 8 exbibytes. The XFS file system has some drawbacks, such as its inability to compress, and poor performance when deleting a large number of files. The Rhel 7.0 file system is currently using XFS by default.

Summarize

Unfortunately, it's not yet known when Btrfs will come. Officials say their next-generation file system is still classified as "unstable," but if users download the latest version of Ubuntu, they can choose to install on the Btrfs partition. When Btrfs is classified as "stable" remains a mystery, and until it really thinks it is "stable", users should not expect Ubuntu to default to Btrfs. It is reported that Fedora 18 will use Btrfs as its default file system, because it should have a Btrfs file system validator when it is released. Since all the functions have not yet been implemented, and the performance is slower compared to EXT4, Btrfs has a lot of work to do.

So, which is better to use? Although performance is almost the same, EXT4 is still a winner. Why is it? The answer lies in ease of use and breadth. For desktops or workstations, EXT4 is still a good file system. Because it is the file system provided by default, users can install the operating system on it. At the same time, EXT4 supports up to 1 exabytes of volumes and terabytes files, so it also has a lot of room for improvement considering size.

Btrfs provides a larger volume up to exabytes and better fault tolerance, but until now it feels more like an additional file system, while deploying a filesystem integrated into the Linux operating system. For example, although Btrfs supports different distributions, it is necessary to have the Btrfs-tools tool before using Btrfs to format the hard disk, which means that it is not an option when installing the Linux operating system, even if the different distributions differ.

Although the transfer rate is important, there are many factors in evaluating a file system in addition to the file transfer speed. Btrfs has a number of useful features, such as Write Replication (copy-on-write), extended checksum, snapshots, cleaning, self-healing data, redundant deletions, and other features that ensure data integrity. While Btrfs lacks raid-z functionality compared to ZFS, RAID is still in the experimental phase for Btrfs. For pure data storage, Btrfs seems to be better than EXT4, but time verifies everything.

To date, Ext4 seems to be a better choice for desktop systems because it is the default file system and is quicker to transfer files than Btrfs. Btrfs is certainly worth trying, but it may take some time to completely replace Ext4 on desktop Linux. Data fields and large storage pools reveal different scenarios and differences about EXT4, XCF, and Btrfs.

If you have a different or other opinion, let us know in the comments box below.

How to choose a file system under Linux: EXT4, Btrfs, and XFS

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.