LCA File Systems & Storage Management 4 — Questions and Answers
Question 1: Which command creates a new physical volume (PV) on /dev/sdd for use with LVM?
- pvcreate /dev/sdd (Correct answer)
- vgcreate /dev/sdd
- lvcreate /dev/sdd
- mkpv /dev/sdd
Correct answer: pvcreate /dev/sdd
pvcreate initializes a disk or partition with LVM metadata, making it usable as a physical volume.
Question 2: What does the 'relatime' mount option do compared to 'atime'?
- Updates atime only if the file was modified or accessed before its current atime (Correct answer)
- Updates atime relative to modification time
- Disables atime entirely
- Updates atime once per day maximum
Correct answer: Updates atime only if the file was modified or accessed before its current atime
relatime only updates atime when the previous atime is older than the mtime or ctime, reducing unnecessary writes.
Question 3: Which command adds an existing physical volume /dev/sde to volume group 'vg_data'?
- vgextend vg_data /dev/sde (Correct answer)
- pvextend vg_data /dev/sde
- lvextend vg_data /dev/sde
- vgadd /dev/sde vg_data
Correct answer: vgextend vg_data /dev/sde
vgextend adds one or more initialized PVs to an existing volume group, increasing its total capacity.
Question 4: What is the role of the 'journal' in ext3/ext4 filesystems?
- Records metadata (and optionally data) changes before committing them to ensure consistency after a crash (Correct answer)
- Stores a log of user logins
- Maintains an index of file locations for fast lookup
- Tracks block allocation statistics
Correct answer: Records metadata (and optionally data) changes before committing them to ensure consistency after a crash
The journal is a write-ahead log that records pending changes, allowing the filesystem to recover to a consistent state after an unclean shutdown.
Question 5: Which command shows the inode usage of all mounted filesystems?
- df -i (Correct answer)
- ls -li
- stat -f /
- tune2fs -l /dev/sda1
Correct answer: df -i
df -i reports inode usage (used, free, and percentage) for each mounted filesystem.
Question 6: What does 'mkswap /dev/sdf1' followed by 'swapon /dev/sdf1' accomplish?
- Formats and activates a swap partition for virtual memory use (Correct answer)
- Creates a swap file on sdf1
- Formats sdf1 as ext4 and mounts it as /swap
- Encrypts the partition and uses it as swap
Correct answer: Formats and activates a swap partition for virtual memory use
mkswap writes the swap signature to the partition, and swapon enables it for immediate use as virtual memory.
Question 7: Which /proc file shows the currently supported filesystem types in the running kernel?
- /proc/filesystems (Correct answer)
- /proc/mounts
- /proc/partitions
- /proc/diskstats
Correct answer: /proc/filesystems
/proc/filesystems lists all filesystem types currently registered with the kernel, including those built-in and loaded as modules.
Which command creates a new physical volume (PV) on /dev/sdd for use with LVM?