0% found this document useful (0 votes)
18 views4 pages

Basic Linux File System Interview Questions

The document provides a comprehensive list of basic Linux file system interview questions and their answers, covering topics such as file systems, commands for managing file systems, differences between various file systems, and file permissions. Key concepts include journaling, inodes, LVM, and the use of commands like df, du, and fsck. It serves as a valuable resource for understanding Linux file systems and their management.

Uploaded by

Harish Bansode
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Basic Linux File System Interview Questions

The document provides a comprehensive list of basic Linux file system interview questions and their answers, covering topics such as file systems, commands for managing file systems, differences between various file systems, and file permissions. Key concepts include journaling, inodes, LVM, and the use of commands like df, du, and fsck. It serves as a valuable resource for understanding Linux file systems and their management.

Uploaded by

Harish Bansode
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

******Basic Linux File System Interview Questions with Answers******

1. What is a file system in Linux?


A file system controls how data is stored and retrieved on disk. It organizes
files and directories.
Example: ext4, XFS, Btrfs

2. Name some common Linux file systems.


ext2, ext3, ext4, XFS, Btrfs, ReiserFS, FAT32, NTFS

3. What is the difference between ext2, ext3, and ext4?


- ext2: No journaling
- ext3: Journaling supported
- ext4: Larger volume and faster journaling

4. What is the default file system in modern Linux distributions?


ext4

5. How do you check the file system type of a partition?


Command: df -Th or lsblk -f

6. What is the purpose of the /etc/fstab file?


It defines filesystems to be mounted automatically at boot.

7. How can you display mounted file systems?


Command: mount or cat /proc/mounts

8. What command is used to mount and unmount file systems?


mount /dev/sda1 /mnt
umount /mnt

9. What is the difference between mount and bind mount?


Bind mount mirrors an existing directory to another path without duplication.
Example: mount --bind /var/www /mnt/www

10. What command shows disk usage in Linux?


Command: du -sh *

11. What is an inode?


An inode stores metadata about a file (size, permissions, owner, etc).

12. What information is stored in an inode?


File size, owner, permissions, timestamps, data block pointers.

13. How do you view inode information of a file?


Command: ls -i filename or stat filename

14. What is the difference between hard link and soft link?
Hard link: same inode, cannot link directories.
Soft link: pointer to another path (shortcut).

15. How do you create hard and soft links?


ln file1 file2 (hard link)
ln -s file1 link1 (soft link)

16. What happens to a file if its hard link is deleted?


File remains accessible until all hard links are deleted.

17. How do you check available disk space in Linux?


Command: df -h

18. Explain the difference between df and du commands.


df → shows total filesystem usage
du → shows directory-level usage
19. What does the lsblk command do?
Lists block devices, partitions, and mount points.

20. How can you repair a corrupted file system?


Command: fsck /dev/sdX

21. What is journaling in a file system?


Records changes before committing to disk for quick recovery after crashes.

22. What are the advantages of journaling file systems like ext3/ext4?
Faster recovery, reduced corruption risk.

23. What is the difference between XFS and ext4 file systems?
XFS handles large files better; ext4 is more widely supported.

24. What is the purpose of the fsck command?


To check and repair filesystem errors.

25. When should you avoid running fsck on a mounted file system?
Always run fsck on unmounted or read-only mounted partitions.

26. How can you resize a file system (increase or decrease size)?
resize2fs /dev/sdXn (after resizing partition)

27. How do you create a new file system on a disk partition?


Command: mkfs.ext4 /dev/sdXn

28. What is the difference between block device and character device?
Block device: buffered (disks); Character device: unbuffered (keyboards).

29. What is the function of the superblock?


Stores metadata about the entire filesystem (size, inode count, etc).

30. What is the purpose of swap space, and how do you create it?
Swap is virtual memory.
Commands: mkswap /dev/sdX && swapon /dev/sdX

31. What is LVM (Logical Volume Manager) and how is it useful?


It allows resizing storage dynamically across disks.

32. How do you create and mount an LVM volume?


pvcreate /dev/sdX; vgcreate vg1 /dev/sdX; lvcreate -L 10G -n lv1 vg1;
mkfs.ext4 /dev/vg1/lv1

33. What is the difference between physical volume, volume group, and logical
volume?
PV: physical disk; VG: collection of PVs; LV: usable logical partition.

34. How do you extend or reduce an LVM logical volume?


lvextend -L +5G /dev/vg1/lv1 && resize2fs /dev/vg1/lv1

35. What command displays file system UUIDs?


blkid

36. How can you mount using UUID?


mount UUID=xxxx-xxxx /mnt

37. How do you check file system usage of a directory?


du -sh /path/to/dir

38. What are different types of file permissions?


r (read), w (write), x (execute)
39. How do you change ownership and permissions?
chown user:group file
chmod 755 file

40. What is symbolic vs numeric permission representation?


Symbolic: u+rwx
Numeric: 755

41. What is a sticky bit?


Prevents users from deleting others’ files in shared directories (/tmp).

42. What is /proc and /sys?


Virtual filesystems providing kernel and hardware info.

43. What is tmpfs?


Temporary memory-based filesystem.
mount -t tmpfs tmpfs /mnt/tmp

44. How to monitor I/O performance?


iostat, iotop

45. What is /lost+found?


Holds recovered files after fsck repair.

46. How to check filesystem block size?


sudo tune2fs -l /dev/sdX | grep 'Block size'

47. What happens when a filesystem runs out of inodes?


No new files can be created even if space remains.

48. What command shows filesystem labels?


blkid or e2label /dev/sdX

49. How do you set/change a filesystem label?


e2label /dev/sdX "DATA"

50. What is the difference between a partition and a filesystem?


Partition is disk division; filesystem organizes data inside partition.

51. How do you check open files on a filesystem?


lsof /mount/point

52. What is fuser used for?


Shows processes using files or sockets.
fuser -m /mnt

53. How can you identify which process is using a mount point?
lsof +f -- /mountpoint

54. What is the difference between raw and cooked devices?


Raw: unbuffered direct I/O; Cooked: kernel-buffered I/O.

55. What is the maximum file size in ext4 and XFS?


ext4: 16TB; XFS: 8EB

56. How to check and optimize filesystem performance?


Use tune2fs, iostat, or mount options like noatime.

57. What are /dev, /mnt, and /media used for?


/dev → devices; /mnt → temporary mounts; /media → removable media.

58. How do you mount a remote NFS share?


mount -t nfs server:/path /mnt
59. What’s the difference between NFSv3 and NFSv4?
NFSv4 supports stateful connections and better security.

60. What is OverlayFS?


A union filesystem used by Docker for layering images.

61. What is the use of tune2fs?


Modify ext2/3/4 filesystem parameters.

62. How do you check last fsck time?


tune2fs -l /dev/sdX | grep 'Last checked'

63. What is a loopback filesystem?


A file used as a virtual disk.
Example: mount -o loop [Link] /mnt

64. How do you create an ISO and mount it?


mkisofs -o [Link] /folder
mount -o loop [Link] /mnt

65. What is the difference between local and network filesystem?


Local is stored physically; network uses remote resources (NFS, CIFS).

66. What is /etc/mtab?


Lists currently mounted filesystems.

67. How to automatically mount a filesystem at boot?


Add entry in /etc/fstab.

68. What’s the difference between ext4 and Btrfs?


Btrfs supports snapshots, CoW, and subvolumes.

69. What is Copy-on-Write (CoW)?


Files are duplicated only on modification, saving space.

70. How to convert ext2 to ext3/ext4?


tune2fs -j /dev/sdX (to ext3), then upgrade to ext4.

Common questions

Powered by AI

A journaling file system records changes before they are committed to the main filesystem, which allows for faster recovery and reduces the risk of corruption after a system crash. This feature enhances system reliability because it ensures the integrity of the filesystem by keeping a journal or log of what the system is intending to do, helping the system recover more quickly and safely from unexpected shutdowns .

Inodes store essential metadata for files, such as permissions, ownership, and pointers to data blocks. Inode availability is crucial as it controls file creation. When inode exhaustion occurs, no new files can be created even if there is available disk space, leading to potential application failures and system operation issues as the filesystem cannot store any additional file entries .

Block devices, like hard disks, are accessed in fixed-size blocks and are buffered, allowing for random access to data, which makes them suitable for tasks like file storage. Character devices, such as keyboards and serial ports, are unbuffered and work with streams of data, providing direct access to hardware devices for input/output operations .

Hard links share the same inode with the original file, effectively being indistinguishable from the original file, except for the directory entry. They cannot link directories or cross filesystem boundaries. Soft links (symbolic links), on the other hand, are separate paths that point to the original file and can link directories or point across different filesystems .

In LVM, a physical volume (PV) is a partition or disk drive that the system can use to store data. Multiple physical volumes can be combined into a volume group (VG), which acts as a pool of storage from which logical volumes (LV) are allocated. Logical volumes can be dynamically resized and behave like traditional disk partitions, providing flexibility beyond fixed partition sizing .

Running fsck on unmounted or read-only partitions is recommended to avoid the risk of filesystem corruption. If fsck is run on a mounted filesystem, especially in write mode, it could damage the data structures on disk as fsck tries to repair the filesystem while it is actively being used, potentially leading to data loss or other inconsistencies .

ext2 does not support journaling, making it less reliable compared to ext3 and ext4, which do. ext3 introduces journaling for improved reliability but is less performance optimized compared to ext4. ext4 offers larger volume support and faster journaling, providing better performance and scalability than both ext2 and ext3 .

The superblock contains metadata about the filesystem, including its size, the number of inodes, and other critical information required to understand and access the filesystem structure. Damage to the superblock can render the filesystem inaccessible, which is why there are multiple backup superblocks stored in certain systems to prevent data loss .

Btrfs provides features like snapshots, which allow for capturing the state of the filesystem at a particular point in time, and Copy-on-Write (CoW), where files are copied only when modified, enhancing storage efficiency. These features make Btrfs highly flexible and efficient for managing large-scale storage systems compared to ext4, which lacks these advanced features .

LVM allows for dynamic resizing of volumes and aggregation of multiple disks into a single volume group, offering greater flexibility compared to traditional partitioning. This is advantageous for adjusting storage allocations and managing large amounts of data without downtime or requiring rearrangement of physical disk partitions .

You might also like