- XFS was more fragile, but the issue seems to be fixed.
- XFS was surely a slow-FS on metadata operations, but it has been fixed recently as well.
- EXT4 is still getting quite critical fixes as it follows from commits at kernel.org's git.
- "EXT4 does not support concurrent writes, XFS does"
- (But) EXT4 is more "mainline"
So, the final answer depends on your precise requirements (as usual).
Answer from poige on Stack Exchange- XFS was more fragile, but the issue seems to be fixed.
- XFS was surely a slow-FS on metadata operations, but it has been fixed recently as well.
- EXT4 is still getting quite critical fixes as it follows from commits at kernel.org's git.
- "EXT4 does not support concurrent writes, XFS does"
- (But) EXT4 is more "mainline"
So, the final answer depends on your precise requirements (as usual).
The choice of filesystem makes a difference in certain cases. You should check if your particular use cases are affected by filesystem choice.
For the three very generic bullet points you list, it makes no difference whether you use ext4 or xfs.
If you had a requirement where you wanted to use files larger than 16 TB, you will have to use XFS. (ext 4 will soon have >16TB but not yet)
You can use ext4 but I would recommend mounting with journal_data mode which will turn off dealloc (delayed allocation) which 'caused some earlier problems. The disabling of dealloc will make new data writes slower, but make writes in the event of power failure less likely to have loss. I should also mention that you can disable dealloc without using journal_data which has some other benefits (or at least it did in ext3), such as slightly improved reads, and I believe better recovery.
Extents will still help with fragmentation. Extents make delete's of large files much faster than ext3, a delete of any sized data (single file) should be near instantaneous on ext4 but can take a long time on ext3. (any extent based FS has this advantage)
ext4 also fsck 's faster than ext3.
One last note, there were bugfixes in ext4 up to like 2.6.31? I would basically make sure you aren't running a kernel pre 2.6.32 which is an LTS kernel.
XFS is rock solid and has been in the kernel for ages. Examine tools like xfs_freeze and see if it is what you are looking for. I know this is highly subjective but I have used XFS for data storage for years without incident.
Hmmm. How do I detect a failed XFS filesystem?
I've been using XFS for ages. But... I guess I don't detect it, at all. If it mounts, I trust it works. That's how most people do it... filesystem checks are automated, if it boots and it's up and running, that's that.
Now, don't get me wrong. I actually do a ton of monitoring, but none of it is filesystem specific. I run SMART selftests (using select,cont to do a disk segment per day, because long simply takes too long). I run RAID checks (also in segments) and also check that there are no mismatches in parity (mismatch_cnt = 0). I get instant mail notification if any of those fail and I actually replace HDDs once they start reallocating sectors (or at least, no longer trust them with important data).
So I have monitoring to make sure the storage works as it should. This covers errors inside the drives themselves (SMART) and to some extent also errors on a higher level (RAID checks in a way also test controllers, cables, RAID logic, ...).
As long as that works fine, the filesystem better be fine, too. Outside of checksumming filesystems like ZFS/btrfs (maybe XFS in the future, too) it's not really part of the concept to run checks on a filesystem level while mounted, apart from whatever sanity checks the filesystem itself does internally.
Your output suggests you're running RAID too, and had a failed disk in that RAID; even so that really should not cause errors happening on md0, unless it was RAID without redundancy (RAID0 or already degraded RAID1/5/6/10).
You should fix your problems below the filesystem layer first. You can hardly blame XFS for disk errors and that's not how you check for disk errors.
I guess if you really wanted to run a full read test on top of the filesystem, you could do an xfsdump to a backup disk... if you're doing a full read test of your filesystem anyhow, might as well do it in a way that's meaningful somehow.
It's the nature of xfsdump to walk the XFS filesystem in its entirety and store all the files. So that should come as close as possible to a full read test, not including free space.
Of course, if you're already running another backup system, that's really the same story in a filesystem-agnostic way (and if that backup system encounters read errors that aren't just lack of permissions, it better send a mail report to you, too), although of course if it's an incremental backup, without periodic full backups it won't actually read a file more than once...
But in general, we trust filesystems to "just work" as long as the storage is known to work. While it would be nice to have each and every program without exception to elevate any and all I/O errors it encounters, I'm not aware of a generic purpose solution to actually do so. Each program does its own error handling.
Many critical storage servers enable "panic on error", so that an error wouldn't have a chance to become bigger, to cause further data damage, or to serve corrupted data to the users. With panic on error, you could just watch for panic events or system down to detect file system errors.
Of course, if you don't have a redundant system, one server going panic would mean actual down time. However, mission-critical systems must have redundancy. In fact, any data on a file system that shows such kind of I/O errors should no longer be used, and the system should be disconnected asap so that a backup system could kick in. Serving no data is actually better than serving corrupt data in most cases.
According to https://access.redhat.com/solutions/3645252, you could set the sysctl fs.xfs.panic_mask=127 to make any error detected on any XFS filesystem become a system panic.
In order to persist to the reboot of this configure systems, do:
echo 'fs.xfs.panic_mask=127' > /etc/sysctl.d/01-xfs.conf
I think you can do this by disabling one of the features that Rhel8 provides. Format the space on Rhel8 with mkfs.xfs -m reflink=0 /dev/sdN The -m reflink=0 will allow mount on both systems but the relink feature on Rhel8 will not be usable. Also see https://access.redhat.com/solutions/4582401 (will need Redhat login) for more details.
The Linux kernel configuration help says this about XFS version 4:
Option CONFIG_XFS_SUPPORT_V4, "Support deprecated V4 (crc=0) format"
The V4 filesystem format lacks certain features that are supported by the V5 format, such as metadata checksumming, strengthened metadata verification, and the ability to store timestamps past the year 2038. Because of this, the V4 format is deprecated. All users should upgrade by backing up their files, reformatting, and restoring from the backup.
If this large amount of data is expected to be long-lived, the year 2038 is not so very far away any more. However it is likely that you'll need to upgrade your hardware at least once or twice before that; you should keep in mind that the filesystem version migration needs to be done at some point before that year. It might be most convenient to do the filesystem version migration together with a hardware upgrade, if you plan accordingly.
As time goes on, the distributions might even remove the support of the XFS version 4 well in advance of the cut-off year in their new major releases, so eventually a big OS upgrade might force you to do the migration anyway.
As far as I know, XFS version 5 has turned out to be very stable with no particular issues.
Just be aware of this in your long-term planning for now.
Newer kernels have already started to warn about the timestamp limit of the XFS filesystem when appropriate. With them, you'll see a message like this from the kernel in dmesg:
xfs filesystem being mounted at <path> supports timestamps until 2038
Depending on the version of tools used to create the filesystem, even XFS V5 filesystems might cause this warning. But on XFS version 5, that can be fixed without a backup/restore cycle by running xfs_admin -O bigtime=1 on the filesystem while it's unmounted and error-free. I've recently done that on a Debian system after an upgrade from Debian 11 to 12 - the operation was quick and trouble-free.
Bad Things(TM) may happen if a filesystem is 100% full (or perhaps 105% on account of the root reserved space). Specific cases I have seen (though these are not for XFS):
- 100% full NTFS partition (we had warned the user not to run their laptop that full but they did for months...) ended up with filesystem loops so when you tried to backup data off of that 300G disk you could fill a 3T disk or whatever because loops.
- Some linux virtual machines with near 100% full disks due to a bug began writing end-of-partition bits back at the beginning of the partition, thus destroying various important bits that happen to live there.
So yes if there is a bug you could end up with a corrupt filesystem; as a precaution on test systems or during bake-in one might completely fill the disk to see what happens. Usually however the partition just fills up and writes fail without any OS or filesystem corruption (of course application software may then be Very Unhappy(TM) as the programmers never tested what happens when writes fail... e.g. stunnel stopped processing application data when it could not write logs)
(There are legitimate cases where a filesystem might be run 100% full, e.g. a database might want all the space, or it's a (mostly?) read-only partition with scads of genome data, etc.)
Otherwise there are typically no protections in place; usually some sort of monitoring gets setup that warns when a partition is X% full, or shows a large change in space consumed. Often these things can be predicted in advance based on growth over time: it's better to send an email on say Thursday ("partition X will hit 90% in three days...") than an emergency page at 3AM on a Sunday (90% full - error! error! error!).
Would it matter whether / fills up or another partition?
There's a question here about CentOS 7 (RHEL 7) stating that a full / partition causes the system to power off. I have never experienced that myself. Nonetheless, yes: it can certainly matter if a partition or volume is full: imagine not being able to write to log files, create temporary files, write to a database, upload files into a home directory, or acquire updates. It's a broad question, and there's a lot to imagine! Any trouble will be related to the purpose and configuration of the partition or volume.
I would also hope that there are protections in place
Use the audit system to alert designated staff members when the audit storage volume approaches capacity. The auditd service can be configured to take an action when disk space starts to run low. Edit the file /etc/audit/auditd.conf to use the following configuration directive.
space_left_action = email
Possible values for the action to perform are described in the "auditd.conf" man page. These include:
- ignore
- syslog
- exec
- suspend
- single
- halt
Email sent to the root account is typically aliased to the administrators of the system, who can take appropriate action. (See /etc/aliases and man newaliases.)
No, just editing /etc/fstab cannot cause xfs_repair to be executed.
For other filesystem types, it would work. But XFS is special here.
Changing the 6th field of /etc/fstab to a non-zero value on a XFS filesystem will cause the system to run fsck.xfs, whose man page says:
NAME
fsck.xfs - do nothing, successfully
[...]
However, the system administrator can force fsck.xfs to run xfs_re‐
pair(8) at boot time by creating a /forcefsck file or booting the sys‐
tem with "fsck.mode=force" on the kernel command line.
So, ordinarily fsck.xfs will do nothing at all.
If you really want xfs_repair to run at boot, there are two conditions that both must be satisfied:
a) The 6th field of /etc/fstab must be non-zero for the XFS filesystem in question, so that fsck.xfs will be executed.
b) Either a /forcefsck file must exist on the root filesystem (or perhaps within initramfs, if planning to check the root filesystem), or the kernel command line must have the fsck.mode=force boot option. This will cause fsck.xfs to run xfs_repair instead of doing nothing.
What's so special with xfs_repair, then?
The XFS filesystem and the xfs_repair tool both will assume that the underlying disk is in good condition, or at least is capable of transparently replacing bad blocks with built-in spare blocks (as all modern disks do). If a modern disk has persistent bad blocks visible to the operating system, it usually means that the built-in spare block mechanism has already been overwhelmed by the amount of bad blocks, and the disk is probably going to fail completely soon enough anyway.
The man page of xfs_repair says:
Disk Errors
xfs_repair aborts on most disk I/O errors. Therefore, if you are trying
to repair a filesystem that was damaged due to a disk drive failure,
steps should be taken to ensure that all blocks in the filesystem are
readable and writable before attempting to use xfs_repair to repair the
filesystem. A possible method is using dd(8) to copy the data onto a
good disk.
So, you probably should not set xfs_repair to run automatically in normal circumstances.
If a XFS filesystem has errors, you should always first evaluate the condition of the underlying disk: smartctl -a /dev/<disk device> might be useful, as might be using dd to read the whole contents of the partition/LV to /dev/null and seeing that the command can complete without errors.
If the disk is failing, you should first copy the contents of the partition/LV to a new, error-free disk (perhaps using dd or ddrescue), and only then you should attempt to run xfs_repair on the filesystem on the error-free disk.
Running xfs_repair automatically at boot time might be an appropriate workaround if you know that something is causing filesystem-level errors even when your disks are in good condition. But that is just a workaround, not a fix: you should find out what is causing the filesystem errors, and fix the root cause. (Maybe a filesystem driver bug, requiring an updated kernel package to fix?)
If the files on /dev/sda have errors, then you need to run fsck on it. Keep in mind that it won't actually repair the disk itself but just the files. If the disk indeed has errors and it's failing, then it's best to replace the disk and restore the data from a backup because if it gets bad enough, you'll possibly have data loss especially if the disk dies altogether.
Thanks to responses in the comments, I was able to identify the problem as XFS filesystem related.
Essentially, the filesystem was running out free space for creating inodes. The XFS filesystem seems to be using the first one Terabyte of the disk to do so.
In the case of a filesystem already running inode64, this error can be encountered if the filesystem does run low/out of disk space -- or if it cannot allocate 4 contiguous blocks for additional inodes. So if the filesystem is severely fragmented -- meaning only 1-3 blocks are together -- you will not be able to create new files but can write additional data to older files.
For further information on identifying how fragmented the free space is, please see TID 7014320 - How to tell how fragmented the free space on an XFS filesystem
If your filesystem is severely fragmented, you can either: add a significant amount of free space (i.e. 20% or more) move the data to a different filesystem and then copy it back. this will remove the free blocks between files and make it contiguous. You will find this most helpful for filesystems that store files that are <= 4,096 bytes.
https://support.microfocus.com/kb/doc.php?id=7014318
You can at least find out what's wrong by running:
xfs_repair -n /dev/mapper/rhel-root
-n runs xfs_repair in no-modify mode.
If it's complaining about it being mounted and writeable, you might want to try re-mounting it read-only (mount -r -o remount <device>), but this will probably just come back with '/dev/mapper/rhel-root is busy'.
I'd go with booting from a different medium and running xfs_check from there.
Boot from some live medium and perform the xfs_repair from there.