Workshop
Quiz
Why do most Unix installations organize disks into lots of partitions, rather than a smaller number of huge physical devices?
When you add up the size of all the partitions on a large hard disk, there's always some missing space. Why?
If you see devices /dev/sdb3, /dev/sdb4, and /dev/sdc1, what's a likely guess about how many physical hard disks are referenced?
Both Solaris and Darwin offer the very helpful -k flag to the df command. What does it do, and why would it be useful?
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.
What do you think would happen to our script if a very large file was accidentally left in the /home directory overnight?
Answers
By dividing a disk into multiple partitions, you have created a more robust system because one partition can fill without affecting the others.
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.
This probably represents two drives: /dev/sdb and /dev/sdc.
The -k flag makes a system that defaults to 512-byte blocks report file sizes in 1KB block sizes.
ls -s $HOME | sort -rn | head -5.
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.