Results 1 to 8 of 8
Hi All,
As per the theory concepts for each file only once Inode is allocated. Inode will be released only when you delete the file.
But i have problem with ...
- 08-13-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 49
Inode Problem???
Hi All,
As per the theory concepts for each file only once Inode is allocated. Inode will be released only when you delete the file.
But i have problem with vi editor here...
Create a file, write some content and save it and close. check the Inode number of the file by
ls -l temp.txt or stat temp.txt
Then open the file again and write some more content and save it and close.
Now if you check the Inode number of the file, it will not be same as old one.
Why this is happening like this??? from theory point of view, just by changing the content of file Inode number will not change???
Is it a Bug???
- 08-13-2008 #2Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
I think the explanation is this: In order to guarantee the atomicity of the file modification, the data is not modified in place. A new file is created instead.
- 08-13-2008 #3Just Joined!
- Join Date
- Aug 2008
- Posts
- 49
You mean to say, every time vi will create a new file???
Then why its not happening with softlinks???
Suppose i have a file file1.txt and create a softlink file2.txt by
ln -s file1.txt file2.txt
If change anyting in file1.txt then file2.txt Inode also has to change right, according to you??? but its not changing the file2.txt Inode???but content of file2.txt you will get same as file1.txt.
Why is like this???
- 08-13-2008 #4Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
A hard link is a name for an inode. A symbolic link is just another name for a filename. The filename does not change, so why should the symbolic link change?
- 08-13-2008 #5Just Joined!
- Join Date
- Aug 2008
- Posts
- 49
Hi...
See for Symbolic link separate Inode will be given, for hard link only link count will increase in the same Inode.
So if file1.txt data blocks are modified means it should affect file1.txt Inode as well as file2.txt also. because symbolic links will refer the same data blocks. both the file will refer same data block, but only different Inode is given for symbolic links.
Now You tell me???
- 08-13-2008 #6Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
I don't understand your question.
- 08-14-2008 #7Just Joined!
- Join Date
- Aug 2008
- Posts
- 49
Ok... i will tell you first what i understood about hard link and symbolic link.
Hardlink: Its a another entry in directory, for the same Inode. Only Inode count will increase w.r.t Inode
softlink: If you create a softlink new Inode will be assigned to a softlink and both the Inode will share same data blocks.
Now, as you already said that every time vi editor will create a new file, if you modifies the content of the file for automicity. file.
Here if you change the content of fitst file then Inode of the file will change right? then the other softlink also referring same data block, so the softlink Inode also has to change???
But this is not happning??? why???
- 08-14-2008 #8Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
Maybe I did not explain that clearly enough. A symbolic link is a new name for a filename, not for the file itself. The symbolic link points to the filename, not to the file. You can clearly see this in the output of "ls -l". Try this:
Code:$ ln -s no_such_file new_link $ ls -l new_link


Reply With Quote