I am wondering if there is a file system equivalent to a round-robin database, which for a fixed size, ages off the oldest files. It is pretty easy to implement with a simple cron job, which I have, but I assume it is a problem many people have and there is perhaps something better. I wish to set a fixed-size partition, or pool, in which older files are automatically removed, or aged-off, when the pool is full. A type of circular-buffer that would use the space left by the oldest file for the new ones, whilst preserving file integrity.My cron solution compares disk usage to a threshold and recursively removes the oldest file until disk usage is again under the threshold. It is not perfect because one can't guarantee the threshold is low enough that it isn't overtaken between two cron iterations. It also doesn't maximize the use of the storage space because of the threshold value which tends to be predictive in nature (how much can I fill in one minute, between two iterations of crond). Two shortcomings I am hoping to improve upon.I am looking for a more elegant solution, akin to how the round-robin database (http://linux.die.net/man/1/rrdtool) handles this transparently, but for file systems.
Linux file system that ages off older files when partition is full
linux;filesystems
There exist many HSM (Hierarchical Storage Management) systems, mainly aimed at SAN systems. These migrate files from faster disks, to slower disks, to tape as their last-access-time becomes older. You might like to seek out one of these, if you have a SAN. Most of the ones I know of are commercial licenses though, such as the IBM Tivoli HSM that we use. You might like to take a look at OHSM though.If you just want to delete old files, then a simple cron job such as find /data -atime +30 -exec rm {} \; will delete files that have not been accessed in a certain amount of time (but make sure the filesystem is not mounted with the noatime option!) This would be highly risky, though, unless you had a good online backup system.