您应该使用哪个Linux文件系统?

When formatting partitions on a Linux PC, you’ll see a wide variety of file system options. These options don’t need to be overwhelming. If you’re not sure which Linux file system to use, there’s a simple answer.

在Linux PC上格式化分区时,您会看到各种各样的文件系统选项。 这些选项不需要压倒一切。 如果不确定使用哪个Linux文件系统,则有一个简单的答案。

快速解答:如果不确定,请使用Ext4 (The Quick Answer: Use Ext4 if You’re Not Sure)

We’ll get into the weeds and run down the difference between the various file systems in a moment, but if you aren’t sure: Use Ext4.

我们将进入杂草丛中,暂时消除各种文件系统之间的差异,但是如果您不确定,请使用:Ext4。

Ext4 is the default file system on most Linux distributions for a reason. It’s an improved version of the older Ext3 file system. It’s not the most cutting-edge file system, but that’s good: It means Ext4 is rock-solid and stable.

由于某种原因,Ext4是大多数Linux发行版中的默认文件系统。 它是旧版Ext3文件系统的改进版本。 它不是最前沿的文件系统,但这很好:这意味着Ext4坚如磐石且稳定。

In the future, Linux distributions will gradually shift towards BtrFS. BtrFS is still cutting edge and seeing a lot of development, so you’ll want to avoid it on production systems. The risk of data corruption or other problems isn’t worth the potential improvement in speed.

将来,Linux发行版将逐渐转向BtrFS。 BtrFS仍然处于领先地位,并且看到了许多发展,因此您将希望在生产系统上避免使用它。 数据损坏或其他问题的风险不值得在速度上进行潜在的提高。

Note, though, that this “use Ext4” advice only applies to Linux system partitions and other on-disk partitions only Linux will access. If you’re formatting an external drive you want to share with other operating systems, you shouldn’t use Ext4 because Windows, macOS, and other devices can’t read Ext4 file systems. You’ll want to use exFAT or FAT32 when formatting an external drive on Linux.

但是请注意,此“使用Ext4”建议仅适用于Linux系统分区以及仅Linux将访问的其他磁盘分区。 如果要格式化要与其他操作系统共享的外部驱动器,则不应使用Ext4,因为Windows,macOS和其他设备无法读取Ext4文件系统。 在Linux上格式化外部驱动器时,您将需要使用exFAT或FAT32

If you’re setting up partitions on your main Linux boot drive, you’ll also want to create a swap partition of at least a few GBs in size when setting up those partitions. This partition is used for “swap space”. It’s similar to the paging file on Windows. Linux swaps out memory to the swap space when its RAM is full. This partition must be formatted as “swap” instead of with a particular file system.

如果要在主Linux引导驱动器上设置分区,则在设置这些分区时还需要创建大小至少为几个GB的交换分区。 该分区用于“交换空间”。 它类似于Windows上的页面文件。 当其RAM已满时,Linux将内存换出到交换空间。 该分区必须格式化为“交换”格式,而不是使用特定的文件系统。

什么是日记? (What Is Journaling?)

One thing you’ll notice when choosing between file systems is that some of them are marked as a “journaling” file system and some aren’t. This is important.

在文件系统之间进行选择时,您会注意到的一件事是,其中一些被标记为“日志记录”文件系统,而有些则未被标记。 这个很重要。

Journaling is designed to prevent data corruption from crashes and sudden power loss. Let’s say your system is partway through writing a file to the disk and it suddenly loses power. Without a journal, your computer would have no idea if the file was completely written to disk. The file would remain there on disk, corrupt.

日志记录旨在防止崩溃和突然断电造成数据损坏。 假设您的系统正在将文件写入磁盘的过程中,并且突然断电。 没有日志,您的计算机将无法确定文件是否已完全写入磁盘。 该文件将保留在磁盘上,已损坏。

With a journal, your computer would note that it was going to write a certain file to disk in the journal, write that file to disk, and then remove that job from the journal. If the power went out partway through writing the file, Linux would check the file system’s journal when it boots up and resume any partially completed jobs. This prevents data loss and file corruption.

对于日记,您的计算机会注意到它将要在日记中的磁盘上写入某个文件,然后将该文件写入磁盘,然后从日记中删除该作业。 如果在写入文件的过程中电源中断了,Linux将在启动时检查文件系统的日志并恢复任何部分完成的作业。 这样可以防止数据丢失和文件损坏。

Journaling does slow disk write performance down a tiny bit, but it’s well-worth it on a desktop or laptop. It’s not as much overhead as you might think. The full file isn’t written to the journal. Instead, only the file metadata, inode, or disk location is recorded in the journal before it’s written to disk.

日志记录确实会稍微降低磁盘写入性能,但是在台式机或笔记本电脑上值得这样做。 它没有您想象的那么多开销。 完整文件不会写入日志。 而是将文件元数据,索引节点或磁盘位置记录在日志中,然后再写入磁盘。

Every modern file system supports journaling, and you’ll want to use a file system that supports journaling when setting up a desktop or laptop.

每个现代文件系统都支持日记功能,并且在设置台式机或笔记本电脑时,您将需要使用支持日记功能的文件系统。

File systems that don’t offer journaling are available for use on high-performance servers and other such systems where the administrator wants to squeeze out extra performance. They’re also ideal for removable flash drives, where you don’t want the higher overhead and additional writes of journaling.

不提供日记功能的文件系统可用于高性能服务器和其他管理员希望挤出额外性能的此类系统。 它们也是可移动闪存驱动器的理想选择,在这些驱动器中,您不需要更高的开销和额外的日志记录。

所有这些Linux文件系统之间有什么区别? (What’s the Difference Between All Those Linux File Systems?)

While Microsoft develops Windows and Apple controls macOS, Linux is an open-source project developed by the community. Anyone (or any company) with the skill and time can create a new Linux file system. That’s one reason why there are so many options. Here are the differences:

在Microsoft开发Windows和Apple控制macOS的同时,Linux是社区开发的一个开源项目。 具有技能和时间的任何人(或任何公司)都可以创建新的Linux文件系统。 这就是为什么有这么多选择的原因之一。 区别如下:

  • Ext stands for “Extended file system”, and was the first created specifically for Linux. It’s had four major revisions. “Ext” is the first version of the file system, introduced in 1992. It was a major upgrade from the Minix file system used at the time, but lacks important features. Many Linux distributions no longer support Ext.

    Ext代表“扩展文件系统”,是第一个专门为Linux创建的文件。 它有四个主要修订版本。 “ Ext”是文件系统的第一个版本,于1992年推出。它是对当时使用的Minix文件系统的重大升级,但缺少重要功能。 许多Linux发行版不再支持Ext。

  • Ext2 is not a journaling file system. When introduced, it was the first file system to support extended file attributes and 2 terabyte drives. Ext2’s lack of a journal means it writes to disk less, which makes it useful for flash memory like USB drives. However, file systems like exFAT and FAT32 also don’t use journaling and are more compatible with different operating systems, so we recommend you avoid Ext2 unless you know you need it for some reason.

    Ext2不是日记文件系统。 引入后,它是第一个支持扩展文件属性和2 TB驱动器的文件系统。 Ext2没有日志,这意味着它更少地写入磁盘,这使其对USB驱动器等闪存非常有用。 但是,像exFAT和FAT32这样的文件系统也不使用日记功能,并且与不同的操作系统更兼容,因此建议您避免使用Ext2,除非您出于某种原因知道需要使用它。

  • Ext3 is basically just Ext2 with journaling. Ext3 was designed to be backwards compatible with Ext2, allowing partitions to be converted between Ext2 and Ext3 without any formatting required. It’s been around longer than Ext4, but Ext4 has been around since 2008 and is widely tested. At this point, you’re better off using Ext4.

    Ext3基本上只是带有日记功能的Ext2。 Ext3被设计为与Ext2向后兼容,从而允许在Ext2和Ext3之间转换分区而无需任何格式。 它的存在时间要比Ext4长,但是Ext4自2008年以来就已经存在并受到广泛测试。 此时,最好使用Ext4。

  • Ext4 was also designed to be backwards compatible. You can mount an Ext4 file system as Ext3, or mount an Ext2 or Ext3 file system as Ext4. It includes newer features that reduce file fragmentation, allows for larger volumes and files, and uses delayed allocation to improve flash memory life. This is the most modern version of the Ext file system and is the default on most Linux distributions.

    Ext4还设计为向后兼容。 您可以将Ext4文件系统挂载为Ext3,也可以将Ext2或Ext3文件系统挂载为Ext4。 它包括一些新功能,这些功能可以减少文件碎片,允许更大的卷和文件,并使用延迟分配来提高闪存寿命。 这是Ext文件系统的最新版本,并且是大多数Linux发行版中的默认版本。

  • BtrFS, pronounced “Butter” or “Better” FS, was originally designed by Oracle. It stands for “B-Tree File System” and allows for drive pooling, on the fly snapshots, transparent compression, and online defragmentation. It shares a number of the same ideas found in ReiserFS, a file system some Linux distributions used to use by default. BtrFS is designed to be a clean break from the Ext series of file sytstems. Ted Ts’o, the maintainer of the Ext4 file system, considers Ext4 a short-term solution and believes BtrFS is the way forward. Expect to see BtrFS become the default in both enterprise server and consumer desktop Linux distributions in the next few years as it’s further tested.

    BtrFS ,发音为“ Butter”或“ Better” FS,最初是由Oracle设计的。 它代表“ B树文件系统”,并允许驱动器池,动态快照,透明压缩和联机碎片整理。 它具有ReiserFS(在某些Linux发行版中默认使用的文件系统)中发现的许多相同想法。 BtrFS被设计为与Ext系列文件系统完全脱节。 Ext4文件系统的维护者Ted Ts'o认为Ext4是一种短期解决方案,并相信BtrFS是前进的道路 。 随着进一步的测试,BtrFS有望在未来几年内成为企业服务器和消费者台式机Linux发行版中的默认版本。

  • ReiserFS was a big leap forward for Linux file systems when it was introduced in 2001 and it included many new features Ext would never be able to implement. ReiserFS was replaced by Reiser4, which improved on many of the features that were incomplete or lacking in the initial release, in 2004. But Reiser4 development stalled after the main developer, Hans Reiser, was sent to prison in 2008. Reiser4 still isn’t in the main Linux kernel and is unlikely to get there. BtrFS is the better long-term choice.

    ReiserFS在2001年推出时,是Linux文件系统的一大飞跃,它包含了Ext永远无法实现的许多新功能。 ReiserFS被Reiser4取代, Reiser4在2004年改进了许多功能,这些功能在初始版本中是不完整的或缺少的。但是在主要开发人员Hans Reiser于2008年入狱后,Reiser4的开发陷入了停顿。Reiser4仍然不是在主要的Linux内核中,并且不太可能到达那里。 BtrFS是更好的长期选择。

      • ZFS was designed by Sun Microsystems for Solaris and is now owned by Oracle. ZFS supports a lot of advanced features including drive pooling, snapshots, and dynamic disk striping—BtrFS will bring many of these features to Linux by default. Each file has a checksum, so ZFS can tell if a file is corrupted or not. Sun open-sourced ZFS under the Sun CDDL license, which means it can’t be included in the Linux kernel. However, you can install ZFS support on any Linux distribution. Ubuntu now offers official ZFS support starting with Ubuntu 16.04, too. Ubuntu uses ZFS by default for containers.

        ZFS是由Sun Microsystems为Solaris设计的,现在由Oracle拥有。 ZFS支持许多高级功能,包括驱动器池,快照和动态磁盘条带化-默认情况下,BtrFS将其中许多功能引入Linux。 每个文件都有一个校验和,因此ZFS可以判断文件是否损坏。 Sun在Sun CDDL许可下开源了ZFS,这意味着它不能包含在Linux内核中。 但是,您可以在任何Linux发行版上安装ZFS支持Ubuntu现在也从Ubuntu 16.04开始提供官方的ZFS支持 。 Ubuntu默认将ZFS用于容器。

      • XFS was developed by Silicon Graphics in 1994 for the SGI IRX operating system, and was ported to Linux in 2001. It’s similar to Ext4 in some ways, as it also uses delayed allocation to help with file fragmentation and does not allow for mounted snapshots. It can be enlarged, but not shrunk, on the fly. XFS has good performance when dealing with large files, but has worse performance than other file systems when dealing with many small files. It may be useful for certain types of servers that primarily need to deal with large files.

        XFS由Silicon Graphics在1994年为SGI IRX操作系统开发,并在2001年移植到Linux。在某些方面,它与Ext4相似,因为它还使用延迟分配来帮助文件碎片化,并且不允许安装快照。 它可以即时放大,但不能缩小。 XFS在处理大文件时具有良好的性能,但是在处理许多小文件时,其性能比其他文件系统差。 对于主要需要处理大文件的某些类型的服务器,它可能很有用。

      • JFS, or “Journaled File System”, was developed by IBM for the IBM AIX operating system in 1990 and later ported to Linux. It boasts low CPU usage and good performance for both large and small files. JFS partitions can be dynamically resized, but not shrunk. It was extremely well planned and has support in most every major distribution, however its production testing on Linux servers isn’t as extensive as Ext, as it was designed for AIX. Ext4 is more commonly used and is more widely tested.

        JFS或“日志文件系统”,是IBM在1990年为IBM AIX操作系统开发的,后来又移植到Linux。 它拥有低CPU使用率和大大小写文件的良好性能。 可以动态调整JFS分区的大小,但不能缩小。 它的计划非常周全,并且在每个主要发行版中都得到了支持,但是,它在Linux服务器上的生产测试并不像Ext(为AIX设计)那样广泛。 Ext4更常用,并且经过更广泛的测试。

      • Swap is an option when formatting a drive, but isn’t an actual file system. It’s used as virtual memory and doesn’t have a file system structure. You can’t mount it to view its contents. Swap is used as “scratch space” by the Linux kernel to temporarily store data that can’t fit in RAM. It’s also used for hibernating. While Windows stores its paging file as a file on its main system partition, Linux just reserves a separate empty partition for swap space.

        格式化驱动器时, 交换是一个选项,但不是实际的文件系统。 它用作虚拟内存,没有文件系统结构。 您无法挂载它以查看其内容。 交换被Linux内核用作“临时空间”,以临时存储RAM中无法容纳的数据。 它也用于Hibernate。 Windows将页面文件作为文件存储在其主系统分区上时,Linux只是为交换空间保留了一个单独的空分区。

      • FAT16, FAT32, and exFAT: Microsoft’s FAT file systems are often an option when formatting a drive in Linux. These file systems don’t include a journal, so they’re ideal for external USB drives. They’re a de facto standard that every operating system—Windows, macOS, Linux, and other devices—can read. This makes them the ideal file system to use when formatting an external drive you’ll want to use with other operating systems. FAT32 is older. exFAT is the ideal option, as it supports files over 4 GB in size and partitions over 8 TB in size, unlike FAT32.

        FAT16FAT32exFAT :在Linux中格式化驱动器时,通常可以选择Microsoft的FAT文件系统。 这些文件系统不包含日志,因此非常适合外部USB驱动器。 它们是每个操作系统(Windows,macOS,Linux和其他设备)都可以读取的事实上的标准。 这使它们成为格式化要与其他操作系统一起使用的外部驱动器时理想的文件系统。 FAT32较旧。 exFAT是理想的选择,因为它与FAT32不同,它支持4 GB以上的文件和8 TB以上的分区。

      There are other Linux file systems too, including file systems designed specifically for flash storage in embedded devices and on SD cards. But these are the options you’ll most frequently see when using Linux.

      还有其他Linux文件系统,包括专门为嵌入式设备和SD卡中的闪存存储设计的文件系统 。 但是这些是使用Linux时最常看到的选项。

      翻译自: https://www.howtogeek.com/howto/33552/htg-explains-which-linux-file-system-should-you-choose/

      • 1
        点赞
      • 0
        收藏
        觉得还不错? 一键收藏
      • 0
        评论
      评论
      添加红包

      请填写红包祝福语或标题

      红包个数最小为10个

      红包金额最低5元

      当前余额3.43前往充值 >
      需支付:10.00
      成就一亿技术人!
      领取后你会自动成为博主和红包主的粉丝 规则
      hope_wisdom
      发出的红包
      实付
      使用余额支付
      点击重新获取
      扫码支付
      钱包余额 0

      抵扣说明:

      1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
      2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

      余额充值