Professional Documents
Culture Documents
Bachelor of Engineering
in
Computer Science & Engineering
Submitted by
Subhashini D (usn:1KG19CS098)
The abstraction layer that presents file systems to the rest of the kernel and thence
to user programs is called the Virtual File System (VFS). We shall look at the key data
structures (objects) in the VFS below.
Though the Unix virtual file system abstraction is applied to many devices, the
easiest way to understand it is to go back to its origins as a model for organizing
information on a disk. From this point of view, each partition on a disk is looked upon
as a separate disk.
TABLE OF CONTENTS
Introduction. 1
History 2
Features 3
Architecture. 4
File operation. 5
Directory Hierachy. 6.
Processes. 7
File system. 8
Security 9
Conclusion. 10
INTRODUCTION
Unix File System can be defined as a framework that organizes and
stores a huge volume of data that can be handled with ease. It
involves elements like file which is a collection of related data that
can be viewed logically, appears as a stream of bytes, with attributes
containing information in relation to the concerned file. The file
system consisting of two main components i.e files, directories. The
entire system following a hierarchy in which directories act as special
files that contain multiple files with the highest-level directory in the
entire hierarchical structure being termed as root which is
symbolically denoted by ‘/’. There can be many subdirectories under
this directory.
The Unix File system usually has below directories present in the file
system:
bin: It is a short form for binary files. This directory stores the
commonly used executable commands.
mnt: This contains information regarding the mounted devices.
root: This is the root user’s home directory.
tmp: This is a storage for temporary files. As they are temporary they
are removed periodically from the filesystem.
usr: It contains a set of executable commands
home: It has a collection of directories and files.
proc: It contains files that are related to system processes
HISTORY
Early versions of Unix filesystems were referred to simply as FS. FS
only included the boot block, superblock, a clump of inodes, and the
data blocks. This worked well for the small disks early Unixes were
designed for, but as technology advanced and disks grew larger,
moving the head back and forth between the clump of inodes and the
data blocks they referred to caused thrashing. Marshall Kirk
McKusick, then a Berkeley graduate student, optimized the BSD 4.2's
FFS (Fast File System) by inventing cylinder groups, which break the
disk up into smaller chunks, with each group having its own inodes
and data block.
intent of BSD FFS is to try to localize associated data blocks
and metadata in the same cylinder group and, ideally, all of the
contents of a directory (both data and metadata for all the files) in the
same or nearby cylinder group, thus reducing fragmentation caused
by scattering a directory's contents over a whole disk some of the
performance parameters in the superblock included number of tracks
and sectors, disk rotation speed, head speed, and alignment of the
sectors between tracks. In a fully optimized system, the head could be
moved between close tracks to read scattered sectors from alternating
tracks while waiting for the platter to spin around.
As disks grew larger and larger, sector-level optimization became
obsolete (especially with disks that used linear sector numbering and
variable sectors per track). With larger disks and larger files,
fragmented reads became more of a problem. To combat this, BSD
originally increased the filesystem block size from one sector to 1 K
in 4.0 BSD; and, in FFS, increased the filesystem block size from 1 K
to 8 K. This has several effects. The chance of a file's sectors being
contiguous is much greater. The amount of overhead to list the file's
blocks is reduced, while the number of bytes representable by any
given number of blocks is increased.
FEATURE
PATH NAMES:
Path names are used to describe the location of directories and files in
the file system hierarchy. A path name is essentially a description of
the directories that must be passed through to get to a particular
directory. There are two ways to write path names. One way is to
refer to the desired directory by giving a path name that starts at the
root. Such a path name is said to be absolute. Another way is to refer
to the desired directory by giving a path name that starts at the user's
current working directory. This kind of path name is called relative.
Device Security:
Device files /dev/null, /dev/tty & /dev/console should be world
writeable but NEVER executable. Most other device files should be
unreadable and unwriteable by regular users.
Script Security:
Never write setuid/setgid shell scripts (can break out). Instead, write a
compiled program in a language like "C". Scripts should ALWAYS
have full pathnames.
Program Security:
Always get your programs from a known source. Verify that it hasn't
been hampered with via checksum. If you are compiling your own
program, make sure you know that the compiler hasn't been tampered
with as well.
General Security Measures:
Create minimal writable filesystems (esp. system files/directories!).
Generally, users should only be able to write in their own directories,
and /tmp. In addition, there will be directories for a specific group to
write in. This way you control how each user can access specific areas
of the system.
Make sure that important files are only accessible by authorized
personnel. Use setuid/setgid only where necessary.
COPS will find many of these problems.
CONCLUSION
In this file system we covered several advanced file management
tasks. You know how to list hidden files, entire directory trees, and
directory names. You also learned how to copy and remove a
directory tree. Finally, two new commands, ln and find, were
introduced. With ln, you can create symbolic links, also called aliases
on Macintosh or shortcuts on Windows computers. You also can set
search criteria when using the find command to search the filesystem.
Some of the following terms and concepts:
Recursive listing: A recursive listing of a directory is one that
repeatedly displays all subdirectories down the hierarchy, until the
last level of the directory tree is reached.
2. link: A symbolic link is a name that points to another file or
directory. The target of the link can reside on another file system.
3: A link is another name for a file. A link is similar to a
Macintosh alias or a Windows shortcut.
4: link: A hard link is another name for a file.