Your prime directive as a system administrator is to keep those systems whipped into shape and running without interfering with user’s daily operations. Sometimes the systems put you in a difficult position when their disks overflow with files. The simple solution is to remove files. But, what if you can’t do that? You have to add disk to your ailing system. But, how and where do you add that space? And, how do you keep this from happening again?

This article leads you through the discovery and remediation of disk space problems. Start your favorite virtual machine and follow along.

The Basics

The current scenario includes a Debian 5 virtual machine (VM) in VirtualBox 3.2 that currently uses two virtual disks: /dev/hda1 (5 GB) for / and /dev/hdb1 for /var (2 GB). The original 5GB wasn’t enough and the addition of the 2 GB /var disk came later to relieve those issues.

This VM is a web server, therefore, it made sense to expand /var to alleviate any future problems with disk space for that service. Can you think of any other directories that would benefit from more space on this system? Let’s explore how a system administrator can fix this problem.

Space Exploration

The most likely candidates for expansion are /usr, /home and /opt. Current disk usage in each of these directories is as follows:

Clearly, /usr is the space criminal in this scenario and the best candidate for expansion into its own virtual disk. To create a new disk for /usr, would also return 3GB of space to the / filesystem that includes /home and /opt for this system.

From the sfdiskoutput, you see that the new disk’s device name is /dev/hdc. Since we’re dedicating the entire disk to /usr, initialization is greatly simplified. The following screen is an interactive command line session using fdisk.

The true test of your handiwork is to reboot the system and confirm that everything went as planned. If something goes wrong, your system will panic. The most likely culprits, should you have any problems, are that the /etc/fstab isn’t correctly setup or that the copy and mount didn’t work correctly. Follow the ten steps exactly as shown and you should have no problems.

If your system panics and doesn’t boot, boot the system using a rescue CD, mount the disks to see what went wrong, work through the steps again and take corrective action.

A quick look at the entire system now shows that the filesystems are happy and have plenty of useable space.

Taking what you’ve learned here, you can create a new disk for /home and one for /opt, if necessary. Systems run out of space. Filesystems fill up. And, it’s your job to fix it before it’s critical.

In the old days (1990s), systems could survive on two disks (not including any mirroring or RAID): A system disk and a “home” disk. The system disk held the standard filesystems, which were partitions or slices created by the system administrator to limit users from killing the system by filling /tmp or /home. The “home” disk, mounted on /home or /h kept user’s home directories isolated from the rest of the system. For a system administrator, managing user’s misuse of space is just another annoyance. These practices helped resolve that annoyance.

Some “old timers” still practice this kind of user isolation today. The rest of us use quotas (A topic of a future article).

Next week, you’ll pay a visit to Father Time and learn to lean on NTP to keep you in sync with the rest of the world.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62