Files&File Systems
Files&File Systems
Fle
System 1 SWAP
AREA
Fle Fle
Systern2 System3
DISK
System form
File to
together
of a
grouped can
D e f i n i t i o n
disk
files on
2.1.2 of partition
c o l l e c t i o n
one
is a
Each
logical
one
and only
System have
A file
s t r u c t u r e .
must
it
it has,
h i e r a r c h i c a l
a
system.
(If
file
have a
to
file system). makes it easy
several
file systems
into
a
disk
Partitioning
there.
stored
data
manage
Layout
2.1.3 File System blocks, of
size
of logical
of a s e q u e n c e
consists
o n the
system (For
A file system of it depending
o r multiples
512 bytes blocks).
V u s e s 1024 byte
Example, System
structure:
the following
A file system has
1) Boot block
2) Super block
3) inode list
4) Data blocks
inode data
boot super
block block block block
1) Boot block
3) Inode List
4) Data Blocks
a) Text data
b) Source programs in a high-level language
as result of compilation
c) Object and executable code, such
d) Information about other files.
2.2.1 Filenames
like +, ,
symbols
arithmetic
and
like,
! a l l o w e d .
characters
not
are case-
Use of
discouraged.
Spaces
adopts
a
system instance,
LINUX
are For
that
the filenames. named
a file
noted with
to be dealing from
It has in distinct
approach
treated
as
s e n s i t i v e
B I G - O N E
is
name
the
big-one. are:
filenames
of valid
Examples
Some
EMPdate.c
123 file
adcfilehandler
BIG SUN
lil un
(lnode)
Index Node they physically exist
exist
The
2.2 entities,
ii.e.
e. they
physically
exist
on
media like
floppy
storage
secondary
cartridge tapes etc.
information
n
collection of
a file is a
secondary
storage
previously, But
started
As
sequence
of bytes. (read/write)
take
i.e. it is a
data
transfers
bytes devices, i.e. rather than
media are block (collection of bytes),
to blocks written on
to a
with respect data is
place other words
individual bytes. In also read
likewise.
in and data is
a form
of blocks,
disk in
Note:
inode,
of file
a is given by an
of
consists of 512 bytes of data or multiples
Oné data biock
number of
Hence each file efectively consists of a
512 bytes. hence
stored randomly on disk, and
data blocks. These are
locations have to be made
known (fig 23)
their
How it's actually stored on disk
To a user
Block2
All the above information exists for each file present in the
Linux system. Hence for each file, all the relevant
information pertaining to it is stored in an entity called index
node or anode. It has to be stressed that each file must have
one and only one anode.
.Date
and time oflast
to the file
oflast
access
.Date
and time of
blocks
data
addresses for the
disk
A list of physical
the file
:200
userid
:100
gid e***
permission 2:01 PM
:Jan 30 1994
accessed
1:17 PM
modified
:Jan 30 1994
Inode modification
PM
:Jan 30 1:55
date
:2
links
file size
:4090bytes
disk block address ° * * ° °
3 TYPES OF FILES
a) Regular files
b) Directory files
c) Special files
Example
A character Device:
The Terminal:
Unix File name: /dev/tty05
A Block Device:
Disks:
Unix File name: /dev/
tmp
etc
home
usr
bin
shaj
john
renu - codes
raiu
bin C+
Win
bin CGI
Perl xWin
C
user
Structure
File Hierarchy
Figure 2.5 A sample
Root Directory
at the top of the file
Root directory is the apex directory
a "/" (forward slash)
hierarchy structure. It is represented by
symbol.
Home Directory
Example:
Initially, the
the user 'pravin' is in his home directory
/home/pravin. But he can change his working directory-to-
bin under his home directory. His working
directory
directory then becomes /home/pravin/bin
Parent Directory
which
Parent directory of a given directory is the directory,
the
is one level in the file hierarchy structure than
higher dots
current directory. It is represented by two consecutive
().
Example
Suppose the working in the directory /home/pravin.
user is
is
Then, the parent .directory is /home and current directory
/usr/pravin
Pathname
Pathname is a name that represents the full name of the path
form the root (or the current directory) through the file tree
structure, to particular file.