FILE SYSTEM
File system divided
into two categories:
§ User data - stores actual data contained in
files
§ Metadata - stores file system structural
information such as superblock, inodes, directories
Understanding UNIX / Linux file system
Superblock
Let us take an
example of 20 GB hard disk. The entire disk space subdivided into multiple file
system blocks. And blocks used for what?
Unix / Linux filesystem blocks
The blocks used for two
different purpose:
1.
Most blocks stores user data aka files (user data).
2.
Some blocks in every file system store the file system's
metadata. So what the hell is a metadata?
In simple words Metadata
describes the structure of the file system. Most common metadata structure are
superblock, inode and directories. Following paragraphs describes each of them.
Superblock
Each file system is different
and they have type like ext2, ext3 etc. Further each file system has size like
5 GB, 10 GB and status such as mount status. In short each file system has a
superblock, which contains information about file system such as:
§ File
system type
§ Size
§ Status
§ Information
about other metadata structures
Inodes
The inode (index node) is a
fundamental concept in the Linux and UNIX filesystem.
Each
and every file under Linux (and UNIX) has following attributes:
=>
File type (executable, block special etc)
=> Permissions (read, write etc)
=> Owner
=> Group
=> File Size
=> File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview)
=> File deletion time
=> Permissions (read, write etc)
=> Owner
=> Group
=> File Size
=> File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview)
=> File deletion time
All the above information stored in an inode. In short the
inode identifies the file and its attributes (as above) . Each inode is
identified by a unique inode number within the file system. Inode is also know
as index number.
How do I see file inode number?
You can
use ls -i command to see inode number of file
Sample Output
$ ls -i /etc/passwd
Sample Output
32820 /etc/passwd
You can
also use stat command to find out inode number and its attribute:
$ stat /etc/passwd
Output:File: `/etc/passwd'
Size: 1988 Blocks: 8 IO Block: 4096 regular file
Device: 341h/833d Inode: 32820 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2005-11-10 01:26:01.000000000 +0530
Modify: 2005-10-27 13:26:56.000000000 +0530
Change: 2005-10-27 13:26:56.000000000 +0530
0 comments:
Post a Comment