0% found this document useful (0 votes)
15 views

Original 1436864322 File System v1.1

The document discusses the Unix file system. It describes the different types of files in Unix including ordinary files, directories, and special files. It explains the Unix directory structure with directories like /bin, /dev, /etc, and others. It also covers the organization of the Unix file system including boot block, super block, inodes, and data blocks.

Uploaded by

Shanmuga Nathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Original 1436864322 File System v1.1

The document discusses the Unix file system. It describes the different types of files in Unix including ordinary files, directories, and special files. It explains the Unix directory structure with directories like /bin, /dev, /etc, and others. It also covers the organization of the Unix file system including boot block, super block, inodes, and data blocks.

Uploaded by

Shanmuga Nathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Unix File System

July 2015
Confidentiality Statement

This document contains confidential information of Tata Consultancy Services Limited,


which is provided for the sole purpose of permitting the recipient to evaluate the proposal
submitted herewith. In consideration of receipt of this document, the recipient agrees to
maintain such information in confidence and to not reproduce or otherwise disclose this
information to any person outside the group directly responsible for evaluation of its
contents, except that there is no obligation to maintain the confidentiality of any information
which was known to the recipient prior to receipt of such information from Tata Consultancy
Services Limited, or becomes publicly known through no fault of recipient, or is received
without obligation of confidentiality from a third party owing no obligation of
confidentiality to Tata Consultancy Services Limited.

Tata Code of Conduct

We, in our dealings, are self-regulated by a Code of Conduct as enshrined in the Tata Code
of Conduct. We request your support in helping us adhere to the Code in letter and spirit. We
request that any violation or potential violation of the Code by any person be promptly
brought to the notice of the Local Ethics Counselor or the Principal Ethics Counselor or the
CEO of TCS. All communication received in this regard will be treated and kept as
confidential.
Table of Content

1. UNIX FILE SYSTEM ..................................................................................................................................................... 4


1.1 Objective .......................................................................................................................................................... 4
1.2 Unix File System............................................................................................................................................. 4
1.3 Types Of Files ................................................................................................................................................. 4
1.4 Unix Directory Structure ................................................................................................................................ 5
1.5 Unix File System Organization ..................................................................................................................... 6
1.6 Video Links: Unix File System ............................................................................................................................ 9
1. UNIX FILE SYSTEM

1.1 Objective

 Be familiar with Unix File System

1.2 Unix File System

Everything in Unix is considered to be a file, including physical devices such as


DVD-ROMs, USB devices, floppy drives, and so forth.

A file is nothing but a structure that stores data on any system. All files are stored
on the hard disk of the system. A file can contain any type of data such as an
mage, documents, programs etc. Each file is identified by a filename which can
be up to 255 characters long.

A file system is a logical collection of files on a partition or disk. A partition is a


Container for information and can span an entire hard drive if desired.

The UNIX file system is organised as a hierarchy of directories starting from a


single directory called root which is represented by a / (slash).

1.3 Types Of Files


The UNIX file system contains 3 types of file.
 Ordinary Files
Used to store some text or image written or drawn by the user. d.
o
This is the type of file users usually work with.
o They are always located within/under a directory file
o They do not contain other files
 Directories
A file that holds other files and other directories.
o
User can create directories in their home directory to hold files and
o
other sub-directories.
 Special Files

TCS Internal
o This type of file is used to represent a real physical device such as
a printer, tape drive or terminal.
o Unix considers any device attached to the system to be a file - in-
cluding your terminal.
o Two types of I/O devices - character and block
o Found only under directories named /dev

Apart from these three categories, unix considers a fourth category of file
, the pipe

 Pipes
o UNIX allows users to link commands together using a pipe. The
pipe acts a temporary file which only exists to hold data from one
command until it is read by another

1.4 Unix Directory Structure

The UNIX file system is arranged in a hierarchical structure, like an inverted


tree. The top-level directory of the hierarchy is called root denoted by /.

The location of a file in the file system is called its path. Paths can be either
Absolute or relative.

Absolute Path:

An absolute path is defined by specifying the location of a file or directory from


the root directory(/). In other words we can say absolute path is a complete path
from start of actual file system , the root (/ ) directory.

Relative Path:
Relative path is defined as path related to the present working directory (pwd).

TCS Internal
/bin – Holds many of the basic Linux programs/commands; bin stands for
binaries, files that are executable.
/dev – Holds device files. All info sent to /dev/null is thrown into trash. Your
terminal is one of the /dev/tty files.
/etc – It and its subdirectories hold many of Linux config files.

/home – Holds normal user’s home directories.


/lib - Contains different Libraries
/tmp - Contains temporary files
/usr – Holds many user-oriented directories:
bin – Holds user-oriented Linux programs.
sbin – Holds system administration files.
spool – Sub directories inclues,
. mail holds mail files
. spool holds files to be printed
docs – various documents including useful Linux info
man – man pages accessed by typing the man <command>
/sbin – Holds system files that are usually run automatically.

1.5 Unix File System Organization


Unix divided physical disks into logical disks called partitions. Each

TCS Internal
partition is a standalone file system. A disk partitions is a contiguous
area of a hard disk that has been divided into several logical disks.
Every File system is organized into a sequence of blocks (e.g. 1024 bytes
each) with the following components:

 Boot block: The boot block contains the initial bootstrap program
used to load the operating system(kernal) . Located in the first few
sectors of a file system.

 Super block: This block contains global file system information and
is considered as the balance sheet of a UNIX file system. Sometimes
multiple copies are maintained.
The Superblock contains:
• File system size
• Length of the file system’s logical block.
• Number of free data blocks and a partial list of blocks
immediately available.
• Number of free inodes and a partial list of immediately useable
inodes.

 inode blocks : A large region on the disk used to maintain


information for every file in the system as inode. For each file there
is an inode or index node. An inode is a data structure used to
represent a file object, which can a file or a directory. Each inode
stores the attributes of the file and the disk block locations of the
file’s data. Attributes may include manipulation metadata (e.g.
change, access, modify time), as well as owner and permission. An
inode is identified by a unique number called the “inode number. User
identify files by file names, but unix identify files by the inode
number.

An inode of a file contains the following information:

1. file ownership indication

TCS Internal
2. file type (e.g., regular, directory, special device, pipes, etc.)

3. file access permissions. May have setuid (sticky) bit set.

4. time of last access, and modification

5. number of hard links (aliases) to the file

6. pointers to the data blocks for the file

7. size of the file in bytes (for regular files), major and minor
device numbers for special devices.

Information the inode does not contain:

o path (short or full) name of file

o inode number is not stored in the inode. It is stored in the


directory that contains the file

 Data blocks: contains the actual contents of files .

A pictorial representation of the blocks


-------------------------------------------------------------------
| | | | | | | | | | | | | | |
| Boot Block | Super Block | Inodes | | ... | Data Blocks |
| | |
| | | | | | | | | | | | | | |
--------------------------------------------------------------------

A disk viewed as a linear list of blocks:

TCS Internal
1.6 Video Links: Unix File System
https://www.youtube.com/watch?v=fpxcL7tm2qM
https://www.youtube.com/watch?v=ymYZPtrvgec
https://www.youtube.com/watch?v=hZpom8ouYD8

TCS Internal

You might also like