Hack #55. Prevent Disk Hogs with Quotas
Wasting disk space can cost you resources and bloat backup times and storage requirements. Setting up disk quotas provides a quick solution.
Every network has one of those users who's the quintessential digital packrat, storing files and emails for years and years, regardless of their content or relative unimportance. With the growing popularity of digital media files that can range from 3 MB to 3 GB in size, these users can fill a disk to capacity in very little time. To prevent these types of users from crashing your server, consider implementing disk quotas to keep them in line.
Setting Up Disk Quotas
There are a few steps to setting up quotas, but it's a relatively simple process. After setting up quotas, you'll either have to reboot your system or manually unmount and remount any partitions to which you've added quotas. Adding and configuring disk quotas is best done while the system is in single-user mode or otherwise down for maintenance.
Let's first explore the basic concepts of disk quotas, which are soft and hard limits. The soft limit is the maximum number of disk blocks or inodes that the user can use. Once this number is exceeded, the user is warned and allowed to continue for a specified grace period. Once that grace period expires, the user may no longer allocate any additional blocks or inodes (depending on how you have the quota configured).
Hard limits are indeed hard. A hard limit may never be exceeded, and once it's reached ...
Get Linux Server Hacks, Volume Two now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.