Inode: is it both unique and 'permanent'?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Inode: is it both unique and 'permanent'?
# 1  
Old 04-11-2011
Inode: is it both unique and 'permanent'?

I try to understand the meaning of an inode. I wonder whether
  • an inode is unique (I'm pretty sure it is) and
  • whether it remains the same inode regardless of whatever happens to the file, dir or whatever?
I read somewhere that an inode stores info about the file, size... so changing the size might change the inode?

Btw, is there a difference in both features in different platforms? I'm on a mac, but would a linux system be much different?
# 2  
Old 04-11-2011
Inodes are unique in the borders of a single filesystem. Inode number is a pointer to the structure that is containing all the information that you mentioned. The number itself does not contain them. So changing file's info in the inode structure doesn't need to change the inode number (and it is not happening).
# 3  
Old 04-11-2011
There is a list of the fields held in an inode in "man inode".

Running a basic editor such as "vi" to change the contents of a file will change the inode number of that file. Try it.
Code:
ls -lisad filename
vi filename
ls -lisad filename

The point was made above but it is very important to understand that inode numbers are only unique within a filesystem. If you are searching for inodes using "find /filesystem -inum" always use the "-xdev" switch to confine your search to that filesystem.
# 4  
Old 04-11-2011
Not always that is the case Smilie
Code:
[root@linux tt]# touch test
ls -li test
2818830 -rw-rw-r-- 1 root root 0 mar 21 12:19 test
[root@linux tt]# echo "aaaaa" >> test
[root@linux tt]# ls -li test
2818830 -rw-rw-r-- 1 root root 6 mar 21 12:20 test
[root@linux tt]# echo "bbbbb" >> test
[root@linux tt]# ls -li test
2818830 -rw-rw-r-- 1 root root 12 mar 21 12:20 test

So changing file contents does not necessarily mean changing the inode number.
# 5  
Old 04-11-2011
@bartus11
Very good example. Overwriting the contents of a file does not change the inode number.
Simple file editors such as "vi" do change the inode number because of the need to preserve the original file up to the last minute in case you abandon the edit.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Print unique lines without sort or unique

I would like to print unique lines without sort or unique. Unfortunately the server I am working on does not have sort or unique. I have not been able to contact the administrator of the server to ask him to add it for several weeks. (7 Replies)
Discussion started by: cokedude
7 Replies

2. Shell Programming and Scripting

Change unique file names into new unique filenames

I have 84 files with the following names splitseqs.1, spliseqs.2 etc. and I want to change the .number to a unique filename. E.g. change splitseqs.1 into splitseqs.7114_1#24 and change spliseqs.2 into splitseqs.7067_2#4 So all the current file names are unique, so are the new file names.... (1 Reply)
Discussion started by: avonm
1 Replies

3. UNIX for Advanced & Expert Users

rm non-permanent delete

I read this article as a way to do a non-permanent of something. I saw 2 problems. The first that my rm is located at /bin/rm. I would assume I would change the location to /bin/rm. The second my rm is a executable file and not a text file. So will replacing my rm file with the shellscript... (3 Replies)
Discussion started by: cokedude
3 Replies

4. HP-UX

set permanent ulimit

Hi all I have a request from user to change the file descriptors limit to 8192. The current setting are: root@xxxxx:(wmdev)> ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) 1048576 stack(kbytes) 131072 memory(kbytes) unlimited... (3 Replies)
Discussion started by: hedkandi
3 Replies

5. Shell Programming and Scripting

get part of file with unique & non-unique string

I have an archive file that holds a batch of statements. I would like to be able to extract a certain statement based on the unique customer # (ie. 123456). The end for each statement is noted by "ENDSTM". I can find the line number for the beginning of the statement section with sed. ... (5 Replies)
Discussion started by: andrewsc
5 Replies

6. Solaris

Permanent changes to PATH

Hi guys, I'm running Solars 8 on a V100 server at home for testing. If I switch user to root and do: # echo $PATH This is the output: /usr/sbin:/usr/bin I'm using rsync over ssh and need to add /usr/local/bin and /user/local/sbin. I do this by running the line: #... (3 Replies)
Discussion started by: Stin
3 Replies

7. UNIX for Dummies Questions & Answers

Permanent Alias

On AIX 5.2 as root, installed Seamonkey and have to type #/seakey/seamonkey/seamonkey to get it to run, which it does okay. To set up a permanent alias, I did the following (1) In a text editor alias seamk='/seakey/seamonkey/seamonkey' and saved it to /home/alias_file (2) In a text editor... (7 Replies)
Discussion started by: farl
7 Replies

8. Solaris

permanent route

How do I make a route permanent, other than default route on a Solaris server? (1 Reply)
Discussion started by: jontom
1 Replies

9. UNIX for Dummies Questions & Answers

Directory Inode Number Not Unique

Hi, I know that inode for each file is unique, but is it the for the directory? So far I found different directories has the same inode nubmer when you do ls -i, could some one explain why? Thanks a lot. (9 Replies)
Discussion started by: nj302
9 Replies

10. IP Networking

Permanent ip routing

I am trying to add a permanent route on my server, but whenever i reboot it dissapears. Please does anyone know the correct command to use. route add XXX.XXX.XXX.XXX DDD.DDD.DDD.DDD the above is what i have done. ednut:) using IRIX SGI software. (2 Replies)
Discussion started by: Ednut
2 Replies
Login or Register to Ask a Question