Linux/Unix File System Interview Questions
UNIX
Q: What’s the difference between Symbolic Link and HardLink?
A: ln –s src dst-file vs. ln src-file dst-file
You need to understand how file is stored on the File System and what I-node is all about?
Each file contains 2 things: file-name and structure that stores the real-data of the file.
Symbolic link is like: Added link to the filename only. It can cross device/logical partition.
Harlink is made at I-node(filesystem) level, it’s confined within the same filesystem(physical device). It’s more like adding a reference count to the original file, when hardlink is deleted, the reference minus one only.
Some people on the internet says this:
HardLink is a pointer to a file, Symbolic Link is an indirect-pointer to a file.
Since symbolic link can point to non-existent file on the disk, Hardlink can not.
Q: How much do you know about journalized file system? Why Journalized File System(JFS)?
A: Large HardDisk Partiion; quick recovery from crashes, high-performance I/O; Terabytes data file
Alternative to ext2 there are: ext3, ReiserFS, XFS, JFS
Advantage of JFS:
1. Simplify restarts (longer fsck means longer down time)
2. reduce fragmentation
3. accelerate I/O
4. obsolete fsck()
In ext2: I-NODE stores all info about a file except data itself, it’s a book-keeping file for a file.
Directory’s I-Node contains: inode numbers of its contents, plus permissions, # of blocks, and etc.
Juornal: simply a list of transactions (modifies meta-data structures: inodes, free lists, directory entries).
Onlye ext3 is backward compatible. tune2fs –j /dev/hdb3
