Filesystem Management Subsystem

In discussing "Kernel Basics and Configuration" a very important topic, filesystems, must be considered. This discussion shall deal with the basic structural method of long-term storage of system and user data. Filesystems and the parameters that are used to create them have a direct impact on performance, system resource utilization, and kernel efficiency dealing with Input/Output (I/O).

Filesystem Types

There are several important filesystem types that are supported by different operating systems (OS), many of which are not used for implementation at this time. The reasons they are not used vary from being inefficient to just being outdated. However, many operating systems still support their filesystem structure so that compatibility doesn't become an issue for portability.
This support of other filesystem structures plays a large role in allowing companies to move between OS and computer types with little impact to their applications.
The following is a list of filesystem types that are supported by specific operating systems. The list will only cover local, network, and CD-ROM filesystems.

Local Filesystem NFS* CD-ROM
Solaris ufs yes bsfs
SunOS 4.2 yes bsfs
SCO EAFS yes HS
IRIX efs yes iso9660
Digital ufs yes cdfs
HP-UX bfs yes cdfs
AIX jfs yes cdrfs
Linux ext2 yes iso9660

Note: NFS stands for Networked FileSystem

Hardware Architecture

Since filesystems are stored on disk, the systems administrator should look at basic disk hardware architecture before proceeding with specifics of filesystems. A disk is physically divided into tracks, sectors, and blocks. A good representation of a sector would be a piece of pie removed form the pie pan. Therefore, as with a pie, a disk is composed of several sectors (see Figure 19.3). Tracks are concentric rings going from the outside perimeter to the center of the disk, with each track becoming smaller as it approaches the center of the disk. Tracks on a disk are concentric, therefore they never touch each other. The area of the track that lies between the edges of the sector is termed a block, and the block is the area where data is stored. Disk devices typically use a block mode accessing scheme when transferring data between the file management subsystem and the I/O subsystem. The block size is usually 512- or 1024-byte fixed-length blocks, depending upon the scheme used by the operating system. A programmer may access files using either block or character device files.
Figure 19.3.
Diagram of a single platter from a hard drive showing disk geometry.
You now have a basic understanding of the terms tracks, sectors, and blocks as they apply to a single platter disk drive. But most disk today are composed of several platters with each platter having its own read/write head. With this in mind, we have a new term: cylinder (see Figure 19.4). Let's make the assumption that we have a disk drive that has six platters so, logically, it must have six read/write heads. When read/write head 1 is on track 10 of platter 1, then heads 2 through 6 are on track 10 of their respective platters. You now have a cylinder. A cylinder is collectively the same track on each platter of a multi-platter disk.
Figure 19.4.
Diagram showing multiple platters of a single disk drive.

Filesystem Concepts and Format

The term filesystem has two connotations. The first is the complete hierarchical filesystem tree. The second is the collection place on disk device(s) for files. Visualize the filesystem as consisting of a single node at the highest level (ROOT) and all other nodes descending from the root node in a tree-like fashion (see Figure 19.5) . The second meaning will be used for this discussion, and Hewlett Packard's High-performance Filesystem will be used for technical reference purposes.
Figure 19.5.
Diagram of a UNIX hierarchical filesystem.
The superblock is the key to maintaining the filesystem. It's an 8 KB block of disk space that maintains the current status of the filesystem. Because of its importance, a copy is maintained in memory and at each cylinder group within the filesystem. The copy in main memory is updated as events transpire. The update daemon is the actual process that calls on the kernel to flush the cached superblocks, modified inodes, and cached data blocks to disk. The superblock maintains the following static and dynamic information about the filesystem. An asterisk will denote dynamically maintained information.
Filesystem size
Number of Inodes
Location of free space
Number of cylinder groups
Fragment size and number
Block size and number
Location of superblocks, cylinder groups, inodes, and data blocks
Total number of free data blocks
Total number of free inodes
Filesystem status flag (clean flag)
As you can see from the listed information, the superblock maintains the integrity of the filesystem and all associated pertinent information. To prevent catastrophic events, the OS stores copies of the superblock in cylinder groups. The locations of these alternate superblocks may be found in /etc/sbtab. When system administrators are using fsck -b to recover from an alternate superblock, they will be required to give the location of that alternate block. Again, the only place to find that information is in /etc/sbtab. As a qualification to that statement, there is always an alternate superblock at block sixteen.
Cylinder groups are adjacent groups of cylinders, 16 cylinders by default, that have their own set of inodes and free space mapping. This is done to improve performance and reduce disk latency. Disk latency is the time between when the disk is read and the I/O subsystem can transfer the data. Some factors that affect disk latency are rotational speed, seek time, and the interleave factor. This concept also associates the inodes and data blocks in closer proximity.

NOTE: The interleave factor is the value that determines the order in which sectors on a disk drive are accessed.
The layout of the cylinder group is:
Boot block
Primary superblock
Redundant superblock
Cylinder group information
Inode table
Data blocks
The boot block and the primary superblock will only be there if this is the first cylinder group; otherwise, it may be filled with data.
Inodes are fixed-length entries that vary in their length according to the OS implemented. SVR4 implementation is 128 bytes for a UFS inode and 64 bytes for an S5 inode. The inode maintains all of the pertinent information about the file except for the filename and the data. The information maintained by the inode is as follows:
File permissions or mode
Type of file
Number of hard links
Current owner
Group associated to the file
Actual file size in bytes
Time Stamps
Time/Date file last changed
Time/Date file last accessed
Time/Date last inode modification
Single indirect block pointer
Double indirect block pointer
Triple indirect block pointer
There are 15 slots in the inode structure for disk address or pointers(see Figure 19.6). Twelve of the slots are for direct block addressing. A direct address can either point to a complete block or to a fragment of that block. The block and fragment sizes we are discussing are configurable parameters that are set at filesystem creation. They cannot be altered unless the filesystem is removed and re-created with the new parameters.
Figure 19.6.
Diagram of an Inode Structure of a UNIX filesystem

Listing of a typical AIX Root directory using ls -ali, to indicate the inode numbers for each file entry in the directory.

inode Permissions ln Owner Group Size Access Date Filename
2 drwxr-xr-x 23 bin bin 1024 Apr 27 15:53 . (dot)
2 drwxr-xr-x 23 bin bin 1024 Apr 27 15:53 .. (dot, dot)
765 -rw-r--r-- 1 root system 259 Apr 08 08:34 Guidefaults
1257 -rw------- 1 root system 156 Apr 27 11:01 .Xauthority
2061 drwxr-xr-x 11 root system 512 Apr 27 11:01 .dt
591 -rwxr-xr-x 1 root system 3970 Apr 08 08:38 .dtprofile
6151 drwx------ 3 root system 512 Apr 17 13:42 .netscape
593 -rw------- 1 root system 1904 Apr 11 08:12 .old_sh_history
1011 -rwxr----- 1 7 system 254 Apr 10 11:15 .profile
1007 -rw------- 1 root system 3444 Apr 27 15:53 .sh_history
1009 -rw-r--r-- 1 root system 30 Apr 14 10:35 .showcase
2069 drwxr-xr-x 2 root system 512 Apr 08 08:54 TT_DB
2058 drwxr-xr-x 3 root system 512 Apr 11 11:21 admin
109 lrwxrwxrwx 1 bin bin 8 Apr 01 05:27 bin ->/usr/bin
23 drwxrwxr-x 4 root system 2048 Apr 27 14:37 dev
24 drwxr-xr-x 12 root system 6144 Apr 27 11:29 etc
2 drwxr-xr-x 5 bin bin 512 Apr 02 01:52 home
8195 drwxr-xr-x 2 root system 512 Apr 25 13:08 httpd
586 lrwxrwxrwx 1 bin bin 20 Apr 02 01:57 launch_demo ->
22 lrwxrwxrwx 1 bin bin 8 Apr 01 05:27 lib ->/usr/lib
16 drwx------ 2 root system 512 Apr 01 05:27 lost+found
100 drwxr-xr-x 26 bin bin 1024 Apr 11 15:23 lpp
101 drwxr-xr-x 2 bin bin 512 Apr 01 05:27 mnt
4096 drwxr-xr-x 2 root system 512 Apr 11 14:57 mnt10032
4097 drwxr-xr-x 2 root system 512 Apr 14 10:31 mnt10086
1251 -rw-rw-rw- 1 root system 3192 Apr 15 14:12 nv6000.log
102 drwxr-xr-x 2 root system 512 Apr 02 01:54 opt
103 drwxr-xr-x 3 bin bin 512 Apr 11 15:23 sbin
1252 -rw-r--r-- 1 root system 39265 Apr 27 13:29 smit.log
1253 -rw-r--r-- 1 root system 5578 Apr 27 13:24 smit.script
271 drwxrwxr-x 2 root system 512 Apr 01 05:37 tftpboot
2 drwxrwxrwt 9 bin bin 1536 Apr 27 15:47 tmp
99 lrwxrwxrwx 1 bin bin 5 Apr 01 05:27 u ->/home
192 lrwxrwxrwx 1 root system 21 Apr 01 05:30 unix ->/usr/lib/boot/unix_up
2 drwxr-xr-x 26 bin bin 512 Apr 25 13:19 usr
2 drwxr-xr-x 14 bin bin 512 Apr 01 06:03 var
764 -rw-rw-rw- 1 root system 3074 Apr 08 08:33 vim.log
2 drwxr-xr-x 12 bin bin 2048 Apr 08 08:21 welcome
Single indirect addressing (slot 13) points to a block of four-byte pointers that point to data blocks. If the block that is pointed to by the single indirect method is 4 KB in size, it would contain 1024 four-byte pointers, and if it were 8 KB in size, it would contain 2048 four-byte pointers to data blocks. The double indirect block pointer is located in slot 14, and slot 15 maintains the triple indirect block pointer.
In the "Filesystem Concepts and Format" section, the initial discussion covered basic concepts of superblocks, alternate superblocks, cylinder groups, inodes, and direct and indirect addressing of data blocks. Further reading into these subjects is a must for all systems administrators, especially the new and inexperienced.


 
 


Yahoo! Photos
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

YAHOO! GROUPS LINKS




Reply via email to