![]() |
|||||
Duke
University |
|||||
Computing & Statistics Lab | |||||
Chapter 4 - Managing Your Space - How not to fill up the partitions
partition - a logical subdivision of a physical hard disk; works just
like a hard disk but allows users to be grouped on different
partitions, thus preventing one user from filling up everyone's disk
space
How full are the partitions and how much space am I using??
To see how full the partitions are, issue the command 'df -k' to get
output similar to the example below.
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c3t2d0s4 3098383 2053177 983239 68% /home/garcia
/dev/dsk/c3t1d0s4 8680661 4355956 4237899 51% /home/hart
/dev/dsk/c3t1d0s5 8680661 1689792 6904063 20% /home/weir
/dev/dsk/c3t2d0s0 1972767 880840 894651 50% /home/ford
You can disregard the 'Filesystem' column; 'kbytes' is the total
capacity of the partition; 'used' is how much of that total is being
used; 'avail' is how much is left; 'capacity' is how much is being
used as a percentage of the total; and 'Mounted on' is the name of
the partition.
The command 'pwd' prints your current working directory. For example:
irv@gerisparc> pwd
/home/hart/irv/notes
The first two names in the path correspond to one of the partitions from
the 'df' command in the 'Mounted on' column. To see how much of the
partition you are using, issue the command 'cd' to move you to your login
directory; then issue the command 'du -sk'. This will give you the total
space used by all of the files in all your directories in thousands of
bytes.
Here's an example:
irv@rubin> cd
irv@rubin> du -sk
87850 .
This directory tree uses 87,850,000 bytes, aka 87,850 K or 87.85 Meg.
The du command may take a while to complete if you have a large directory
tree.
Copying and Moving Files -
You may wish to copy a file if, for example, you are going to modify
it but you want a known good copy easily available as a backup.
'cp filename filename.sav' will preserve the original file and create a
copy with the extension '.sav'. After you are satisfied that your
modification is correct, you can remove the backup with 'rm filename.sav'.
Perhaps you have started creating files for a new project in your root
directory. Soon you have quite a few, and they are mixed in with all the
other files in that directory. You create a new directory for this project
with the 'mkdir' command and move the relevant files to it. Here's how to
use the 'mv' (move) command: 'mv filename new_path'.
Removing (deleting) Files -
Here is where things can get dangerous. The 'rm' command is used to
remove specified files, and 'rmdir' removes specified directories
provided they are empty. The danger lies in the specification of the
files, or more accurately the lack thereof. 'rm *' will remove everything
in the current directory. 'rm -R *' will remove everything in the current
directory and in all subdirectories even if they are not empty. It's
important to maintain a balance between the convenience of removing
numerous files with one command and the sudden wrenching of the gut when
you realize that you have deleted years of hard work.
One of the ways to prevent disaster is to use '-i', the interactive
option. With this option, 'rm' prompts for confirmation before removing
any files. Another way is to never use the wildcard * by itself. Remove
groups of related files such as '*.log' or '*.txt' and 'ls' the directory
each time to make sure you are not closing in on something worth keeping.
File Compression -
Compressing a file reduces the amount of space it takes up on a disk.
To access such a file, naturally, one must decompress it. The commands for
doing these things are uncommonly (for UNIX) obvious. 'compress filename'
will compress the specified file and change the name by adding the
extension '.Z' (note uppercase Z). 'uncompress filename' will uncompress
the file and remove the '.Z' extension.
The system automatically runs a job every Tuesday, Thursday and
Saturday mornings that evaluates all uncompressed files based on size and
the time of last access to determine whether or not to compress them. The
larger the file, the sooner it gets compressed.
File Size # Days Since Last Access
1 K 35
10 K 15
100 K 7
1 Meg 2
Three things to remember. First, if the system says it cannot find a
file you are looking for, check to see if it was compressed and now has
the '.Z' extension. Second, different types of files will result in
different compression ratios. Binary files, database and SAS dataset files
in particular, will achieve higher compression ratios than ASCII (text)
files, sometimes as high as 8:1 versus about 1.5:1 for ASCII. Third, all
compressed files are binary, even if they started out as ASCII. Knowing
this is critical if you wish to email a file or ftp it to another
computer. Issue the command 'file filename', and the system will tell you
what kind of file it is.
Backups -
System backups to tape are run five mornings each week. The primary
goal is to be able to reconstruct the system as it existed at the time of
the last backup in the event of a disaster. Secondary to that is the
ability to restore individual files that became corrupted or deleted
by mistake.
The backups are run automatically at 4:30 am, Tuesday through
Saturday. Thus a file must exist on disk at that time to even have a
chance of making it to tape. If you work all day on a document, save it at
4:00 and delete it at 5:00 by mistake, there is no way to get it back.
Every twelve weeks we run what are known as level 0 or epoch backups.
These record to tape every file on every disk. A copy of the tape is made
and moved to off-site storage, and both tapes are kept indefinitely. Every
Tuesday at 4:30 am we run a weekly incremental backup which records every
file that has changed since the last level 0 backup. These tapes are also
copied, and the copy is moved to off-site storage. These tapes are kept
for twenty-four weeks before being reused. Wednesday through Saturday at
4:30 am we run daily incremental backups which record every file that has
changed since the last weekly backup. These tapes are kept for four weeks
before being reused.
How long and when any particular file has been on disk will determine
whether it has made it to tape and is available to be restored.
| |||||
About Us | Weekly Bulletin | Center Report | People | Research | Education | Service | Pepper Grant | Links | DUMC | Duke Copyright 2004 Duke University Center for the Study of Aging and Human Development Questions or Comments? Contact Webmaster |
|||||