I'm managing a server with several XFS filesystems that range from 5 TB to 10 TB each. Right now, there's free space on these filesystems, and I want to prevent that space from being used without losing the ability to read and write the existing data. Unlike ext4, XFS can't be shrunk, and I can't just fill the partition with dummy files because I'm not allowed to add data to the filesystems. While I know that XFS quotas exist, the operating system and applications won't recognize them correctly, which would just cause a write error when the quota is reached. I'm looking for any alternative solutions. Would using sparse files be effective? I've also provided some context about my backup setup to explain why this matters. Essentially, I need to manage the balance of data across filesystems and ensure that the older, slower filesystems can't accept new data, so the backup solution will use the newer, optimized ones instead. Any advice?
5 Answers
I think you're seeing this as an XY problem. Instead of focusing on why to limit free space usage, why not explain the ultimate goal? If you're trying to migrate your backups to a new system, perhaps look for ways to configure your backup solution to directly migrate data rather than trying to block space. If it's set up to fill storage as it sees available space, maybe there’s a setting to prioritize which filesystems it uses?
Your backup solution's design should be fine-tuned to your needs. Trying to overflow the old filesystems so the new ones get used isn't the most straightforward. Why not present your need directly to the backup system support or community? They might have a better answer that doesn't rely on bending the filesystem's rules.
It sounds like you want to prevent applications from adding new data but still allow them to modify existing files. If that’s the goal, one option might be to mount the filesystem as read-only, which stops any new data but allows you to access existing files without issues. But this may lock you out of making any changes to existing files, so keep that in mind!
Using `fallocate` could be a workaround for your issue. It allows you to create a large file that essentially fills up the space on the filesystem, making it appear full to the applications. Just remember that sparse files don’t achieve what you're aiming for since they create the look of full usage without using any space. If your goal is to trick the system into seeing it as 'full', this could be your route!
If your main worry is about read/write permissions, consider using Access Control Lists (ACLs). You could remove write permissions on the directories, which would prevent new file creation while still keeping existing files accessible. But, I can't help but feel like this approach could lead to some unnecessary complications. Maybe have a conversation with your users about limiting storage usage instead?

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures