Home > Articles

Disk Usage

  • Print
  • + Share This
This chapter is from the book



  1. Why do most Unix installations organize disks into lots of partitions, rather than a smaller number of huge physical devices?

  2. When you add up the size of all the partitions on a large hard disk, there's always some missing space. Why?

  3. If you see devices /dev/sdb3, /dev/sdb4, and /dev/sdc1, what's a likely guess about how many physical hard disks are referenced?

  4. Both Solaris and Darwin offer the very helpful -k flag to the df command. What does it do, and why would it be useful?

  5. Using the -s flag to ls, the -rn flags to sort, and the -5 flag to head, construct a command line that shows you the five largest files in your home directory.

  6. What do you think would happen to our script if a very large file was accidentally left in the /home directory overnight?


  1. By dividing a disk into multiple partitions, you have created a more robust system because one partition can fill without affecting the others.

  2. The missing space is typically allocated for low-level disk format information. On a typical 10GB disk, perhaps as much as two to four percent of the disk space might not be available after the drive is formatted.

  3. This probably represents two drives: /dev/sdb and /dev/sdc.

  4. The -k flag makes a system that defaults to 512-byte blocks report file sizes in 1KB block sizes.

  5. ls -s $HOME | sort -rn | head -5.

  6. The script as written would flag the very large file as one of the largest home directories, then would fail when it tried to analyze the files within. It's an excellent example of the need for lots of error condition code and some creative thought while programming.

The next hour will continue to build the foundations of sysadmin knowledge with the oft-convoluted file ownership model. This will include digging into both the passwd and groups files and learning how to safely change them to create a variety of different permission scenarios.

  • + Share This
  • 🔖 Save To Your Account