Keep filenames, inodes, and open files separate. Most filesystem follow-ups test whether you can explain what survives a rename, unlink, fork, or crash. Commands assume Linux; ext-specific tools require e2fsprogs.

All six interview guides.

Names, objects, and storage

What is an inode? What information does it store? Does it store the filename?

An inode stores file type, permissions, owner/group, size, timestamps, link count, and filesystem-specific data-location information. The filename is stored in a directory entry mapping that name to an inode. Multiple names can identify the same inode.

What information is not in the inode?

The file's name and full pathname. An inode number also needs filesystem identity to identify a file across multiple filesystems; numbers can be reused after deletion.

How does VFS or filesystem implementation work?

The virtual filesystem provides common interfaces and objects for different filesystem implementations. The specific filesystem implements operations such as lookup and read; VFS connects mounts, dentries, inodes, and open file objects. /proc and /sys can implement these interfaces without disk-backed file data.

Resolve /home/aman/report.txt to its actual data blocks.

Start at the process's root in its mount namespace. Resolve each component, checking directory search permissions, following relevant symlinks/mounts, and using cached dentries/inodes where possible. The filesystem maps the opened file's logical offsets to stored data; reads may already be satisfied by the page cache. See path resolution.

How does the kernel track open files? Relate descriptors, file objects, dentries, and inodes.

A process's descriptor table points to open file descriptions holding offset and status flags. Each references a path with mount/dentry information; the dentry identifies an inode. dup() and fork inheritance can share that open-file state; separate opens normally have separate offsets. See open(2).

What are /proc and /sys? Are they backed by disk?

They are virtual filesystems exposing kernel state. /proc includes processes and system information; /sys exposes kernel objects and devices. Their entries are generally generated by the kernel rather than stored as ordinary disk files; writable entries can act as controls.

What are all the types of files in Linux?

Regular files, directories, symbolic links, character devices, block devices, FIFOs/named pipes, and sockets. The first character in ls -l identifies the type, such as -, d, l, c, b, p, or s.

What does ln file1 file2 create? How is ln -s different?

It creates a hard link: another directory entry for the same inode. ln -s file1 file2 instead creates a symlink storing a target pathname; it can dangle when that pathname disappears.

Hard links share an inode within one filesystem, so they cannot cross filesystem boundaries. Symlinks refer to paths and can cross boundaries. Removing one hard-linked name leaves the other usable; removing a symlink target can leave a broken link.

How can you view a file's block allocation on ext4?

Use filefrag -v FILE to inspect extents on a supported filesystem. Recent unwritten/delayed allocations and permissions can affect what it reports. Extents describe logical-to-physical runs, not file contents.

How does the filesystem find a fragmented file's pieces?

It follows stored mappings from logical file offsets to filesystem blocks. Traditional ext files use direct/indirect pointers; ext4 commonly uses extent trees. Fragmentation creates multiple mappings, not a full-disk search for every read. See ext4 block mapping.

What are indirect blocks? When do they come into play?

They contain pointers to other blocks instead of file payload. In traditional inode block mapping, single, double, and triple indirection extend the addressable file beyond direct pointers. Extent-based ext4 files use extent trees instead of that traditional scheme.

What are sectors on a disk?

A sector is a device addressing/transfer unit; logical sector size can differ from physical sector size. Filesystem blocks are a separate unit. Inspect lsblk -o NAME,LOG-SEC,PHY-SEC; do not assume every device has 512-byte physical sectors.

What is the superblock, and how do you display it?

It stores filesystem-wide information such as size, block size, counts, feature flags, and state. For ext2/3/4, use dumpe2fs -h /dev/DEVICE against the verified partition, with required privileges. Other filesystems have different tools. See ext4 global structures.

How can two paths be checked for the same file?

Compare device ID and inode number, following symlinks if you mean their targets. stat -Lc '%d:%i' PATH1 PATH2 does that with GNU stat. The result is a point-in-time check; concurrent replacement and inode reuse matter.

Deletion, durability, and capacity

Delete a file still open by a process: is space freed immediately?

Unlink removes a name and reduces the link count. If another hard link or open reference remains, data can stay allocated. sudo lsof +L1 finds open files with zero links; arrange a controlled close or log reopen to release the remaining reference.

What does df show? How does it differ from du?

df reports filesystem space/accounting; du walks reachable directory entries and totals usage. Deleted-open files, mount boundaries, permissions, reserved blocks, and snapshots can produce differences. Use df -h, df -i, and scoped du -xhd1 PATH to separate byte and inode exhaustion.

What are fsync() and sync? How do they differ from writing and closing?

Buffered writes and close can leave data only in memory. fsync(fd) flushes that file's data and required metadata and waits for completion; persist a changed directory entry by syncing its directory too. sync() flushes broadly across filesystems. Check errors; atomic visibility alone does not promise durability. See fsync.

What is a journaling filesystem?

It records transactions so crash recovery can replay committed filesystem changes. What is journaled depends on mode; metadata journaling alone does not guarantee all recent file data survived.

How does journaling maintain filesystem integrity?

It lets recovery complete committed transactions and avoid applying incomplete transactions as though they finished. This shortens structural recovery and helps keep metadata consistent; it does not replace backups or application-level consistency checks. The ext4 journal documents transaction recovery.

What is the difference between ext3 and ext4? Give two improvements.

Ext4 adds extent-based mapping and supports larger files/filesystems than ext3. Delayed allocation is another improvement that can improve placement and reduce fragmentation. Actual limits depend on enabled features, block size, and tooling.

Mounts, repair, and NFS

What is a mount point? What happens to existing files beneath it?

It is a directory where a filesystem is attached in the namespace. Existing contents become hidden beneath the mounted filesystem, not deleted; they reappear after unmounting.

Which command checks and repairs a Linux filesystem? What does -n mean?

The tool depends on filesystem type. e2fsck checks ext2/3/4; -n opens read-only and answers no to changes. Prefer an unmounted filesystem: even a read-only check of a changing mounted filesystem can give invalid results. XFS and Btrfs use different procedures. See e2fsck.

How do NFS mounting, unmounting, and options work?

A client mounts a server export, for example mount -t nfs -o vers=4.1 server:/export /mnt/share when that server supports the version/path. Inspect findmnt and nfsstat -m. hard retries requests; soft timeout behavior can cause application errors/data corruption. Busy unmounts need reference investigation; lazy unmount detaches the name but can leave work pending. See nfs(5).

How do you mount a new disk, format it, and enable NFS?

Identify the exact device and existing signatures with lsblk/blkid, confirm its contents are expendable, partition if needed, create a filesystem, and mount it using stable identity such as UUID. Persist the mount, install/configure the NFS server, export only to required clients, then verify client identity, permissions, writes, and reboot behavior. Formatting is destructive; device verification precedes it.

Three-minute drill

In a disposable directory, create a file, a hard link, and a symlink. Delete the original name. Predict inode numbers and read results before running the commands.

printf 'hello\n' > file1
ln file1 file2
ln -s file1 link1
ls -li
rm file1
cat file2
cat link1

Expected: file2 still reads hello; link1 fails because its named target disappeared. Next: networking.