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

2 (1) (1) - File System

Uploaded by

Chinu Rao
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

2 (1) (1) - File System

Uploaded by

Chinu Rao
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

File System

Unstructured way of dumping files increase search and acces time.


An efficient file sytem
 Reduce search and access time
 Save disk space
Files and file systems are at the very heart of what system administration is about. Almost
every task in host administration or network configuration involves making changes to files.
We need to acquire a basic understanding of the principles of file systems, so what better way
than to examine some of the most important files systems in use today

Unix File System(UFS)

UNIX has a hierarchical file system, which makes use of directories and subdirectories to
form a tree. The top or start of the UNIX file tree is called the root file system or ‘/’.

The arrangement of disk blocks in Unix is as shown in the figure below. 

Figure 1. Disk arrangement

BB: Boot block contains the code to bootstrap the OS. Bootstrap refers to a simple program
which start initialization of computer OS. It initialize and test all the devices and peripherals
connected to the system.

SB: Super block contains information about the entire disk. The super block contains the
following information, to keep track of the entire file system.

Size of the file system: Size of the file system represents the actual no of blocks (used +
unused) present in the file system.

Number of free blocks on the system, A list of free blocks, Index to next free block on the
list: The super block contains an array of free disk block numbers, one of which points to
the next entry in the list. That entry in turn will be a data block, which contains an array of
some other free blocks and a next pointer. When process requests for a block, it searches the
free block list returns the available disk block from the array of free blocks in the super block.
If the super block contains only one entry which is a pointer to a data block, which contains a
list of other free blocks, all the entries from that block will be copied to the super block free
list and returns that block to the process.

Freeing of a block is reverse process of allocation. If the list of free blocks in super block has
enough space for the entry then, this block address will be marked in the list. If the list is full,
all the entries from the super block will be copied to the freed block and mark an entry for
this block in the super block. Now the list in super block contains only this entry.
Index indexes to the next free disk block in the free disk block list.

Size of the inode list, Number of free the inodes, A list of free inodes, Index to next free
inode on the list: The super block also contains an array to represent free inodes.

IL: The I-node list a list of inodes, and it contain basic information about files.

All file systems on Unix-like operating systems are based on a system of index nodes, or
inodes, in which every file has an index entry stored in a special part of the file system. The
inodes contain an extensible system of pointers to the actual disk blocks which are associated
with the file. The inode contains essential information needed to locate a file on the disk.

Owner: Owner indicates who owns the file(s) corresponding to this inode.

Type: Type indicates whether inode represents a file, a directory, a FIFO, a character device
or a block device. If the type value is 0 then the inode is free.

Last modified time: Times represent when, the file has been modified.

Last accessed time: Time when it was last accessed, or

Last inode modified time: When the inode has been modified last. Whenever the contents of
the file is changed, the "inode modified time" also changes. Moreover it changes when there
are changes for the inode like permission change, creating a link etc.

Access Permissions: Each file will be having nine access permissions for read, write and
execute, for the owner, group and others in rwx rwx rwx format.

No of links to the file: In Unix we can create links to some files or directories. So we need to
have a count of how many links are pointing to the same inode, so that if we delete one of the
links the actual data is not gone.

Size of the file: Size of the file represents the actual size of the file.
Inode doesn’t contain filename, only metadata. If no.of inodes are fixed at file system
creation, it will fix maximum number of files system can hold.

DB: Data blocks contain the actual data in the form of directories and files. In Unix, we have
a kind of indexing to access the actual data blocks that contains data. Each data block is of
size 512 bytes.We have an array of which (in each inode) first ten elements indicate direct
indexing. The next entry is single indirect, then comes double indirect and then triple indirect.
By direct indexing we mean that, the value in the array represents the actual data block. If the
file needs more than 10 blocks, it uses single indirect indexing, means this is an index to the a
block which contains an array of disk block numbers which in turn represent the actual disk
block. If all these are exhausted, then double indirect indexing is used and then triple indirect.
For further clarifications, refer figure.

DataBlock representation

In Unix, a directory is a special file. A directory file contains names of the subdirectories and
files present in that directory and its corresponding inode number.

NTFS (New Technology File System)

NTFS is used for storing and retrieving files on hard disk. An advanced file system that
provides performance, security, reliability, and advanced features. It is designed to quickly
perform standard file operations such as

read,

write, and

search - and

even advanced operations such as file-system recovery - on very large hard disks.

NTFS provide a combination of performance and reliability.


Formatting a volume with the NTFS file system results in the creation of several system files
and the Master File Table (MFT), this contains information about all the files and folders on
the NTFS volume. The first file on an NTFS volume is the Master File Table (MFT). The
following figure illustrates the layout of an NTFS volume when formatting has finished.

NTFS Volume

Partition Boot Sector: The first information on an NTFS volume is the Partition Boot
Sector, which starts at sector 0 and can be up to 16 sectors long contain code for
bootstrapping of system.

Each file system contain lot of files. First and most important file in NTFS is

Master File Table : It is common table for files in NTFS. Each file in NTFS is represented
by a record in MFT. 12% of disk space is assigned to MFT.

MFT contains all file data:

(a) File name

(b) Creation date

(c) Access Permission(read only etc.)

(d) Location(where data reside)

(e) Size and

(f) Contents

MFT record certain space for each file record. Attributes of the files are written to the
allocated space in MFT. Small files can entirely be contained within MFT Record.

MFT is divided in records of equal size usually 1 KB, each record correspond to some file.

NTFS reserve first 16 records of table for special information, they are inaccessible to
operation system and named as metafiles or system files.

System Files:

System MFT File


File Record Name Purpose

Master
File 0 $MFT Describes MFT itself, it contain record of every file.
Table
Master
$MFT Duplicate of the first vital entries of $MFT, used for recoverability
File 1
Mirr if 1st record is corrupted.
Table 2
Log File Contain list of transaction steps used for recoverability. All
$LogFi
2 transactions steps are here, if committed then written to the
le
memory
Volume $Volu
3 Contain information about volume name and version.
me
Attribute
$AttrD
Definati 4 A table of MFT containing all about attributes.
ef
on
Root
"."
Director
(single 5 This is a pointer to the root directory or folder of the volume.
y/
period)
Folder
Cluster
Allocati $Bitma Contains a "map" showing which clusters on the volume are used
6
on p and which are available for use.
Bitmap
Volume This record contains a copy of the volume boot code (or a pointer
Boot $Boot 7 to it). The volume boot code is also found in the volume boot
Code sector.

File Area:
Hard disk is divided into partitions. Within partition files are stored. Each file is stored in 1 or
more clusters but atleast one cluster.
Cluster size may vary from 512 byte to 64 KB. Standard size is 4 KB.
Cluster is indivisible so cluster size is trade off between:
Efficient use of disk space
No. Of disk access required to access the files.

Standard cluster size = 4 KB


Sector Size = 512 byte

Tracks are concentric circle around disk.


Sectors are segments of a track.
Cluster are set of sectors.

Network File System


Network File System (NFS) is a network file system protocol originally developed by Sun
Microsystems in 1984, allowing a user on a client computer to access files over a network in
a manner similar to how local storage is accessed.

NFS allows a system to share directories and files with others over a network. By using NFS,
users and programs can access files on remote systems almost as if they were local files.
The Network File System (NFS) is a client/server application that lets a computer user view
and optionally store and update file on a remote computer as though they were on the user's
own computer. The user's system needs to have an NFS client and the other computer needs
the NFS server. Both of them require that you also have TCP/IP installed since the NFS
server and client use TCP/IP as the program that sends the files and updates back and forth.
(However, the User Datagram Protocol, UDP, which comes with TCP/IP, is used instead of
TCP with earlier versions of NFS.)

This allows the system administrator to store resources in a central location on the network
and a complete and continuous access to it. There is no password to enter, users work as if
directory is on their local machines.

e.g. Users working on same project can have access to the files for that project.

Some of the most notable benefits that NFS can provide are:

 Local workstations use less disk space because commonly used data can be stored on
a single machine and still remain accessible to others over the network.

 There is no need for users to have separate home directories on every network
machine. Home directories could be set up on the NFS server and made available
throughout the network.

 Storage devices such as floppy disks, CDROM drives, and Zip® drives can be used
by other machines on the network. This may reduce the number of removable media
drives throughout the network.

How NFS Works

 NFS consists of at least two main parts: a server and one or more clients. The client
remotely accesses the data that is stored on the server machine. In order for this to
function properly a few processes have to be configured and running.

Practical Uses

NFS has many practical uses. Some of the more common ones are listed below:

 Set several machines to share a CDROM or other media among them. This is cheaper
and often a more convenient method to install software on multiple machines.
 On large networks, it might be more convenient to configure a central NFS server in
which to store all the user home directories. These home directories can then be
exported to the network so that users would always have the same home directory,
regardless of which workstation they log in to.

Stateless Server

NFS store state information at client site, allowing servers to remain stateless.
Because server is stateless, disruption in service will not affect the client operation.
Client countinue their file access after stateless server crash and reboots, application
which run on client can remain unaware of server reboot.

Stateless server doesn’t store any information about client i.e. nothing like their
identity, passwords, previously accessed document etc.

Advantage of stateless over stateful server:

Because stateless server need not to allocate resources for the client, stateless design
can scale to handle more clients than stateful design.

Also keep server unaware of client crashses.

Limitation:

1.) Lot of Network Traffic


2.) Server Bottleneck
3.) Not very reliable because try to make remote file system as local file system

You might also like