Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

lsattr -v gives me the "version number" of given file(s).

What does this mean?

On Redhat 7.3, I could've sworn all the version numbers were 1 except those I changed with chattr -v.

On Fedora 11, they appeared to be random numbers.

Setting version numbers or even having multiple versions of a file could be very useful, so I want to understand how "versioning" works in ext3.

share|improve this question

lsattr -v invokes the EXT2_IOC_GETVERSION ioctl for the file. This, in turn, retrieves the inode's i_generation field. This is a feature primarily intended for use with NFS: each time an inode gets allocated, one has to make sure it gets a new generation. Otherwise, NFS clients with stale file handles may manage to access data that weren't meant for them. ext2/ext3/ext4 allocates the generation number from a volume-global counter s_next_generation, which is incremented on every allocation.

share|improve this answer

This is not really an answer, but just a interresting find.

I played around with lsattr -v and it seems like each new file you create gets a unique number assigned to it. Im not sure if this is correct, my expirement is documented below.

$ mkdir temp                  # make a new folder
$ cd temp       
$ touch a b c d e f g         # create a lot files in that folder.
$ lsattr -v *                 # checkout those files using lsattr -v
1386486996 -------------e- a
1386486997 -------------e- b
1386486998 -------------e- c
1386486999 -------------e- d
1386487000 -------------e- e
1386487001 -------------e- f
1386487002 -------------e- g

This behaviour could be limited to the distribution or the disk format.

share|improve this answer
So it's sort of like an inode number, but it never repeats for the life of the filesystem? – barrycarter Oct 30 '10 at 20:52
OK, I used "chattr -v 1 file*" to change several files' version number. It worked (lsattr showed version 1) and the files didn't get merged into each other or anything weird. So I think this is still an open question. Is it just "we had extra space for an int in the inode", or does it have a meaning/usage/history/etc (other than NFS above) – barrycarter Nov 2 '10 at 20:23
add this to your question, by editing your question. That way more people get to see it... – Stefan Nov 2 '10 at 20:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.