Sample Header Ad - 728x90

Two files with different contents in the linux overlay file system have the same inode

1 vote
2 answers
96 views
I'm learning about the linux overlay file system and I'm having a problem that's beyond my knowledge. Can anyone explain the technical rationale behind this?
mkdir ./{merged,work,upper,lower}
echo "message from lower" >> ./lower/h

sudo mount -t overlay overlay -o lowerdir=./lower,upperdir=./upper,workdir=./work ./merged
# copy lower/h on write, and will save to lower/h
echo "message from merged" >> ./merged/h

# check files content: merged/h and upper/h have same content
cat ./lower/h
cat ./merged/h
cat ./upper/h

# this command show merged/h and lower/h have same inode, why isn't upper/h and merged/h have same inode
stat ./lower/h ./upper/h ./merged/h
I think merged/h and upper/h should have the same inode, and lower with different inodes. However, this is not the case with the above experimental results
Asked by user25075193 (11 rep)
Dec 12, 2024, 01:42 AM
Last activity: Dec 12, 2024, 07:59 AM