next up previous contents
Next: Document History Up: . Previous: Printing   Contents

Disk space setup (df, du, NSF)

Under UNIX, each physical disk is divided up into pieces called ``partitions'', each of which is used for a particular purpose. Some pieces are used for swapping and paging, others hold the system software, and still others hold your files and local programs. Each partition is mounted separately at a specific point somewhere underneath the ``/'' directory (remember the section on filesystems in Part I ?). It is very easy to find out which partitions are mounted where, and whether they are available, using the command df -k. df -k will print out the free disk space statistics by listing each of the partitions which are mounted. If you specify a particular directory or disk device, df -k will give you this information only for that area. This is especially useful if you are about to create large amounts of data and you aren't sure how much space is available.

Note that by asking for the space available in ``.'', you can find out information about the partition that your current directory is located in. The first column is the name of the actual device, while the last column tells you at which point it is mounted. The column ``kbytes'' gives the total space (in kB) of the filesystem. The avail column (available space) will be most useful to you column, as are the ``used'' (currently used) and ``capacity'' (percent used) heading.

At the JAC we make extensive use of a facility called the Network File System, or ``NFS'' for short. This was originally written by Sun Microsystems, and has been licensed to a number of other vendors. NFS allows us to mount disks connected to one computer on others, so that the data and programs on them can be shared between systems. All the commands and data related to accessing these disks go across the Ethernet (using TCP/IP, see above under Networking). Accessing data through NFS is therefore slower than if the disk were directly connected. Since it also puts a load on the server (the system to which the disk is physically connected) to respond to your requests, it is best in terms of response time and loading if you access very large files only from the system which can get at them directly.

Along with directly-connected disks, the df -k command will show you a list of all the disks your system has mounted through NFS. These are easy to identify since the name of the server is always put in front of the name of the disk device.

Please note that NFS-mounted disks are only accessible as long as the server they are connected to is up and running. If the server goes away, the disks will also go away. Often this can result in your process getting temporarily hung, usually until the server comes back up. If you interrupt the request (using control-C a few times and waiting patiently for the timeout) while you are in the middle of copying data, you will probably have to repeat the command after the server is back, since the file will likely be corrupted. This is rare, but it is wisest not to write out large numbers of changes to your data on a remote disk if the file will be difficult to re-create. Instead, either make a local copy temporarily, or make your changes from the system the disk is connected to. Generally speaking, however, NFS access is extremely useful and very reliable.

One other helpful command for you to know about is du. du will tell you about diskspace usage, that is, who is using how much of the disk. Note that you can only find out about files and directories you have permission to read; however it can still help. To find out how much space you are using yourself, cd to your home directory and type du. You will get a list of the usage in in blocks or kilobytes (du -k) for each directory. Note that the total for each directory will also contain the usage for subdirectories underneath it, so you don't need to add all the numbers together to get a total. A grand total will be displayed on the last line. If your partition has suddenly filled up, where there was 200MB free a few minutes ago, du will give you a better idea of who might be the culprit. It won't show you when someone's files were created, but it will help narrow down your search for big users. For example, if the space on /u has suddenly disappeared, you can type du /u and you will get a list of everybody's usage (except where the protection doesn't allow you to look at them).

truein


next up previous contents
Next: Document History Up: . Previous: Printing   Contents
h.stilmack@jach.hawaii.edu