A file /home/alice/report.txt is deleted. Which statement most accurately describes what happens to the file's data?
AThe data is immediately erased from disk
BThe directory entry is removed; the data persists until the OS reclaims the blocks
CThe inode is deleted, but the data blocks remain indefinitely
DNothing happens until the file system is unmounted
Deleting a file removes the directory entry that maps the name to the inode — not the inode or data itself. The OS marks the blocks as free space only when no directory entries point to the inode (link count reaches zero), and even then the data persists until overwritten. This is why deleted files can sometimes be recovered.
Question 2 Multiple Choice
Files /home/alice/notes.txt and /home/bob/backup.txt are hard links to the same inode. Alice deletes her copy. What happens to Bob's file?
ABoth files are deleted because they share the same inode
BBob's file is deleted because Alice's was the original link
CBob's file still works; the inode and data persist because one link remains
DThe data is copied to Bob's path before Alice's link is removed
An inode persists as long as at least one directory entry (hard link) points to it. Deleting one name only removes that directory entry and decrements the inode's link count. When the link count reaches zero, the OS frees the inode and data blocks. Since Bob's link still exists, the file is fully accessible — the concept of an 'original' link is a misconception; all hard links are equal.
Question 3 True / False
A file's name is stored in the inode alongside its permissions, size, and timestamps.
TTrue
FFalse
Answer: False
The file's name lives in a directory entry, not the inode. The inode stores metadata — permissions, size, timestamps, owner, and data block pointers — but has no record of what names point to it. This separation is why hard links work: multiple directory entries in different directories can map different names to the same inode number, giving one file multiple names.
Question 4 True / False
On a Unix file system, a single file can be accessed through multiple different pathnames simultaneously.
TTrue
FFalse
Answer: True
Hard links allow multiple directory entries — in the same or different directories — to map to the same inode. All names are equally valid; none is more 'original' than another. The file's data and metadata are shared; only the name-to-inode mappings are separate entries in directory files.
Question 5 Short Answer
Why is the separation between a file's name (stored in a directory entry) and its metadata and data (stored in an inode) architecturally significant? Give one concrete consequence of this design.
Think about your answer, then reveal below.
Model answer: Because the name is separate from the inode, the same underlying file can have multiple names (hard links) pointing to it. Deleting one name only removes that directory entry; the file persists until no names remain. Other consequences include: renaming a file is cheap (just update the directory entry, no data moves), and stat() returns inode metadata regardless of which name was used to access the file.
This separation is the key insight of Unix file system design. The name is ephemeral — a pointer in a directory; the inode is the authoritative record of the file's existence. This also explains why deleting a file that another process has open doesn't destroy it immediately: the process holds an open file descriptor referencing the inode directly, independent of any directory entry.