9

I have an external hard drive on which i want to make a backup of my files.

Which file system between XFS and ext4 will be the fastest to write data on the hard drive?

6 Answers 6

9

Let me throw my practical answer into the ring: Go with ext4. You will see no read/write differences vs. XFS except in extreme edge cases (mass deletions of hundreds of thousands of small files, for example).

You will also find more community support for ext4 at places like AskUbuntu, simply because it is so widely used.

One notable disadvantage of XFS is that it cannot be shrunk (decrease partition size), so you would have to backup, repartition/reformat, restore if you ever wanted to decrease your XFS partition size.

3
  • XFS has data corruption detection though?
    – endolith
    Apr 25, 2017 at 4:37
  • 1
    @endolith no XFS has no data corruption detection. You can format (or activate) metadata corruption detection (via CRC, see the eponymous flag in man7.org/linux/man-pages/man8/mkfs.xfs.8.html). This is detection-only but often metadata can be repaired/rebuilt. This function helps XFS detecting otherwise silent corruption.
    – Huygens
    Oct 11, 2018 at 12:14
  • I have a kingston flashdisk formated to ext4 an its performance is terrible - playback of videos from this drive is very laggy, while any other drive is fine in this respect. I plan to reformat it to fat32 (for my tv) so I will see if it's the FS or the flashdisk HW itself (but I doubt it's a HW problem).
    – jena
    Feb 2, 2021 at 9:00
8

ext4

That was my recommendation in 2012 and it is the recommended FS in 2017. This file system is very mature with support for encryption (recent Kernel needed as of 2017) and is fast enough for most workload on an external hard drive (and even external SSDs), it is also a very safe choice with respect to data safety. That's an important factor especially when you have an external hard disk, it is not as protected as an internal one.

On a laptop for instance, even if the electricity is plugged out, you still have a battery, so the internal had drive is rather safe. However, an external plugged hard disk can be prone to disconnection, e.g.: you get up with your laptop while forgeting about the attached drive.

XFS

Provides good performance for many enterprise work load, and probably some desktop ones too. Probably those edge cases are not visible on an external USB hard drive, could be visible with external SSDs on a USB3.1 interface. There was a higher risk than upon disconnection or loss of power than some of the files are truncated to 0 with XFS, for many years this should not be an issue. XFS is now a robust and fast file system even in the event of power-loss.

You can implement encryption with XFS if you use LUKS for example. But I'm not aware of a native support within XFS for encryption.

BTRFS

In 2012 I stated "In 1 or 2 years I would recommend that file system as it supports checksum for data and journal". In 2017 I can say that this file system is pretty robust unless you want to use its RAID 5-6 support (for it you would need a very recent Kernel, so better wait for Ubuntu 18.04 LTS). On an external hard disk, which is more exposed than an internal one, BTRFS would be a very strong solution with its native checksuming of data and metadata. However if you only have one external hard drive, it will be only able to detect corrupted data but won't be able to repair them unless you set it up to store 2 copies of each data or metadata on the drive. In case of disk loss, you lose of course everything, so it is not RAID1. But if you have a corrupted sector, BTRFS could recover it if it has a copy. BTRFS supports snapshots, which could be a nice addition for a backup system.

It is not my recommended file system because it has a few peculiarities like understanding properly the disk usage and free space problems (especially if you use the compression option). In my use of BTRFS, I've also encountered a few times error with no space left on device which requires some balancing, etc. So it is not yet usable by a novice users.

2
  • It's great that you've actually followed up and updated this!
    – legends2k
    Oct 11, 2018 at 7:16
  • thank you for your comment @legends2k :-) much appreciated
    – Huygens
    Oct 11, 2018 at 12:08
6

The answer depends on your precise requirements.

ext4 has become the default filesystem for several of the popular Linux distributions including Ubuntu, Fedora and openSUSE. ext4 features several improvements over its predecessor, amongst which include support for files upto 16 tebibytes ( 1 tebibytes equals 1,024 gibibyes , with 1gibibyte equal to 1.074 gigabytes) and a maximum volume size of upto 1 Exbibyte. It is backward compatible with ext3 and ext2, making it possible to mount ext3 and ext2 as ext4. This will slightly improve performance, because certain new features of ext4 can also be used with ext3 and ext2, such as the new block allocation algorithm.

XFS is a highly scalable, high-performance file system which was originally designed at Silicon Graphics, Inc. It was created to support extremely large filesystems. XFS supports a maximum file system size of 8 exbibytes minus one (i.e. 263-1 bytes), though this is subject to block limits imposed by the host operating system. 32-bit Linux systems limit both file and file system size to 16 tebibytes.

There is a lot of information out there on this subject, but I would Start Here and try to explore if you want to take this further.

I hope this helps.

Sources:

- http://techie-buzz.com/foss/google-implements-ext4.html

- http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.0_Release_Notes/filesystems.html

1
2

I have seen many Benchmarks of these filesystems, I think is better EXT4, but the difference with XFS i think is minimal...

In read/write benchmarks there are not so many differences and i use EXT4, and it is fantastic.

1

I'd recommend against ext4 if you have serious workload.

We have two build servers that run concurrent builds of our software, and if we do more than 1 concurrent build, we get hung tasks, which then force the build to exit. If we do only 1 build at a time, it completes fine. However, this defeats the purpose of having a multi-cpu, multi-core machine which could theoretically do 8 simultaneous builds (or 1 -j8 build)

Experience with ext4 isn't too good. It's still too young to use in the real world.

3
  • 3
    Of course, being an external drive, you may not be pushing it this much :)
    – Richard
    Oct 17, 2012 at 1:02
  • This information is still useful to know and your experience seems to concur with kevinclosson.net/2012/03/06/… It would be interesting to know if the situation has changed in the intervening 5 years. Jul 12, 2017 at 14:33
  • I do use ext4 on build systems (hardware RAID server) and also on my workstation and laptop. I never encountered your problem in the past or recently. I can cross-compile the Linux kernel for my Raspberry Pi on my Workstation using 12 concurrent threads and it compiles in about 11 min on that about 9y.o. workstation (OK, I upgraded it with a SATA3 controller and a cheap consumer SSD and it has 4cores +HT running at 2.6GHz).
    – Huygens
    Oct 11, 2018 at 12:31
0

XFS is the best choice here since external drives are CPU intensive and highly dependent on the USB bus. When using extreme low power or high performance applications choices like these make a huge difference. XFS has worked great for me on an Atom N450 based appliance I built at home. It uses a whopping 9W and serves data fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .