0

I always assumed that the dates in each inode were maintained separately even with hardlinks.

However if I change (touch/slap) the date of a hardlink file all other hardlinks to the same file show the same date change!

$ ln test.sh testlink.sh
$ slap test.sh
crtime : 5e7d6a29 - Fri 2020-03-27 10:51:21
mtime  : 5e7d6a29 - Fri 2020-03-27 10:51:21
atime  : 5e815c32 - Mon 2020-03-30 10:40:50
ctime  : 5e815c31 - Mon 2020-03-30 10:40:49
$ slap testlink.sh
crtime : 5e7d6a29 - Fri 2020-03-27 10:51:21
mtime  : 5e7d6a29 - Fri 2020-03-27 10:51:21
atime  : 5e815c32 - Mon 2020-03-30 10:40:50
ctime  : 5e815c31 - Mon 2020-03-30 10:40:49
$ slap test.sh -C 2005-02-13T08:47:43+00:00
$ slap test.sh
crtime : 420ea3af - Sun 2005-02-13 08:47:43
mtime  : 5e7d6a29 - Fri 2020-03-27 10:51:21
atime  : 5e815c32 - Mon 2020-03-30 10:40:50
ctime  : 5e815c31 - Mon 2020-03-30 10:40:49
$ slap testlink.sh
crtime : 420ea3af - Sun 2005-02-13 08:47:43
mtime  : 5e7d6a29 - Fri 2020-03-27 10:51:21
atime  : 5e815c32 - Mon 2020-03-30 10:40:50
ctime  : 5e815c31 - Mon 2020-03-30 10:40:49

(slap is a utility I wrote to change file date metadata in the inode including crtime.)

Can anyone who has a better understanding of the EXT2/3/4 file system care to comment.

So where is the filename stored if the inode is not unique? Is there a higher level structure that contains the filename that points to the inode in which the dates are stored?

1
  • So the filename only exists in the directory and the directory points to the inode where the date metadata is kept. So hardlinks are multiple directory entries to the same inode. How quickly one forgets the basics!
    – WallyZ
    Mar 30, 2020 at 7:32

1 Answer 1

1

Hardlink provides one or more alternate paths for an inode. As per man 2 link, there is no difference between the original and newly linked paths.

As they share the same inode, all the metadata are shared among them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .