File System Layout


Before I begin describing the file system layout, you need to know that you do not necessarily have a single file system. Your system administrator may have set up a variety of file system types on your system. As a beginning user , you don't care too much about the different types of file systems; however, before proceeding to the file system layout, let me briefly cover some of the different file system types. Your system administrator cares a lot about the different file system types because the commands that he or she issues allow them to specify an option such as "-F" followed by the file system type. One good place to start when looking for the different file system types supported by your UNIX variant is the manual page for the mount command. The "-F" option, or another option such as "-t" for type in Linux, is usually followed by a list of file system types supported. The different file system types and command options to file system types depend on the UNIX variant that you are using. Some commands that commonly support a file system type option are dcopy, fsck, mksf, mount, newfs , and others, some of which you may need to know as an advanced user if you are going to perform system administration in the future. The following is a description of some of the commonly supported file systems on UNIX variants:

  • Personal Computer File System (PCFS) is a file system type that allows direct access to PC formatted disks.

  • UNIX File System (UFS) is the standard or basic default UNIX file system on some UNIX variants.

  • CD-ROM File System (CDFS) is used when you mount a CD-ROM. Most CD-ROMs are read-only, so you can't write to them. This is called High Sierra File System (HSFS) on some UNIX variants.

  • Network File System (NFS) is a way of accessing files on other systems on the network from your local system. An NFS mounted file system looks as though it is local to your system even though it is located on another system.

  • Loopback File System (LOFS) allows you to have the same file system in multiple places using alternate path names .

  • VxFS is an extent-based Journal File System that supports fast file system recovery and on-line features such as backup on HP-UX.

  • High Performance File System (HFS) is HP's version of the UNIX File System. This is used in most of the examples.

  • TMPFS is a memory-based file system.

  • CacheFS is a file system present in cache.

File system types is an area of high customization on UNIX variants. You will find some of the file systems listed on some UNIX variants and others on other UNIX variants. Although UNIX and its associated commands are very similar, going from one UNIX variant to another, file system types are generally peculiar to a specific UNIX variant. A good place to start when determining what file system types are included with your UNIX variant is to view the file system types listed in the manual page for mount .

The manual page for mount on the Caldera Linux system we are using lists many file system types. With the Linux mount command, you would use the -t vfstype option to specify one of the file system types to mount:

  • minix

  • ext

  • ext2

  • xiafs

  • hpfs

  • fat

  • msdos

  • umsdos

  • vfat

  • proc

  • nfs

  • iso9660

  • smb

  • ncp

  • affs

  • ufs

  • sysv

  • xenix

  • coherent

One common file system I often mount on Linux systems is a DOS floppy disk. For example, we would go through the following sequence of events to mount a DOS floppy, copy a file to it, and unmount it:

 #  mount -t msdos /dev/fd0 /mnt/floppy  #  cp * /mnt/floppy  #  ls /mnt/floppy  file1             file2     file3     file4 #  umount /dev/fd0  

This sequence of commands first mounts /dev/fd0 , which is the floppy disk device file, under the mount point /mnt/floppy. /dev/fd0 is mounted as type msdos, as specified by the -t msdos . I next copy all files in the current directory to the floppy. All the files on the floppy are then listed with ls, producing the list of four files shown. I then unmount the floppy disk with the umount command so that I can take the floppy to a DOS system and read the files. Because the floppy was mounted as type msdos, the files were written to the floppy in DOS format.

Similarly, to mount a CD-ROM on a Linux system you would issue the following mount command, unless it's mounted at boot:

 #  mount /dev/hdd /cdrom  mount: block device /dev/hdd is write-protected, mounting read-only # 

You would substitute your CD-ROM device file for /dev/hdd . This CD-ROM is, of course, a read-only device, as the message from mount indicates.

The file system layout of most UNIX variants is based on the AT&T SVR4 layout. This means that going from one UNIX variant to the next, you see pretty much the same names used in the file system layouts.

Figure 20-1 is a high-level depiction of the file system.

Figure 20-1. General UNIX File System Layout ( differs somewhat among UNIX variants)

graphics/20fig01.gif

Here are some of the more important features of the UNIX file system layout:

  • Files and directories are organized by category. The two most obvious categories that appear in Figure 20-1 are static vs. dynamic files. Also, other categories are executable, configuration, data files, and so on. The static files are also labeled "shared," because other hosts on the network may share these. The directories /usr, /sbin , and /opt are shared directories.

  • The operating system (OS) and applications are kept separate from one another. Application vendors don't care where their applications are loaded; that is up to you. But to a system administrator, it is highly desirable to keep applications separate from the operating system so you don't inadvertently have application files overwriting operating system files. In addition, if applications are loaded in a separate area, they are "modular," meaning that a system administrator can add, remove, and modify them without affecting the operating system or other applications. Applications are kept in the /opt directory.

  • Intra-system files are kept in a separate area from inter-system, or network-accessible files. /usr and /sbin are shared operating system directories. No host-specific information is in these two directories. /etc is used to hold the host-specific configuration files.

  • Executable files are kept separate from system configuration files so that the executables may be shared among hosts. Having the configuration files separate from the programs that use them also means that updates to the operating system won't affect the configuration files.

I provide descriptions of some of the most important directories of the file system layout and their contents:

/

This is the root directory, which is the base of the file system's hierarchical tree structure. A directory is logically viewed as being part of / . Regardless of the disk on which a directory or logical volume is stored, it is logically viewed as a part of the root hierarchy.

/dev

Contains host-specific device files.

/etc

Contains host-specific system and application configuration files. The information in this directory is important to the operation of the system and is of a permanent nature. There are also additional configuration directories below /etc . There are two /etc subdirectories of particular interest:

/export

Servers export root directories for networked clients . For instance, a server might export user directories such as /export/home/ username .

/home

Users' home directories are located here. Because the data stored in users' home directories will be modified often, you can expect this directory to grow in size.

/kernel

Contains kernel configuration and binary files that are required to bring up a system such as genunix.

/lost+found

This is the lost files directory. Here you find files that are in use but are not associated with a directory. These files typically become "lost" as a result of a system crash that caused the link between the physical information on the disk and the logical directory to be severed. The program fsck , which is run at the time of boot, finds these files and places them in the lost+found directory.

/mnt

This directory is reserved as a mount point for local file systems. You can either mount directly to /mnt or have /mnt subdirectories as mount points such as /mnt1, /mnt2, /mnt3 , etc.

/net

Name reserved as mount points for remote file systems.

/opt

The directory under which applications are installed. As a rule, application vendors never specify a particular location for their applications to be installed. Now, with /opt , there is a standard directory under which applications should be installed. This is an organizational improvement for system administrators because they can now expect applications to be loaded under /opt and the application name.

/sbin

Contains commands and scripts used to boot, shut down, and fix file system mounting problems. /sbin is available when a system boots, because it contains commands required to bring up a system.

/stand

Contains kernel configuration and binary files that are required to bring up a system. Two significant files contained in this directory are the system and vmunix (kernel) files.

/tmp

This is a free-for-all directory, where any user can temporarily store files. Because of the loose nature of this directory, it should not be used to store anything important, and users should know that whatever they have stored in /tmp can be deleted without notice. Application working files should go in /var/tmp or /var/opt/ appname , not in /tmp .

/usr

Most of the UNIX operating system is contained in /usr . Included in this directory are commands, libraries, and documentation. A limited number of subdirectories can appear in /usr .

/var

Holds files that are primarily temporary. Files such as log files, which are frequently deleted and modified, are stored here. Think of this as a directory of "variable" size. Files that an application or command create at runtime should be placed in this directory, including logfile and spool files. However, some applications may store state information in /var .



HP-UX 11i Systems Administration Handbook and Toolkit
HP-UX 11i Systems Administration Handbook and Toolkit (2nd Edition)
ISBN: 0131018833
EAN: 2147483647
Year: 2003
Pages: 301

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net