New Document
File system

The UNIX operating system enables you to split up your disk data into multiple volumes. Knowing how to do this is only half the battle, though; to make effective use of this ability, you must understand how the files on a UNIX system are organized as well as why they're organized in this way. This article addresses the issue of why you should use multiple volumes. .

Creating partitions, logical volumes, and file systems:
  • The details of how to create partitions and logical volumes vary greatly from one UNIX variant to another, so you should refer to system-specific documentation for details. Briefly, though, most x86 systems use master boot record (MBR) partitions, which are typically created with a program called fdisk. The GNU Parted program (see Resources for a link) is a more flexible tool for creating partitions; it supports advanced options such as partition resizing, and it can also create partitions using newer schemes than most fdisk programs support.
  • On some systems, such as Linux®, logical volumes exist atop ordinary partitions and therefore add a great deal of complexity to the process. You may need to create one or more partitions to hold logical volumes, then create the logical volumes in which you'll ultimately create file systems.
  • File system creation varies from one UNIX flavor to another, but the most common names for the tool that does this job are mkfs and newfs. Typically, you pass the program the name of the volume on which you want to create a new file system, as in:
  • mkfs /dev/sda3
  • or
  • newfs /dev/da0s4e
The UNIX file system tree:

UNIX uses a unified directory tree. The root directory, denoted by a forward slash (/), is at the base of this tree, and each subdirectory off of the root is a branch of the tree. Although there are differences among the various UNIX flavors, the most critical features of the UNIX directory tree are similar across all variants, as summarized in Table 1.

Directory Purpose
/etcSystem configuration files are stored here.
/binThis directory holds binaries that must be accessible at all times and that ordinary users are likely to run.
/sbinThis directory is similar to /bin, but these binaries are likely to be used only by the system administrator.
/libCritical library files reside here.
/boot This directory holds system boot files. These files may include the kernel, the boot loader, and similar files.
/usrThis directory tree holds extended system files, including its own /usr/bin, /usr/sbin, and /usr/lib directories. These files aren't necessary for basic system operation, but they may include program files for word processors, Web browsers, graphics programs, server programs, and other tools important to users.
/usr/localThis directory tree holds locally compiled programs in a directory that can be protected from package-management tools or system reinstallation.
/optThird-party commercial applications typically reside in this directory.
/var System files of a transient or variable nature reside here, such as log files, mail queues, and databases.
/home or /users Each user receives a separate subdirectory of this directory as a home directory.
/rootThis directory is the root user's home directory.
/tmpThis directory is temporary "scratch space" for all users.
/mnt or /mediaThese directories or their subdirectories hold removable media, such as DVD-ROMs or flash disks, although some systems place removable media elsewhere.
/devUNIX device files reside in this directory, enabling programs to access hardware devices.

You can use the -h (human readable) option to display the output in a format that shows the size in easier-to-understand notation.

The du Command:

The du (disk usage) command enables you to specify directories to show disk space usage on a particular directory.

This command is helpful if you want to determine how much space a particular directory is taking. Following command would display number of blocks consumed by each directory. A single block may take either 512 Bytes or 1 Kilo Byte depending on your system.

$du /etc
10     /etc/cron.d
126    /etc/default
6      /etc/dfs

The -h option makes the output easier to comprehend:

$du -h /etc
5k    /etc/cron.d
63k   /etc/default
3k    /etc/dfs
Mounting the File System:

A file system must be mounted in order to be usable by the system. To see what is currently mounted (available for use) on your system, use this command:

$ mount
/dev/vzfs on / type reiserfs (rw,usrquota,grpquota)
proc on /proc type proc (rw,nodiratime)
devpts on /dev/pts type devpts (rw)

The /mnt directory, by Unix convention, is where temporary mounts (such as CD-ROM drives, remote network drives, and floppy drives) are located. If you need to mount a file system, you can use the mount command with the following syntax:

mount -t file_system_type device_to_mount directory_to_mount_to

For example, if you want to mount a CD-ROM to the directory /mnt/cdrom, for example, you can type:

$ mount -t iso9660 /dev/cdrom /mnt/cdrom

This assumes that your CD-ROM device is called /dev/cdrom and that you want to mount it to /mnt/cdrom. Refer to the mount man page for more specific information or type mount -h at the command line for help information.

After mounting, you can use the cd command to navigate the newly available file system through the mountpoint you just made.

Unmounting the File System:

To unmount (remove) the file system from your system, use the umount command by identifying the mountpoint or device

For example, to unmount cdrom, use the following command:

$ umount /dev/cdrom

The mount command enables you to access your file systems, but on most modern Unix systems, the automount function makes this process invisible to the user and requires no intervention.

User and Group Quotas:

User and group quotas provide the mechanisms by which the amount of space used by a single user or all users within a specific group can be limited to a value defined by the administrator.

Quotas operate around two limits that allow the user to take some action if the amount of space or number of disk blocks start to exceed the administrator defined limits:

  • Soft Limit: If the user exceeds the limit defined, there is a grace period that allows the user to free up some space.

  • Hard Limit: When the hard limit is reached, regardless of the grace period, no further files or blocks can be allocated.

There are a number of commands to administer quotas:

quotaDisplays disk usage and limits for a user of group.
edquotaThis is a quota editor. Users or Groups quota can be edited using this command.
quotacheckScan a filesystem for disk usage, create, check and repair quota files
setquotaThis is also a command line quota editor.
quotaonThis announces to the system that disk quotas should be enabled on one or more filesystems.
quotaoffThis announces to the system that disk quotas should be disabled off one or more filesystems.
repquotaThis prints a summary of the disc usage and quotas for the specified file systems
Previous                                                                                                                                                       Next

Back to Top