Cheatsheet: Difference between revisions

Content added Content deleted
Line 613: Line 613:


== Inode Number ==
== Inode Number ==

* Inode is entry in inode table containing metadata about a regular file and directory.
* An inode is a data structure on a traditional Unix-style file system such as ext3 or ext4.
* Copy file: cp allocates a free inode number and placing a new entry in inode table.
* Move or Rename a file: if destination is same filesystem as the source, Has no impact on inode number, it only changes the time stamps in inode table.
* Delete a file: Deleting a file in Linux decrements the link count and freeing the inode number to be reused.

*Inode number (or index number) consists following attributes:

File types ( executable, block special etc )
Permissions ( read, write etc )
UID ( Owner )
GID ( Group )
FileSize
Time stamps including last access, last modification and last inode number change.
File deletion time
Number of links ( soft/hard )
Location of ile on harddisk.
Some other metadata about file.

*Check info:
df -i /dev/vda1 ==> Inodes on Filesystem
ls -il myfile.txt ==> Show inode no of file
find /home/rahul -inum 1150561 ==> Find file using inode no

* Free Inodes on Filesystem
In the case of inodes are full, You need to remove unused files from the filesystem to make Inode free.
There is no option to increase/decrease inodes on disk.
Its only created during the creation of filesystem on any disk.


== Sort links vs Hard link ==
== Sort links vs Hard link ==