Labels

algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)

Inode and Linux file system

DISK TYPES

  • IDE 
  •         /dev/hda
  •         /dev/hdb
  •          ……
  • SCSI
  •       /dev/sda
  •       /dev/sdb

Linux Partition

Boot block Super Block I node table Data Block

Boot Block : has information to boot

Super Block: has all summary of the parition

  • has list of free inode numbers
  • has list of blocks
  • a copy of super block is put in ram is called super surrogagate block. this is periodically updated this is called sync, this happens during shutdown.

Inode : all properties of files are stored {except this everything else is present in INODE file number,name,data}

Inode table is list of Inodes

Inode looks like this

Type
permissions
uid/gid
timestamp
links Count--->when more than file names which refer to the inode then this is incremented.
size
Pointer to the disk Block

Data Block: is the place where actual data is stored.[Data Block Pointers]

PTR 1
PTR 2
 
 
 
 
PTR 11 – > pointer to a list of pointers
PTR 12 – > double indirection
 

 

Hard Links:

has the same i-node number with different file name

when original file is deleted the link file is still present until the hard link count is 0

ln <target name> <link name>

ln <targets> <dest dir>

hard links are not allowed for directories

Every time a directory is created it has 2 hard links the path and the [.]

and when a sub dir is created the .. becomes another link

Soft Links:

the size of the file is the path length.

when the original file is deleted this symbolic link becomes invalid.

permission of symbolic link is 777 which is of no use.

when user tries to change permission on soft link it might affect the original file.

same as hard link except that you need to give an option –s

soft links are allowed for directories

Check Inode number:

[trainee@localhost purna]$ ls -li
total 1

Inode number---------hardlink count
3702945 drwxrwxr-x 2 trainee trainee 4096 Jun 14 15:03 file1

No comments:

Post a Comment

Search 24 Bytes