Sponsored Content
Operating Systems Linux Inode number changes for a file in Redhat Linux Post 302920380 by gull04 on Thursday 9th of October 2014 05:25:20 AM
Old 10-09-2014
Hi,

I don't use Gedit, however if you open a file in gedit and while it is open have a look in the directory to see if there are other copies of the file as follows;
Code:
[root@ekbit13 bin]# ls -l sergen*
-rwxr-xr-x. 1 sc386dm sc386dm 12800 Nov 18  2013 sergen.scr
-rwxr-xr-x. 1 sc386dm sc386dm 13174 Nov  5  2013 sergen.scr~
[root@ekbit13 bin]# stat sergen.scr
  File: `sergen.scr'
  Size: 12800     	Blocks: 32         IO Block: 4096   regular file
Device: 811h/2065d	Inode: 2099809     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (  505/ sc386dm)   Gid: (  500/ sc386dm)
Access: 2014-10-09 10:21:48.695567634 +0100
Modify: 2014-10-09 10:21:48.701567649 +0100
Change: 2014-10-09 10:21:48.721567699 +0100
[root@ekbit13 bin]# stat sergen.scr~
  File: `sergen.scr~'
  Size: 13174     	Blocks: 32         IO Block: 4096   regular file
Device: 811h/2065d	Inode: 2098503     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (  505/ sc386dm)   Gid: (  500/ sc386dm)
Access: 2014-10-07 09:54:27.133865925 +0100
Modify: 2013-11-05 21:46:48.371733236 +0000
Change: 2013-11-05 21:46:48.371733236 +0000
[root@ekbit13 bin]# vim sergen.scr
[root@ekbit13 bin]# stat sergen.scr
  File: `sergen.scr'
  Size: 12800     	Blocks: 32         IO Block: 4096   regular file
Device: 811h/2065d	Inode: 2099808     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (  505/ sc386dm)   Gid: (  500/ sc386dm)
Access: 2014-10-09 10:22:51.895723445 +0100
Modify: 2014-10-09 10:22:51.895723445 +0100
Change: 2014-10-09 10:22:51.919723502 +0100
[root@ekbit13 bin]# vim sergen.scr
[root@ekbit13 bin]# stat sergen.scr~
  File: `sergen.scr~'
  Size: 13174     	Blocks: 32         IO Block: 4096   regular file
Device: 811h/2065d	Inode: 2098503     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (  505/ sc386dm)   Gid: (  500/ sc386dm)
Access: 2014-10-07 09:54:27.133865925 +0100
Modify: 2013-11-05 21:46:48.371733236 +0000
Change: 2013-11-05 21:46:48.371733236 +0000
[root@ekbit13 bin]#

As you can see the Inode numbers have changed, below is an actual example using the Bluefish editor.

Code:
[~/test] 
(10:34:01)-(sc386dm)-(685)-> touch testfile.txt

[~/test] 
(10:34:14)-(sc386dm)-(686)-> stat testfile.txt
  File: `testfile.txt'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 811h/2065d	Inode: 2098216     Links: 1
Access: (0664/-rw-rw-r--)  Uid: (  505/ sc386dm)   Gid: (  500/ sc386dm)
Access: 2014-10-09 10:34:14.713010608 +0100
Modify: 2014-10-09 10:34:14.713010608 +0100
Change: 2014-10-09 10:34:14.713010608 +0100

[~/test] 
(10:34:22)-(sc386dm)-(687)-> ls -latr
total 12
drwx------. 47 sc386dm sc386dm 4096 Oct  9 10:31 ..
-rw-rw-r--   1 sc386dm sc386dm    0 Oct  9 10:34 testfile.txt~
-rw-rw-r--   1 sc386dm sc386dm    6 Oct  9 10:34 testfile.txt
drwxrwxr-x   2 sc386dm sc386dm 4096 Oct  9 10:34 .

[~/test] 
(10:35:01)-(sc386dm)-(688)-> stat testfile.txt
  File: `testfile.txt'
  Size: 6         	Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d	Inode: 2099835     Links: 1
Access: (0664/-rw-rw-r--)  Uid: (  505/ sc386dm)   Gid: (  500/ sc386dm)
Access: 2014-10-09 10:34:48.307144361 +0100
Modify: 2014-10-09 10:34:48.307144361 +0100
Change: 2014-10-09 10:34:48.324144444 +0100

[~/test] 
(10:35:13)-(sc386dm)-(689)-> stat testfile.txt~
  File: `testfile.txt~'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 811h/2065d	Inode: 2098216     Links: 1
Access: (0664/-rw-rw-r--)  Uid: (  505/ sc386dm)   Gid: (  500/ sc386dm)
Access: 2014-10-09 10:34:36.018083824 +0100
Modify: 2014-10-09 10:34:14.713010608 +0100
Change: 2014-10-09 10:34:48.324144444 +0100

[~/test] 
(10:35:27)-(sc386dm)-(690)->

Hope that this helps.

Regards

Dave

Last edited by gull04; 10-09-2014 at 06:37 AM.. Reason: More information and example.
 

10 More Discussions You Might Find Interesting

1. 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

2. Filesystems, Disks and Memory

Inode number

as kernel keeps track of user activities on a file by its INODE number and I node table . what is the structure of Inode table. and where does this Inode table mapped into?user space or kernel space? is the Inode Number is fixed for a file till its deletion? thanks (1 Reply)
Discussion started by: compbug
1 Replies

3. UNIX for Advanced & Expert Users

how to find out pathname from inode number

Hi all when I execute pmap command on one of my daemon process, I am able to see the following output. Address Kbytes RSS Anon Locked Mode Mapped File 00010000 40 40 - - r-x-- irs026bmd 00028000 56 56 16 - rwx-- irs026bmd 00036000... (3 Replies)
Discussion started by: axes
3 Replies

4. UNIX for Dummies Questions & Answers

Number of Inode on a disk

How we can know number of inode present in my Disk including free and occupied. Is there any tool or program to know how much free inode are there in inode free list . (2 Replies)
Discussion started by: mr_deb
2 Replies

5. Filesystems, Disks and Memory

Recreating a deleted hardlink to a file if I know the inode number

At risk of twisting the rules to nearly the point of breaking (if you think this goes too far mods, I apologise and accept that this should be deleted), I'm hoping someone might be able to cast a little light on the following problem regarding hard links to files. ... (6 Replies)
Discussion started by: Smiling Dragon
6 Replies

6. Solaris

How to increase or decrease inode number of the particular UFS filesystem

Hi Gurus I want to know the command & tips regarding, how to increase or decrease inode number of the particular ufs filesystem. Is it possible to do it in a live/production environment. Regards (3 Replies)
Discussion started by: girish.batra
3 Replies

7. AIX

How to get the filename of which has been deleted if I know the inode number?

How to get the filename of which has been deleted if I know the inode number. i can use the command "istat" to get the inode number of the file. # istat /proc//fd/x If this file has been deleted,but the process of this file has not been closed and handle has not been released ,so this... (3 Replies)
Discussion started by: JoyOnLine
3 Replies

8. Shell Programming and Scripting

Modifying a file without changing inode number

Hi all, I am struggling to change the content of a file without changing the inode number. The exact issue is as below. I have a file name test.bak which has 100 lines of text. I am trying to to delete the first 90 lines of the text in the file. I know that using sed/awk/head/tail I can... (3 Replies)
Discussion started by: sathishkmrv
3 Replies

9. Red Hat

Inode number changes for a file in Redhat Linux

Hi, I have created a file abc.log in Redhat Linux. Inode number for a file get changes every time i update the file using vi editor. Is there any setting that can be made , such that inode number never gets changed? Or if we cannot restrict from inode number getting changed , is... (9 Replies)
Discussion started by: raghu.amilineni
9 Replies

10. Solaris

Retreive deleted file name if you having inode number

Some one please help me to find deleted file name, if I am having inode number in Solaris without using any 3rd party tool. Thanks :) (3 Replies)
Discussion started by: aksijain
3 Replies
All times are GMT -4. The time now is 05:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy