---
tags:
- linux
- l1
- flashcard-deck
- linux-filesystem
---
<!-- wiki:breadcrumb:start -->
[Portal](../../../../library/portal/index.md) | **Level:** [L1: Foundations](../../../../library/portal/levels.md) | **Topics:** [Filesystems & Storage](../../../../library/portal/topics.md) | **Domain:** Linux
<!-- wiki:breadcrumb:end -->

id	category	difficulty	tags	question	answer	source_path
linux-filesystem/02390083f276	linux-filesystem	medium	linux, performance, iowait, troubleshooting, disk-io	You see high "iowait" in top. What are your next three steps to identify the culprit?	High iowait means CPU is idle waiting for I/O operations to complete.\n\nThree diagnostic steps:\n1. Identify the saturated disk:\n   - `iostat -xz 1`\n   - Look for high %util, await, and avgqu-sz columns\n   - Identifies WHICH disk device is the bottleneck\n\n2. Find the process generating I/O:\n   - `iotop` (requires root)\n   - Shows per-process I/O read/write rates\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/524-high-iowait-troubleshooting-steps.txt
linux-filesystem/05b9a872563d	linux-filesystem	hard	btrfs, linux, lvm, mount, system	To LVM or not to LVM. What benefits does it provide?	- LVM makes it quite easy to move file systems around\n- you can extend a volume group onto a new physical volume\n- move any number of logical volumes of an old physical one\n- remove that volume from the volume group without needing to unmount any partitions\n- you can also make snapshots of logical volumes for making backups\n- LVM has built in mirroring support so you can have a logical volume mirrored across multiple physical volumes\n- LVM even supports TRIM\n\nRemember: LVM: PV→VG→LV. "Disks→pool→partitions."\n\nExample: `pvcreate /dev/sdb && vgcreate myvg /dev/sdb && lvcreate -L 10G -n mylv myvg`	projects/knowledge/interview/linux/056-to-lvm-or-not-to-lvm-what-benefits-does-it-provide.txt
linux-filesystem/0729f6284269	linux-filesystem	hard	linux, filesystem, inode, troubleshooting, storage	What is an Inode, and what happens if a filesystem runs out of them?	An inode is a data structure storing file metadata, and running out prevents new file creation.\n\nWhat an inode contains:\n- File type and permissions\n- Owner (UID) and group (GID)\n- File size\n- Timestamps (atime, mtime, ctime)\n- Link count (hard links)\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	projects/knowledge/interview/linux/530-inode-exhaustion.txt
linux-filesystem/09bbcc6db662	linux-filesystem	easy	linux, lvm, storage	Explain the following in regards to LVM: PV, VG, LV	LVM has three abstraction layers:\n\nPV (Physical Volume):\n- Bottom layer\n- Actual disk or partition\n- Created with: pvcreate /dev/sdb\n- View with: pvs, pvdisplay\n\nVG (Volume Group):\n- Middle layer\n\nRemember: LVM: PV→VG→LV. "Disks→pool→partitions."\n\nExample: `pvcreate /dev/sdb && vgcreate myvg /dev/sdb && lvcreate -L 10G -n mylv myvg`	projects/knowledge/interview/linux/352-explain-the-following-in-regards-to-lvm-pv-vg-lv.txt
linux-filesystem/0b0db12e5397	linux-filesystem	hard	linux, storage, io, performance, syscalls	Why is fsync() one of the most dangerous syscalls?	fsync() forces synchronous writes through all layers, potentially stalling the entire I/O subsystem.\n\nWhat fsync() does:\n- Flushes file data to stable storage\n- Flushes filesystem metadata\n- Issues write barriers to hardware\n- Waits for confirmation from disk\n\nWhy it's dangerous:\n\n1. Stalls entire I/O queue\n   - Other processes wait behind fsync\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/506-fsync-dangerous-syscall.txt
linux-filesystem/10a0a1c46f57	linux-filesystem	easy	linux, lvm, storage	What is LVM (Logical Volume Manager) and why is it useful in Linux?	LVM (Logical Volume Manager) provides flexible disk management.\n\nComponents:\n- PV (Physical Volume): Actual disks/partitions\n- VG (Volume Group): Pool of PVs\n- LV (Logical Volume): Virtual partitions from VG\n\nBenefits:\n- Resize volumes online\n- Span multiple disks\n\nRemember: LVM: PV→VG→LV. "Disks→pool→partitions."\n\nExample: `pvcreate /dev/sdb && vgcreate myvg /dev/sdb && lvcreate -L 10G -n mylv myvg`	projects/knowledge/interview/linux/351-what-is-lvm.txt
linux-filesystem/10b224d5960e	linux-filesystem	medium	linux, filesystem, troubleshooting, disk-space, lsof	df -h shows a disk is 100% full, but du -sh of the mount point shows only 50% usage. Why?	The most common cause is deleted files still held open by running processes.\n\nExplanation:\n- When a file is deleted while a process has it open, the directory entry is removed\n- du only counts files visible in the directory tree\n- The file's data blocks remain allocated until the file descriptor is closed\n- df reports actual block allocation from filesystem metadata\n\n\n\nRemember: df=filesystem level. du=directory level. "df=room left, du=who's using it."	projects/knowledge/interview/linux/529-df-du-discrepancy.txt
linux-filesystem/11e17fd2d74e	linux-filesystem	medium	block-devices, linux	How can you print all the information on connected block devices in your system?	`lsblk` — lists all block devices (disks, partitions, LVM volumes) in a tree format showing name, size, type, and mountpoint. Add `-f` to include filesystem type and UUID.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/278-how-can-you-print-all-the-information-on-connected.txt
linux-filesystem/138798132bfb	linux-filesystem	medium	linux, performance, iowait, storage	What does high iowait with low disk utilization usually mean?	Latency-bound I/O (small random reads/writes). Check `iostat -x` and `await`.\n\nOften caused by slow storage, seeks, or network-backed storage (NFS).\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/537-high-iowait-low-disk-util.txt
linux-filesystem/161b9b3da271	linux-filesystem	hard	linux, filesystem, recovery, troubleshooting, sysadmin	How do you recover a system where /etc is filled and / is read-only?	Boot to rescue mode and methodically clean up and fix the underlying issue.\n\nRecovery steps:\n1. Boot to rescue/live CD or use recovery mode from GRUB\n2. Mount root filesystem: `mount /dev/sda1 /mnt` (adjust device)\n3. If read-only, check for errors: `fsck /dev/sda1`\n4. Remount read-write: `mount -o remount,rw /mnt`\n5. Find large files: `du -ah /mnt/etc | sort -rh | head -20`\n6.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/520-recover-etc-full-readonly.txt
linux-filesystem/17edc0a73f70	linux-filesystem	easy	linux, tar, archive	What is an archive? How do you create one in Linux?	An archive combines multiple files into one file.\n\ntar (Tape Archive):\n- tar cvf archive.tar files/ - Create archive\n- tar cvzf archive.tar.gz files/ - Create compressed (gzip)\n- tar cvjf archive.tar.bz2 files/ - Create compressed (bzip2)\n- tar xvf archive.tar - Extract\n\nOptions:\n- c: Create\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/384-what-is-an-archive-how-do-you-create-one-in-linux.txt
linux-filesystem/18b207a464d9	linux-filesystem	hard	linux, system, troubleshooting	Getting `Too many Open files` error for Postgres. How to resolve it?	Fixed the issue by reducing `max_files_per_process` e.g. to 200 from default 1000. This parameter is in `postgresql.conf` file and this sets the maximum number of simultaneously open files allowed to each server subprocess.\n\nUsually people start to edit `/etc/security/limits.conf` file, but forget that this file only apply to the actively logged in users through the PAM system.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/110-getting-codetoo-many-open-filescode-error-for-post.txt
linux-filesystem/19adca51bf61	linux-filesystem	medium	linux, filesystem, kernel, tuning, sysadmin	Explain /proc vs /sys vs /dev — what kind of tuning would you do in each?	These are virtual/special filesystems with distinct purposes.\n\n/proc - Process and kernel information:\n- Process info: /proc/<pid>/ (cmdline, fd, maps, status)\n- Kernel tunables: /proc/sys/\n- Examples:\n  - /proc/sys/vm/swappiness (memory management)\n  - /proc/sys/net/core/somaxconn (socket backlog)\n\nRemember: /proc=process/kernel info. /sys=device/driver. Both virtual — no disk used.	projects/knowledge/interview/linux/518-proc-sys-dev-differences.txt
linux-filesystem/1dd410e4112d	linux-filesystem	hard	filesystem, storage, inodes	What is an inode in Linux, and what happens when you run out of inodes?	An inode (index node) is a data structure that stores metadata about a file:\n- File type and permissions\n- Owner and group IDs\n- File size\n- Timestamps (access, modification, change)\n- Number of hard links\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	projects/knowledge/interview/linux/003-inode.txt
linux-filesystem/1efbcf27f6fc	linux-filesystem	medium	linux, boot, filesystem	What can you find in /boot?	/boot contains files needed for system boot:\n\nKey contents:\n- vmlinuz-* - Compressed Linux kernel\n- initrd.img-* or initramfs-* - Initial RAM disk\n- config-* - Kernel build configuration\n- System.map-* - Kernel symbol table\n- grub/ - GRUB bootloader files\n\nOn UEFI systems:\n- /boot/efi/ - EFI System Partition mount\n- /boot/efi/EFI/ - EFI bootloaders\n\nSize considerations:\n- Multiple kernels take space\n- apt autoremove removes old kernels\n- Typically 500MB-1GB partition\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	projects/knowledge/interview/linux/346-what-can-you-find-in-boot.txt
linux-filesystem/20c5d2becd0b	linux-filesystem	medium	linux, syscalls, filesystem	What system call is used for listing files?	getdents/getdents64 system calls read directory entries.\n\nHow ls works:\n1. open() - Open directory\n2. getdents64() - Read directory entries\n3. stat() - Get file details (for -l)\n4. close() - Close directory\n\nRelated syscalls:\n- opendir/readdir - Library wrappers\n- getdents64 - Modern version\n- getdents - Legacy version\n\nTrace it:\n- strace ls /tmp\n- Shows open, getdents64, stat calls\n\nNote: readdir() is a library function (glibc) that calls getdents internally.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/405-what-system-call-is-used-for-listing-files.txt
linux-filesystem/25a17f57ede9	linux-filesystem	medium	linux, syscalls, filesystem	What does the readdir() system call do?	readdir() reads directory entries one at a time.\n\nActually, readdir() is a library function (glibc), not a syscall.\nIt wraps the getdents/getdents64 system calls.\n\nWhat it does:\n- Returns next directory entry (struct dirent)\n- Contains: d_name, d_ino, d_type\n- Returns NULL at end of directory\n\n\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/408-what-readdir-system-call-does.txt
linux-filesystem/25c6daa0ef87	linux-filesystem	hard	inodes, linux, system	What fields are stored in an inode?	Within a POSIX system, a file has the following attributes which may be retrieved by the stat system call:\n\n- **Device ID** (this identifies the device containing the file; that is, the scope of uniqueness of the serial number).\n\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	projects/knowledge/interview/linux/089-what-fields-are-stored-in-an-inode.txt
linux-filesystem/272c7ac89472	linux-filesystem	medium	ext4, linux, mount, storage, xfs	How do you safely expand a filesystem online?	Order matters - always expand from bottom up:\n\n1. **Expand block device** (LVM, cloud volume, etc.)\n```bash\n# LVM example:\nlvextend -L +10G /dev/vg/lv\n# Or cloud: resize EBS/disk in console, then rescan\n```\n\n2. **Rescan if needed** (for cloud/SAN):\n```bash\necho 1 > /sys/class/block/sda/device/rescan\n```\n\n3.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/457-how-do-you-safely-expand-a-filesystem-online.txt
linux-filesystem/2cec1f7e4d6f	linux-filesystem	medium	inodes, links, linux, system	What is the difference between a symbolic link and a hard link?	Underneath the file system files are represented by inodes (or is it multiple inodes not sure)\n\n- a file in the file system is basically a link to an inode\n- a hard link then just creates another file with a link to the same underlying inode\n\nWhen you delete a file it removes one link to the underlying inode.\n\nRemember: Hard=same inode, survives deletion, no cross-FS. Soft=path pointer, breaks if deleted. "Hard=twin, Soft=shortcut."	projects/knowledge/interview/linux/045-what-is-the-difference-between-a-symbolic-link-and.txt
linux-filesystem/2dda6efa3005	linux-filesystem	medium	linux, troubleshooting	What are you using for troubleshooting and debugging disk & file system issues?	`dstat -t` is great for identifying network and disk issues.\n`opensnoop` can be used to see which files are being opened on the system (in real time).\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/179-what-are-you-using-for-troubleshooting-and-debuggi.txt
linux-filesystem/2ffd02454764	linux-filesystem	hard	linux, lvm, mount, system, xfs	How to increase the size of LVM partition?	Use the `lvextend` command for resize LVM partition.\n\n- extending the size by 500MB:\n\n```bash\nlvextend -L +500M /dev/vgroup/lvolume\n```\n\n- extending all available free space:\n\n```bash\nlvextend -l +100%FREE /dev/vgroup/lvolume\n```\n\nand `resize2fs` or `xfs_growfs` to resize filesystem:\n\n- for ext filesystems:\n\n```bash\nresize2fs /dev/vgroup/lvolume\n```\n\n- for xfs filesystem:\n\n```bash\nxfs_growfs mountpoint_for_/dev/vgroup/lvolume\n```\n\nRemember: LVM: PV→VG→LV. "Disks→pool→partitions."\n\nExample: `pvcreate /dev/sdb && vgcreate myvg /dev/sdb && lvcreate -L 10G -n mylv myvg`	projects/knowledge/interview/linux/057-how-to-increase-the-size-of-lvm-partition.txt
linux-filesystem/3634308dd7d8	linux-filesystem	easy	linux, find, locate, filesystem	What is the difference between find and locate?	Both search for files but work differently:\n\nfind:\n- Searches filesystem in real-time\n- Slower but always current\n- Flexible criteria (name, size, time, permissions)\n- find /path -name "*.txt" -mtime -7\n\nlocate:\n- Searches pre-built database\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	projects/knowledge/interview/linux/403-what-is-the-difference-between-find-and-locate.txt
linux-filesystem/36a5ee8dbbc5	linux-filesystem	medium	linux, control-flow, filesystem, text-processing	Can you check what type of filesystem is used in /home?	There are many answers for this question. One way is running `df -T`\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/214-can-you-check-what-type-of-filesystem-is-used-in-h.txt
linux-filesystem/36b7b7a81f99	linux-filesystem	medium	links, linux	True or False? You can create an hard link for a directory	False. Hard links to directories are not allowed on most Unix/Linux systems because they could create filesystem loops, making traversal (find, ls -R) ambiguous and potentially infinite.\n\nRemember: Hard link = another dir entry→same inode. Delete original, link works. No cross-FS.	projects/knowledge/interview/linux/212-true-or-false-you-can-create-an-hard-link-for-a-di.txt
linux-filesystem/38915fe50394	linux-filesystem	hard	inodes, linux, mount, system	In what circumstance can `df` and `du` disagree on available disk space? How do you solve it?	`du` checks usage of directories, but `df` checks free'd inodes, and files can be held open and take space after they're deleted.\n\n**Solution 1**\n\nCheck for files on located under mount points. Frequently if you mount a directory (say a sambafs) onto a filesystem that already had a file or directories under it, you lose the ability to see those files, but they're still consuming space on the u\n\nRemember: df=filesystem level. du=directory level. "df=room left, du=who's using it."	projects/knowledge/interview/linux/111-in-what-circumstance-can-codedfcode-and-codeducode.txt
linux-filesystem/398231093da1	linux-filesystem	easy	linux, mount, system	Why would you want to mount servers in a rack?	- Protecting Hardware\n- Proper Cooling\n- Organized Workspace\n- Better Power Management\n- Cleaner Environment\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	projects/knowledge/interview/linux/034-why-would-you-want-to-mount-servers-in-a-rack.txt
linux-filesystem/3a90f0014399	linux-filesystem	medium	linux, tar, archive	How to extract the content of an archive?	Extraction depends on archive type:\n\ntar archives:\n- tar xvf archive.tar - Plain tar\n- tar xvzf archive.tar.gz - Gzip compressed\n- tar xvjf archive.tar.bz2 - Bzip2 compressed\n- tar xvJf archive.tar.xz - XZ compressed\n- tar xvf archive.tar -C /destination - Extract to specific dir\n\nZIP:\n- unzip archive.zip\n- unzip archive.zip -d /destination\n\n7z:\n- 7z x archive.7z\n\nList contents without extracting:\n- tar tvf archive.tar\n- unzip -l archive.zip\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/385-how-to-extract-the-content-of-an-archive.txt
linux-filesystem/3b03ac26425c	linux-filesystem	easy	linux, commands, disk	How do you check free disk space in Linux?	By using df -h (shows disk filesystem usage in human-readable form).\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/557-check-free-disk-space.txt
linux-filesystem/41ee9d79bf83	linux-filesystem	medium	linux, storage, performance	How do you check disk I/O performance on Linux?	`iostat -xz 1` from the sysstat package. Key columns: `%util` (device saturation), `await` (avg I/O latency in ms), `r/s` and `w/s` (reads/writes per second), `avgqu-sz` (queue depth). The `-x` flag shows extended stats, `-z` hides idle devices, and `1` samples every second. High %util with high await indicates a disk bottleneck.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/221-how-to-check-disk-io.txt
linux-filesystem/43d0417846d1	linux-filesystem	medium	linux, lsof, troubleshooting	What does the lsof command do? Have you used it? What for?	lsof (List Open Files) shows files opened by processes.\n\nUse cases:\n1. Find what's using a file:\n   - lsof /var/log/syslog\n\n2. Find what's using a port:\n   - lsof -i :80\n   - lsof -i tcp:22\n\n3. Files opened by process:\n   - lsof -p PID\n   - lsof -c nginx\n\n4. Find deleted but held files:\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/402-what-the-lsof-command-does-have-you-used-it-what-f.txt
linux-filesystem/4a9a9e8ab2ba	linux-filesystem	hard	linux, storage, performance, troubleshooting, io	System freezes for 30-60 seconds randomly. SSH hangs. No kernel panic. Why?	This is almost always block layer stalls causing D state process accumulation.\n\nRoot causes:\n1. Journal commit waits - ext4/XFS waiting for journal flush\n2. SAN timeouts - iSCSI/FC target not responding\n3. NFS hangs - server unreachable or slow\n4. Dying disk - controller retry storms\n5.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/505-system-freeze-30-60-seconds.txt
linux-filesystem/4e0455c73efa	linux-filesystem	easy	linux, filesystem	What is the home directory subdirectory used for?	It stores individual user files and settings.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/555-home-directory-purpose.txt
linux-filesystem/509c88038f53	linux-filesystem	easy	linux, filesystem, configuration	What is /etc in Linux?	It is the directory for system-wide configuration files.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/564-what-is-etc-directory.txt
linux-filesystem/558b595912b1	linux-filesystem	medium	linux, filesystem, mount, symlink	Bind mount vs symlink?	Bind mount mirrors a directory at the VFS level—works in chroots/containers.\n\nSymlink is a path reference resolved during pathname lookup.\n\nRemember: Symlink = path pointer. Target deleted→dangling. Can cross FS and link directories.	projects/knowledge/interview/linux/539-bind-mount-vs-symlink.txt
linux-filesystem/5635721c97ff	linux-filesystem	medium	inodes, linux, storage	How does Linux handle deleted-but-open files?	When a file is deleted but still has open file descriptors, the directory entry is removed but disk space is NOT reclaimed until ALL file descriptors are closed.\n\nThe inode and data blocks remain allocated until reference count reaches zero.\n\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/455-how-does-linux-handle-deleted-but-open-files.txt
linux-filesystem/68af63e54722	linux-filesystem	medium	linux, mount	How to check which disks are currently mounted?	Run `mount` with no arguments to list all currently mounted filesystems, their mount points, types, and options. For a cleaner view, use `findmnt` which displays the mount tree, or parse `/proc/mounts` directly.\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	projects/knowledge/interview/linux/209-how-to-check-which-disks-are-currently-mounted.txt
linux-filesystem/68f58c208de3	linux-filesystem	hard	linux, filesystem, disk-space, lsof, troubleshooting	You deleted an active log file (e.g. /var/log/apache2/access.log) but didn't restart the process. The file appears gone with ls, but disk space isn't freed. How do you recover the space without restarting the service?	The process still holds the open file descriptor. The file is "deleted" from the directory but the inode and data blocks remain allocated until the file descriptor is closed.\n\nRecovery steps:\n- Run `lsof +L1` or `lsof | grep deleted` to find the PID and FD number\n- Truncate the file via the proc filesystem: `truncate -s 0 /proc/<PID>/fd/<FD>`\n- Alternative: `: > /proc/<PID>/fd/<FD>` to zero i\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/509-recover-disk-space-deleted-open-file.txt
linux-filesystem/6acde7f0df48	linux-filesystem	medium	linux, storage, lvm, filesystem	Describe the process of extending a filesystem/disk	Steps depend on setup (LVM vs direct partition):\n\nWith LVM:\n1. Add space to PV (if needed): pvresize /dev/sdb\n2. Extend LV: lvextend -L +10G /dev/vg/lv\n3. Resize filesystem:\n   - ext4: resize2fs /dev/vg/lv\n   - xfs: xfs_growfs /mountpoint\n   (Can do online for most filesystems)\n\nWithout LVM:\n1. Extend partition (risky, may need unmount)\n   - parted, fdisk, or growpart\n2.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/355-describe-the-process-of-extending-a-filesystem-dis.txt
linux-filesystem/6be6392251aa	linux-filesystem	medium	linux, filesystem, troubleshooting, disk-space	Why does `df` show free space but writes fail with "no space left"?	Common causes: inode exhaustion (`df -i`), reserved blocks, deleted files held open, or quotas.\n\nRemember: `df -h`=sizes, `df -i`=inodes. "df = Disk Free."	projects/knowledge/interview/linux/540-df-free-but-writes-fail.txt
linux-filesystem/6de9e9fba65e	linux-filesystem	easy	linux, devices, filesystem	In which path can you find the system devices (e.g. block storage)?	System devices are found in several locations:\n\n1. /dev - Device files (block and character devices)\n   - Block: /dev/sda, /dev/nvme0n1\n   - Created by udev dynamically\n\n2. /sys - Sysfs virtual filesystem\n   - /sys/block/ - Block devices\n   - /sys/class/ - Device classes\n   - /sys/devices/ - Device hierarchy\n\n3. /proc - Process and system info\n   - /proc/devices - Registered devices\n   - /proc/partitions - Partition table\n\nCommands: lsblk, blkid, ls /sys/block/\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	projects/knowledge/interview/linux/330-in-which-path-can-you-find-the-system-devices-eg-b.txt
linux-filesystem/72f9039babe9	linux-filesystem	easy	linux, filesystem, links, inode	Hard link vs soft link?	Hard link: another directory entry to the same inode (same filesystem only).\n\nSoft link: file containing a path; can cross filesystems.\n\nRemember: Hard=same inode, survives deletion, no cross-FS. Soft=path pointer, breaks if deleted. "Hard=twin, Soft=shortcut."	projects/knowledge/interview/linux/541-hard-link-vs-soft-link.txt
linux-filesystem/75b7c0fda3b3	linux-filesystem	medium	linux, mount	You run the mount command but you get no output. How would you check what mounts you have on your system?	`cat /proc/mounts` shows all mounted filesystems even when the `mount` command produces no output. Alternatives: `findmnt` (tree view), `mount | column -t` (tabular), or `df -hT` (with filesystem types and sizes). \nGotcha: `/proc/mounts` is a symlink to `/proc/self/mounts` and shows the mount namespace of the calling process.	projects/knowledge/interview/linux/210-you-run-the-mount-command-but-you-get-no-output-ho.txt
linux-filesystem/83a1f7eff3da	linux-filesystem	hard	btrfs, linux, lvm, system, troubleshooting	Tell me about the dangers and caveats of LVM.	**Risks of using LVM**\n\n- Vulnerable to write caching issues with SSD or VM hypervisor\n- Harder to recover data due to more complex on-disk structures\n- Harder to resize filesystems correctly\n- Snapshots are hard to use, slow and buggy\n- Requires some skill to configure correctly given these issues\n\nRemember: LVM: PV→VG→LV. "Disks→pool→partitions."\n\nExample: `pvcreate /dev/sdb && vgcreate myvg /dev/sdb && lvcreate -L 10G -n mylv myvg`	projects/knowledge/interview/linux/092-tell-me-about-the-dangers-and-caveats-of-lvm.txt
linux-filesystem/83d4ae26d40d	linux-filesystem	medium	linux, mount, system	Explain the `/proc` filesystem.	`/proc` is a virtual file system that provides detailed information about kernel, hardware and running processes.\n\nSince `/proc` contains virtual files, it is called virtual file system. These virtual files have unique qualities. Most of them are listed as zero bytes in size.\n\n\nRemember: /proc=process/kernel info. /sys=device/driver. Both virtual — no disk used.	projects/knowledge/interview/linux/052-explain-the-codeproccode-filesystem.txt
linux-filesystem/893240a72db1	linux-filesystem	medium	linux, filesystem, lsof, troubleshooting	How do you find what's holding a deleted file open (preventing disk space from being freed)?	Use `lsof +L1` to list files with a link count < 1.\n\nFix by restarting or killing the process, or truncating via `/proc/<pid>/fd/<fd>`.\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	projects/knowledge/interview/linux/535-find-deleted-file-held-open.txt
linux-filesystem/99435695ada5	linux-filesystem	hard	linux, system	What is a file descriptor in Linux?	In Unix and related computer operating systems, a file descriptor (FD, less frequently fildes) is an abstract indicator (handle) used to access a file or other input/output resource, such as a pipe or network socket. File descriptors form part of the POSIX application programming interface.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/097-what-is-a-file-descriptor-in-linux.txt
linux-filesystem/9dc5714fc266	linux-filesystem	hard	linux, storage, data-integrity, raid, filesystem	Filesystem reports clean, RAID reports clean, but application data is corrupted. How is this possible?	Traditional filesystems and RAID don't protect against silent data corruption.\n\nRoot causes:\n1. Bit rot - random bit flips in storage media\n2. DMA errors - data corrupted during transfer\n3. Bad RAM - corruption before data reaches disk\n4. Write cache without battery backup - partial writes on power loss\n5.\n\nRemember: 0=stripe, 1=mirror, 5=parity(min 3), 10=mirror+stripe. "0=Speed, 1=Mirror, 5=Parity."	projects/knowledge/interview/linux/503-fs-clean-raid-clean-data-corrupt.txt
linux-filesystem/9f6bc3245286	linux-filesystem	easy	linux, filesystem, links	True or False? You can create a soft link between different filesystems.	TRUE.\n\nSoft links (symbolic links):\n- Can cross filesystem boundaries\n- Just a file containing a path\n- Works across partitions, NFS, etc.\n- ln -s /mnt/disk2/file /home/user/link\n\nHard links:\n- CANNOT cross filesystem boundaries\n- Share same inode\n- Must be on same filesystem\n- ln /path/file /path/hardlink\n\nThis is a key difference between soft and hard links.\n\nRemember: Symlink = path pointer. Target deleted→dangling. Can cross FS and link directories.	projects/knowledge/interview/linux/347-true-or-false-you-can-create-a-soft-link-between-d.txt
linux-filesystem/a9a9c8f1d3bc	linux-filesystem	easy	linux, filesystem, umount	What is lazy umount in Linux and when would you use it?	Lazy umount (umount -l) detaches filesystem immediately but cleans up when no longer busy.\n\nNormal umount fails if filesystem is busy (files open, processes using it).\n\nLazy umount:\n- Immediately removes from namespace\n- New processes can't access\n- Existing file handles continue working\n- Actually unmounts when all references close\n\nUsage: umount -l /mnt/stuck\n\n\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	projects/knowledge/interview/linux/356-what-is-lazy-umount.txt
linux-filesystem/abf13d92e77e	linux-filesystem	medium	linux, package-management	Why do we need package managers? Why not simply creating archives and publish them?	Package managers allow you to manage packages lifecycle as in installing, removing and updating the packages. \nIn addition, you can specify in a spec how a certain package will be installed - where to copy the files, which commands to run prior to the installation, post the installation, etc.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/264-why-do-we-need-package-managers-why-not-simply-cre.txt
linux-filesystem/affccc0ffd48	linux-filesystem	easy	linux, filesystem, commands	Describe three different ways to remove a file or directory	Multiple methods to remove files/directories:\n\n1. rm command:\n   - rm file - Remove file\n   - rm -r directory - Remove directory recursively\n   - rm -rf directory - Force remove without prompts\n\n2. unlink command:\n   - unlink file - Remove single file\n   - Cannot remove directories\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/410-describe-three-different-ways-to-remove-a-file-or-.txt
linux-filesystem/b3b84b8a6e6e	linux-filesystem	easy	linux, troubleshooting	What is a file descriptor? What file descriptors are you familiar with?	Kerberos\nFile descriptor, also known as file handler, is a unique number which identifies an open file in the operating system.\n\nIn Linux (and Unix) the first three file descriptors are:\n\n  * 0 - the default data stream for input\n  * 1 - the default data stream for output\n  * 2 - the default data stream for output related to errors\n\nThis is a great article on the topic: https://www.computerhope.com/jargon/f/file-descriptor.htm\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/245-what-is-a-file-descriptor-what-file-descriptors-ar.txt
linux-filesystem/b48202084644	linux-filesystem	hard	linux, zfs, btrfs, data-integrity, storage	Why can Btrfs/ZFS still corrupt data even with checksums?	Checksums only detect corruption after it happens - they can't prevent all corruption paths.\n\nCorruption vectors that bypass checksums:\n\n1. Bad memory before checksum calculation\n   - Data corrupted in RAM before ZFS/Btrfs sees it\n   - Checksum calculated on already-bad data\n   - ECC memory is the only fix\n\n2.\n\nRemember: ext4=default/mature. XFS=RHEL/large files. Btrfs=COW/snapshots/compression.	projects/knowledge/interview/linux/504-btrfs-zfs-still-corrupt.txt
linux-filesystem/b504bb9aa361	linux-filesystem	medium	ext4, inodes, linux, storage, xfs	What causes sudden disk full with "no files"?	Several possibilities when `df` shows full but `du` shows less:\n\n1. **Deleted-but-open files**: Most common. `lsof +L1` to find.\n\n2. **Inode exhaustion**: `df -i` - millions of tiny files can exhaust inodes before space.\n\n3. **Journal growth**: ext4/XFS journals can grow large.\n\n4. **Reserved blocks**: ext4 reserves 5% for root by default (`tune2fs -m`).\n\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/456-what-causes-sudden-disk-full-with-no-files.txt
linux-filesystem/b90e0f401c1d	linux-filesystem	medium	linux, filesystem, processes	What makes /proc different from other filesystems?	/proc is a special virtual filesystem in Unix-like operating systems, including Linux, that provides information about processes and system resources.\n\nRemember: /proc=process/kernel info. /sys=device/driver. Both virtual — no disk used.	projects/knowledge/interview/linux/155-what-makes-proc-different-from-other-filesystems.txt
linux-filesystem/b942d8b20df2	linux-filesystem	hard	linux, raid, storage	What is RAID used for? Can you explain the different RAID levels?	RAID (Redundant Array of Independent Disks) combines disks for performance and/or redundancy.\n\nCommon levels:\n- RAID 0: Striping, no redundancy. Fast but risky.\n- RAID 1: Mirroring. 2 disks, survives 1 failure.\n- RAID 5: Striping with parity. Min 3 disks, survives 1 failure.\n- RAID 6: Double parity. Min 4 disks, survives 2 failures.\n\n\nRemember: 0=stripe, 1=mirror, 5=parity(min 3), 10=mirror+stripe. "0=Speed, 1=Mirror, 5=Parity."	projects/knowledge/interview/linux/354-what-raid-is-used-for-can-you-explain-the-differen.txt
linux-filesystem/bf298573edb7	linux-filesystem	medium	inodes, linux, mount, system	What is an inode? How to find file's inode number and how can you use it?	An **inode** is a data structure on a filesystem on Linux and other Unix-like operating systems that stores all the information about a file except its name and its actual data. A data structure is a way of storing data so that it can be used efficiently.\n\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	projects/knowledge/interview/linux/054-what-is-an-inode-how-to-find-files-inode-number-an.txt
linux-filesystem/c81d4696945b	linux-filesystem	medium	inodes, linux, permissions	What is an inode in Linux and what metadata does it store?	For each file (and directory) in Linux there is an inode, a data structure which stores meta data\nrelated to the file like its size, owner, permissions, etc.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	projects/knowledge/interview/linux/207-whats-an-inode.txt
linux-filesystem/cadea865ae10	linux-filesystem	medium	ext4, linux, storage, troubleshooting, xfs	ext4 vs XFS - when do you choose each?	**XFS**:\n* Large files and scale (media, databases, logs)\n* Better parallel I/O performance\n* Excellent for large filesystems (100TB+)\n* Caveat: Cannot shrink - only grow\n\n**ext4**:\n* General purpose, simpler recovery\n\nRemember: ext4=default/mature. XFS=RHEL/large files. Btrfs=COW/snapshots/compression.	projects/knowledge/interview/linux/454-ext4-vs-xfs-when-do-you-choose-each.txt
linux-filesystem/cf05a5db7610	linux-filesystem	medium	linux, filesystem, links	What is the difference between a hard link and a soft (symbolic) link?	A hard link is an additional name for the same file (points directly to the same inode/data), whereas a soft link is a special file that points to another file path (like a shortcut).\n\nRemember: Hard=same inode, survives deletion, no cross-FS. Soft=path pointer, breaks if deleted. "Hard=twin, Soft=shortcut."	projects/knowledge/interview/linux/561-hard-link-vs-soft-link.txt
linux-filesystem/d02037b16d39	linux-filesystem	easy	linux, filesystem	What is the primary purpose of the /etc directory?	It contains system configuration files edited by administrators.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/554-purpose-of-etc-directory.txt
linux-filesystem/d5d8fdc3b125	linux-filesystem	easy	linux, filesystem, links	What happens when you delete the original file in a soft link?	The soft link becomes a "dangling" or "broken" link.\n\nBehavior:\n- The symlink file still exists\n- It points to a non-existent path\n- Accessing it gives "No such file or directory"\n- ls -l shows the link in red (broken)\n\nExample:\n- ln -s /tmp/original /tmp/link\n- rm /tmp/original\n- cat /tmp/link → Error: No such file or directory\n\nWith hard links: File data persists until ALL hard links are deleted (reference counting via inode link count).\n\nRemember: Symlink = path pointer. Target deleted→dangling. Can cross FS and link directories.	projects/knowledge/interview/linux/348-what-happens-when-you-delete-the-original-file-in-.txt
linux-filesystem/d74c16925721	linux-filesystem	easy	linux, filesystem	In Linux FHS (Filesystem Hierarchy Standard) what is the /?	In the Linux Filesystem Hierarchy Standard (FHS), `/` is the root directory — the top of the entire filesystem tree. All other directories branch from it. Key subdirectories: `/etc` (configuration), `/var` (variable data and logs), `/tmp` (temporary files), `/opt` (third-party software), `/home` (user directories), `/usr` (user programs).	projects/knowledge/interview/linux/151-in-linux-fhs-filesystem-hierarchy-standard-what-is.txt
linux-filesystem/d7943e6e2d3f	linux-filesystem	medium	linux, filesystem, troubleshooting	You are trying to create a new file but you get "File system is full". You check with df and find there's free space. What could be the issue?	The filesystem likely ran out of inodes, not disk space.\n\nCause:\n- Each file requires an inode (metadata structure)\n- Inodes are fixed at filesystem creation\n- Many small files can exhaust inodes before space\n\nDiagnosis:\n- df -i - Shows inode usage\n- Look for IUse% near 100%\n\nSolutions:\n\nRemember: `df -h`=sizes, `df -i`=inodes. "df = Disk Free."	projects/knowledge/interview/linux/350-you-are-trying-to-create-a-new-file-but-you-get-fi.txt
linux-filesystem/d997d92543f2	linux-filesystem	medium	ext4, linux, system	Explain three types of journaling in ext3/ext4.	There are three types of journaling available in **ext3/ext4** file systems:\n\n- **Journal** - metadata and content are saved in the journal\n- **Ordered** - only metadata is saved in the journal. Metadata are  journaled only after writing the content to disk. This is the default\n- **Writeback** - only metadata is saved in the journal. Metadata might be  journaled either before or after the content is written to the disk\n\nRemember: ext4=default/mature. XFS=RHEL/large files. Btrfs=COW/snapshots/compression.	projects/knowledge/interview/linux/053-explain-three-types-of-journaling-in-ext3ext4.txt
linux-filesystem/e8c87fa30d2c	linux-filesystem	hard	linux, storage, system	Explain dirty pages and writeback in Linux	Dirty pages are memory pages modified but not yet written to disk.\n\n**How it works**:\n* Writes go to page cache first (fast)\n* Kernel marks pages "dirty"\n* Background writeback flushes to disk asynchronously\n* Sync forces immediate flush\n\n**Key tunables** (`/proc/sys/vm/`):\n* `dirty_background_ratio`: Start background writeback at this % of memory (default 10%)\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/462-explain-dirty-pages-and-writeback.txt
linux-filesystem/ea81d7a36e22	linux-filesystem	easy	linux, filesystem	What does the /bin directory contain?	Essential binary commands needed to boot the system.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/556-bin-directory-contents.txt
linux-filesystem/eac30171cea7	linux-filesystem	medium	inodes, linux	Which of the following is not included in inode:	File name (it's part of the directory file)\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	projects/knowledge/interview/linux/208-which-of-the-following-is-not-included-in-inode-li.txt
linux-filesystem/ead6aca13e5b	linux-filesystem	easy	linux, raid, system	What is RAID? What is RAID0, RAID1, RAID5, RAID6, RAID10?	A **RAID** (Redundant Array of Inexpensive Disks) is a technology that is used to increase the performance and/or reliability of data storage.\n\n- **RAID0**: Also known as disk **striping**, is a technique that breaks up a file and spreads the data across all the disk drives in a RAID group.\n\nRemember: 0=stripe, 1=mirror, 5=parity(min 3), 10=mirror+stripe. "0=Speed, 1=Mirror, 5=Parity."	projects/knowledge/interview/linux/032-what-is-raid-what-is-raid0-raid1-raid5-raid6-raid1.txt
linux-filesystem/ec87c026d22c	linux-filesystem	hard	linux, system, troubleshooting	Explain differences between `2>&-`, `2>/dev/null`, `|&`, `&>/dev/null`, and `>/dev/null 2>&1`.	- a **number 1** = standard out (i.e. `STDOUT`)\n- a **number 2** = standard error (i.e. `STDERR`)\n- if a number isn't explicitly given, then **number 1** is assumed by the shell (bash)\n\nFirst let's tackle the function of these.\n\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/106-explain-differences-between-code2-code-code2devnul.txt
linux-filesystem/f8252ce9e832	linux-filesystem	medium	linux, filesystem, inode	What is an inode in a Linux filesystem?	A data structure that stores metadata about a file or directory (e.g., size, permissions, timestamps).\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	projects/knowledge/interview/linux/560-what-is-inode.txt
linux-filesystem/ff1c00b03fa0	linux-filesystem	easy	inodes, links, linux	What is the difference between a soft link and hard link?	Hard link is the same file, using the same inode.\nSoft link is a shortcut to another file, using a different inode.\n\nRemember: Hard=same inode, survives deletion, no cross-FS. Soft=path pointer, breaks if deleted. "Hard=twin, Soft=shortcut."	projects/knowledge/interview/linux/211-what-is-the-difference-between-a-soft-link-and-har.txt
linux-filesystem/z1a2b3c4d5e6	linux-filesystem	easy	linux,proc,pseudo-filesystem	What kind of filesystem is /proc and what does it contain?	/proc is a pseudo-filesystem (virtual, not on disk) that exposes kernel and per-process state as readable files. It contains CPU info, memory stats, and per-PID directories with process details.\n\nRemember: /proc=process/kernel info. /sys=device/driver. Both virtual — no disk used.	zines/bite.size.linux.cleaned.notes
linux-filesystem/10605803e5e9	linux-filesystem	medium	miscellaneous, control-flow, filesystem, logging	How do you determine the appropriate amount of resources (CPU, RAM, storage) for a new server deployment?	• Requirements Analysis: Collaborate with stakeholders to gather and analyze requirements, understanding the anticipated workload, user base, and performance expectations. • Performance Benchmarking: Conduct performance benchmarking of similar applications or services to estimate resource needs based on historical data or industry benchmarks. • Capacity Planning: Utilize capacity planning methodologies to forecast resource requirements, considering factors such as growth projections and seasonal variations in demand.\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	
linux-filesystem/a1c2e3f4a5b6	linux-filesystem	easy	filesystem, lsblk, block-devices	What command shows the block device hierarchy including partitions and their mount points?	lsblk. It displays all block devices in a tree format showing relationships between disks, partitions, and LVM volumes, along with their mount points, sizes, and types.\n\nRemember: /etc(config), /var(data/logs), /tmp(temp), /opt(third-party), /home(users).	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/b2d3f4a5b6c7	linux-filesystem	easy	filesystem, df, disk-usage	How do you check filesystem usage in a human-readable format?	df -h. The -h flag shows sizes in human-readable units (KB, MB, GB). It displays total size, used space, available space, use percentage, and mount point for each mounted filesystem.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/c3e4a5b6c7d8	linux-filesystem	easy	filesystem, blkid, uuid	Why should you use UUIDs instead of /dev/sdX device names in /etc/fstab, and how do you find a UUID?	Device names like /dev/sdX can change between reboots (e.g., when disks are added or removed). UUIDs are persistent identifiers tied to the filesystem. Use the blkid command to show filesystem UUIDs and types.\n\nRemember: fstab fields: device, mount, type, options, dump, check. "DMTODC."\n\nGotcha: Typo → boot failure. Test: `mount -a`. Use `nofail` for non-critical mounts.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/d4f5b6c7d8e9	linux-filesystem	medium	filesystem, ext4, xfs, comparison	What are the key differences between ext4 and XFS filesystems?	ext4 is the safe default for general use: mature, well-tested, supports online resize (grow only). XFS excels at large files and parallel I/O, making it better for large-scale storage and high-throughput workloads. XFS cannot be shrunk, only grown. Btrfs adds snapshots and checksums but is less proven in production.\n\nRemember: ext4=default/mature. XFS=RHEL/large files. Btrfs=COW/snapshots/compression.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/e5a6c7d8e9f0	linux-filesystem	medium	filesystem, mkfs, creation	How do you create a filesystem on a partition, and what precaution should you take?	Use mkfs.<type> (e.g., mkfs.ext4 /dev/sda1 or mkfs.xfs /dev/sdb1). Precaution: mkfs destroys all existing data on the partition. Always verify the target device with lsblk or blkid before running mkfs to avoid formatting the wrong device.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/f6b7d8e9f0a1	linux-filesystem	medium	filesystem, lvm, concepts	Explain the three-layer LVM abstraction: Physical Volumes, Volume Groups, and Logical Volumes.	Physical Volumes (PVs) are raw disks or partitions initialized for LVM. Volume Groups (VGs) pool one or more PVs into a single storage pool. Logical Volumes (LVs) are carved from VGs and are what you format and mount. This enables flexible resizing, snapshots, and spanning across multiple disks.\n\nRemember: LVM: PV→VG→LV. "Disks→pool→partitions."\n\nExample: `pvcreate /dev/sdb && vgcreate myvg /dev/sdb && lvcreate -L 10G -n mylv myvg`	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/a7c8e9f0a1b2	linux-filesystem	medium	filesystem, partitioning, gpt-mbr	What is the difference between GPT and MBR partition schemes, and which tools manage them?	MBR is legacy: supports up to 4 primary partitions and 2TB max disk size. GPT is modern: supports up to 128 partitions and disks larger than 2TB. Use fdisk for MBR, gdisk for GPT, or parted for both. GPT is recommended for all new systems.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/b8d9f0a1b2c3	linux-filesystem	medium	filesystem, du, disk-usage	How do you find which directories are consuming the most disk space?	Use du -sh /path/* to show disk usage summary for each item in a directory. du -sh --max-depth=1 / shows top-level directory sizes. Sort with du -sh /path/* | sort -rh to find the largest consumers first.\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/c9e0a1b2c3d4	linux-filesystem	hard	filesystem, fstab, mount-options	What are the key fields in an /etc/fstab entry, and what does a typical line look like?	An fstab entry has 6 fields: device (UUID preferred), mount point, filesystem type, mount options, dump flag (0/1), fsck pass order (0/1/2). Example: UUID=abc-123 /data ext4 defaults,noatime 0 2. The fsck pass order determines check order at boot (0=skip, 1=root, 2=other).\n\nRemember: fstab fields: device, mount, type, options, dump, check. "DMTODC."\n\nGotcha: Typo → boot failure. Test: `mount -a`. Use `nofail` for non-critical mounts.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/d0f1b2c3d4e5	linux-filesystem	hard	filesystem, device-mapper, storage-stack	Describe the Linux storage stack from application down to hardware.	Application -> Filesystem (ext4, xfs, btrfs) -> Device Mapper / LVM / mdadm (optional layers) -> Block Device (/dev/sda, /dev/nvme0n1) -> Hardware (SATA, SAS, NVMe, virtio). Device Mapper is the kernel framework underlying LVM, dm-crypt (encryption), and multipath. Each layer adds capability and complexity.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/e1a2c3d4e5f6	linux-filesystem	hard	filesystem, mdadm, raid	What RAID levels does Linux software RAID (mdadm) support, and when would you use each?	RAID 1 (mirror): two copies of data, good for boot drives and small critical volumes. RAID 5 (parity): striping with one parity disk, good read performance, can survive one disk failure. RAID 10 (mirror+stripe): combines mirroring and striping, best performance and redundancy, requires minimum 4 disks. Use mdadm to create and manage software RAID arrays.\n\nRemember: 0=stripe, 1=mirror, 5=parity(min 3), 10=mirror+stripe. "0=Speed, 1=Mirror, 5=Parity."	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/a1b2c3d4e5f6	linux-filesystem	easy	inodes, linux, filesystem	What command shows inode usage per mounted filesystem?	`df -i` — shows inode usage (total, used, free, percentage) per mounted filesystem. When inode usage hits 100%, you can't create new files even if disk space remains.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/b2c3d4e5f6a1	linux-filesystem	easy	inodes, linux, metadata	What information does an inode store?	File metadata: type, permissions, owner (UID/GID), size, timestamps (atime/mtime/ctime), hard link count, and pointers to data blocks. It does NOT store the filename or file contents.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/c3d4e5f6a1b2	linux-filesystem	easy	inodes, linux, commands	How do you display the inode number of a file?	Use ls -i filename or stat filename.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/d4e5f6a1b2c3	linux-filesystem	medium	inodes, linux, troubleshooting	A server reports "No space left on device" but df -h shows 40% free disk space. What is the most likely cause and how do you confirm it?	Inode exhaustion. Confirm with df -i — if IUse% is 100%, all inodes are consumed and no new files can be created despite free disk space.\n\nRemember: `df -h`=sizes, `df -i`=inodes. "df = Disk Free."	training/library/topics/inodes/primer.md
linux-filesystem/e5f6a1b2c3d4	linux-filesystem	medium	inodes, linux, troubleshooting	How do you find which directory is consuming the most inodes on a filesystem?	find / -xdev -printf '%h\n' | sort | uniq -c | sort -rn | head — this counts files per directory, staying on the same filesystem (-xdev), and shows the top offenders.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/f6a1b2c3d4e5	linux-filesystem	medium	inodes, linux, filesystem	Why should you use find /path -type f -delete instead of rm -rf * to clean up millions of small files?	Shell glob expansion in rm -rf * will fail with "Argument list too long" when a directory contains millions of files. find -delete processes files one at a time without shell expansion.\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	training/library/topics/inodes/primer.md
linux-filesystem/a7b8c9d0e1f2	linux-filesystem	medium	inodes, linux, filesystem, mkfs	How do you create an ext4 filesystem with more inodes than the default?	Use mkfs.ext4 -N <count> to set an explicit inode count, or mkfs.ext4 -i <bytes> to set the bytes-per-inode ratio (lower value = more inodes). The default is one inode per 16384 bytes.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/b8c9d0e1f2a7	linux-filesystem	hard	inodes, linux, links	From an inode perspective, what is the difference between a hard link and a symbolic link? Which one consumes an additional inode?	A hard link is an additional directory entry pointing to the same inode — it does NOT consume a new inode. A symbolic link is a separate file with its own inode whose content is the target path — it DOES consume an additional inode. Therefore, millions of symlinks can cause inode exhaustion while millions of hard links cannot.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/c9d0e1f2a7b8	linux-filesystem	hard	inodes, linux, filesystem	When is an inode's data actually freed on a Linux filesystem?	When both conditions are met: the hard link count reaches 0 (no directory entries reference the inode) AND no process has the file open. A deleted file with an open file descriptor continues to occupy disk space until the process closes it.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/d0e1f2a7b8c9	linux-filesystem	hard	inodes, linux, filesystem, ext4, xfs	Can you increase the number of inodes on an existing ext4 filesystem without reformatting? How does XFS handle this differently?	No — ext4 inode count is fixed at mkfs time and cannot be changed without reformatting. XFS allocates inodes dynamically by default, so it rarely hits inode exhaustion. However, XFS can still exhaust inodes on large filesystems if the inode64 mount option is not enabled.\n\nRemember: Inode = metadata (perms, size, timestamps, blocks) but NOT filename.\n\nGotcha: Out of inodes before disk space with millions of tiny files. Check: `df -i`.	training/library/topics/inodes/primer.md
linux-filesystem/a3f1c8e07b24	linux-filesystem	easy	mount, commands	What command shows all current mounts in a tree view?	findmnt — it displays all mounts in a hierarchical tree with source device, filesystem type, and options.\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/b7d2e4f19a06	linux-filesystem	easy	mount, commands, lsblk	How do you find the UUID of a block device?	Use blkid or lsblk -f. Both show UUID, filesystem type, and label for all block devices.\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/c9e5a1d38f72	linux-filesystem	easy	fstab, boot	What are the six fields in an /etc/fstab entry?	Device (UUID/path), mount point, filesystem type, options, dump flag (0/1), and fsck pass order (0/1/2).\n\nRemember: fstab fields: device, mount, type, options, dump, check. "DMTODC."\n\nGotcha: Typo → boot failure. Test: `mount -a`. Use `nofail` for non-critical mounts.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/d4b8f2c61e09	linux-filesystem	easy	mount, umount	What does umount -l (lazy unmount) do?	It immediately detaches the filesystem from the mount point but defers cleanup until all references to it are released. Useful when a normal umount returns "device is busy."\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/e1a7d3b58c40	linux-filesystem	medium	fstab, nofail, boot	What happens if an fstab entry lacks the nofail option and the device is unavailable at boot?	The system blocks during boot waiting for the device, potentially rendering the server unbootable. Adding nofail tells systemd to continue boot even if the mount fails.\n\nRemember: fstab fields: device, mount, type, options, dump, check. "DMTODC."\n\nGotcha: Typo → boot failure. Test: `mount -a`. Use `nofail` for non-critical mounts.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/f6c0e9a23d18	linux-filesystem	medium	nfs, troubleshooting	What is the difference between hard and soft NFS mount options?	hard (default) retries indefinitely — processes hang until the server returns. soft gives up after retrans retries and returns an I/O error to the application.\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/0a4e7b1c9f53	linux-filesystem	medium	mount, troubleshooting, fuser	How do you find which processes are preventing a filesystem from being unmounted?	Use fuser -vm /mount/point to list processes with open files, current directories, or executables on the filesystem. Alternatively, lsof +D /mount/point shows all open file descriptors.\n\nExample: `find /var/log -name '*.log' -mtime +30 -delete` — delete old logs.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/1d5f8e2a7b96	linux-filesystem	medium	fstab, nfs, netdev	Why must NFS entries in fstab include the _netdev option?	Without _netdev, systemd attempts to mount the NFS share before the network is up, causing the mount to fail or hang during boot.\n\nRemember: fstab fields: device, mount, type, options, dump, check. "DMTODC."\n\nGotcha: Typo → boot failure. Test: `mount -a`. Use `nofail` for non-critical mounts.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/2b9c0d4e6a81	linux-filesystem	hard	mount, bind, containers	How do you create a read-only bind mount, and why does it require two steps?	First: mount --bind /src /dest. Then: mount -o remount,bind,ro /dest. The initial bind mount ignores ro in the options — you must remount to enforce read-only. Bind mounts are heavily used in containers for volume mounts.\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/3e7a1f5c8d02	linux-filesystem	hard	mount, remount, emergency	When would you remount a filesystem read-only on a running system, and how?	Use mount -o remount,ro /path when the filesystem shows corruption (prevent further damage), before taking an LVM snapshot, or during emergency disk diagnostics. This avoids a full unmount when processes hold references.\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/4f8b2c6d0e93	linux-filesystem	hard	fstab, recovery, boot	Describe the recovery procedure when a bad fstab entry prevents a Linux server from booting.	Boot into single-user mode or a rescue disk. Remount root read-write with mount -o remount,rw /. Edit /etc/fstab to comment out or fix the bad entry. Reboot normally. Prevention: always run mount -a to test fstab changes before rebooting.\n\nRemember: fstab fields: device, mount, type, options, dump, check. "DMTODC."\n\nGotcha: Typo → boot failure. Test: `mount -a`. Use `nofail` for non-critical mounts.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/5c1d3e7f9a04	linux-filesystem	hard	nfs, troubleshooting, diagnostics	How do you diagnose a hung NFS mount on a Linux client?	Check for processes in uninterruptible sleep (D state) with ps aux | grep " D ". Review NFS client statistics with nfsstat -c. Inspect /proc/self/mountstats for stuck operations. Verify server availability with showmount -e and rpcinfo -p. If soft-mounted, the application gets I/O errors; if hard-mounted, processes block until the server recovers or you force-unmount with umount -f.\n\nExample: `mount -t ext4 /dev/sdb1 /mnt/data`. View: `mount | column -t` or `findmnt`.	training/library/topics/mounts-filesystems/primer.md
linux-filesystem/8887193b	linux-filesystem	easy	disk-troubleshooting, lsblk, block-devices	How do you display the block device hierarchy including disk types, sizes, and mount points?	lsblk shows all block devices in a tree format. It displays the relationship between physical disks, partitions, LVM logical volumes, and their mount points. Add -f to also show filesystem types and UUIDs.\n\nRemember: /etc(config), /var(data/logs), /tmp(temp), /opt(third-party), /home(users).	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/b2c3d4e5f6a7	linux-filesystem	easy	disk-troubleshooting, blkid, uuid	What does the blkid command show, and why is it important for troubleshooting?	blkid shows filesystem UUIDs, types (ext4, xfs, etc.), and labels for all block devices. It is critical for troubleshooting because /etc/fstab should use UUIDs (not /dev/sdX names which can change between reboots), and blkid helps you identify which device corresponds to which UUID.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/c3d4e5f6a7b8	linux-filesystem	easy	disk-troubleshooting, df, du, space	What is the difference between df and du, and when would you use each for disk troubleshooting?	df -h shows filesystem-level usage (total, used, available, mount point) -- use it to identify which filesystem is full. du -sh /path/* shows directory-level usage -- use it to drill down and find which directories or files are consuming the most space. They complement each other: df for the overview, du for the details.\n\nRemember: df=filesystem level. du=directory level. "df=room left, du=who's using it."	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/d4e5f6a7b8c9	linux-filesystem	medium	disk-troubleshooting, iostat, performance	How do you use iostat to diagnose disk I/O performance problems?	iostat -xz 1 shows per-device I/O statistics updated every second. Key columns: %util (device utilization -- >70% on spinning disk means saturated), await (average I/O latency in ms -- what apps feel), r/s and w/s (read/write operations per second), rrqm/s and wrqm/s (merged requests). On NVMe, %util is misleading due to parallel queues.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/e5f6a7b8c9d0	linux-filesystem	medium	disk-troubleshooting, iotop, process-io	How do you identify which process is generating the most disk I/O?	Use iotop -oP to show per-process I/O in real-time, displaying only processes actually performing I/O (-o flag). It shows read and write bandwidth per process, helping you pinpoint which application is causing disk pressure.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/f6a7b8c9d0e1	linux-filesystem	medium	disk-troubleshooting, fstab, mount-failure	A server fails to boot because of an /etc/fstab entry. What are the likely causes and how do you fix it?	Common causes: wrong UUID (disk replaced or reformatted), missing device, typo in mount point or filesystem type. Fix: boot into single-user mode or rescue media, edit /etc/fstab to correct the entry (use blkid to verify UUIDs), or add nofail mount option to prevent boot failure on missing devices. Always test with mount -a after editing fstab.\n\nRemember: fstab fields: device, mount, type, options, dump, check. "DMTODC."\n\nGotcha: Typo → boot failure. Test: `mount -a`. Use `nofail` for non-critical mounts.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/ebfd4d07	linux-filesystem	medium	disk-troubleshooting, device-names, persistence	Why do /dev/sdX device names change between reboots, and what should you use instead?	/dev/sdX names are assigned by the kernel based on device detection order, which can change when disks are added, removed, or detected in a different sequence. Use UUIDs (from blkid) or filesystem labels in /etc/fstab and scripts. UUIDs are tied to the filesystem and persist regardless of detection order.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/b8c9d0e1f2a3	linux-filesystem	medium	disk-troubleshooting, lvm, status	How do you quickly check the status of LVM physical volumes, volume groups, and logical volumes?	Use pvs (Physical Volume summary), vgs (Volume Group summary), and lvs (Logical Volume summary). These give a one-line-per-item overview of your LVM configuration including sizes, free space, and status. For detailed info, use pvdisplay, vgdisplay, and lvdisplay.\n\nRemember: LVM: PV→VG→LV. "Disks→pool→partitions."\n\nExample: `pvcreate /dev/sdb && vgcreate myvg /dev/sdb && lvcreate -L 10G -n mylv myvg`	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/c9d0e1f2a3b4	linux-filesystem	hard	disk-troubleshooting, device-mapper, layers	What is the Device Mapper in Linux, and which storage technologies depend on it?	Device Mapper is a kernel framework that provides a generic way to create virtual block devices mapped onto real ones. It underpins LVM (logical volume management), dm-crypt (disk encryption via LUKS), and multipath (redundant storage paths). Understanding Device Mapper helps when debugging why a device is not appearing or performing as expected.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/d0e1f2a3b4c5	linux-filesystem	hard	disk-troubleshooting, partitioning, recovery	You need to replace a failed disk in a Linux software RAID array. What is the general procedure?	1) Identify the failed disk with mdadm --detail /dev/mdX or cat /proc/mdstat. 2) Remove the failed disk: mdadm --manage /dev/mdX --remove /dev/sdY. 3) Physically replace the disk. 4) Partition the new disk to match the array layout. 5) Add the new disk: mdadm --manage /dev/mdX --add /dev/sdZ. 6) Monitor rebuild: watch cat /proc/mdstat. The array runs degraded during rebuild.\n\nExample: `du -sh /var/log/*` — size per item. `du -sh --max-depth=1 /` for overview.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/e1f2a3b4c5d6	linux-filesystem	hard	disk-troubleshooting, io-scheduler, tuning	How do you check and change the I/O scheduler for a block device, and which scheduler is best for NVMe vs spinning disk?	Check: cat /sys/block/sda/queue/scheduler. Change: echo deadline > /sys/block/sda/queue/scheduler. For spinning disks, deadline or mq-deadline reduces latency for database workloads. For NVMe, use none (no scheduler) since NVMe has its own internal parallelism and scheduling. Set nr_requests to increase queue depth for high-throughput workloads.\n\nExample: `du -sh /var/log/*` — size per item. `du -sh --max-depth=1 /` for overview.	training/library/topics/linux-ops-storage/primer.md
linux-filesystem/273e6fd74659	linux-filesystem	medium	linux, system	You have the task of sync the testing and production environments. What steps will you take?	Steps to sync testing and production environments:\n\n1. **Snapshot production**: Create DB dump and disk/VM snapshots\n2. **Restore to test**: Import snapshots into testing environment\n3. **Sanitize data**: Remove/mask sensitive data (PII, credentials)\n4. **Sync packages**: Match OS and application versions\n5. **Update configs**: Adjust environment-specific settings (hostnames, endpoints, credentials)\n6. **Verify**: Run smoke tests to confirm parity\n\nKey principle: Only production is production. Use infrastructure-as-code and deploy scripts to minimize drift.\n\nExample: `du -sh /var/log/*` — size per item. `du -sh --max-depth=1 /` for overview.	projects/knowledge/interview/linux/081-you-have-the-task-of-sync-the-testing-and-producti.txt
linux-filesystem/37ff5f3eec15	linux-filesystem	medium	linux, system	Can you give a particular example when is indicated to use `nobody` account? Tell me the differences running httpd service as a `nobody` and `www-data` accounts.	In Unix, `nobody` is a user account that owns no files and has no special privileges. It is used to run daemons that don't need filesystem access (e.g., memcached).\n\n**nobody vs www-data for httpd:**\n- `nobody`: Shared across services. If one service is compromised, attacker gains access to all nobody-owned processes\n- `www-data`: Application-specific user. Isolates Apache from other services. Preferred for web servers\n\nBest practice: Use per-service accounts (www-data, postgres, etc.) rather than the shared nobody account. This limits blast radius if a service is compromised.	projects/knowledge/interview/linux/070-can-you-give-a-particular-example-when-is-indicate.txt
linux-filesystem/390d9b4c7b7d	linux-filesystem	medium	linux, control-flow, filesystem, networking	Describe shortly what happens when you execute a command in the shell	The shell figures out, using the PATH variable, where the executable of the command resides in the filesystem. It then calls fork() to create a new child process for running the command. Once the fork was executed successfully, it calls a variant of exec() to execute the command and finally, waits the command to finish using wait(). When the child completes, the shell returns from wait() and prints out the prompt again.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/308-describe-shortly-what-happens-when-you-execute-a-c.txt
linux-filesystem/4a83590159d5	linux-filesystem	hard	linux, system	How to prevent `dd` from freezing your system?	Try using ionice:\n\n```bash\nionice -c3 dd if=/dev/zero of=file\n```\n\nThis start the `dd` process with the "idle" IO priority: it only gets disk time when no other process is using disk IO for a certain amount of time.\n\nOf course this can still flood the buffer cache and cause freezes while the system flushes out the cache to disk. There are tunables under `/proc/sys/vm/` to influence this, particularly the `dirty_*` entries.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/115-how-to-prevent-codeddcode-from-freezing-your-syste.txt
linux-filesystem/5f1939da0fb2	linux-filesystem	medium	linux, filesystem, permissions, storage	You try to create a file but it fails. Name at least three different reason as to why it could happen	* No more disk space\n* No more inodes\n* No permissions\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/166-you-try-to-create-a-file-but-it-fails-name-at-leas.txt
linux-filesystem/8be392850f65	linux-filesystem	medium	linux, backup, control-flow, filesystem	You executed a script and while still running, it got accidentally removed. Is it possible to restore the script while it's still running?	It is possible to restore a script while it's still running if it has been accidentally removed. The running script process still has the code in memory. You can use the /proc filesystem to retrieve the content of the running script.\n1.Find the Process ID by running \n```\nps aux | grep yourscriptname.sh\n```\nReplace yourscriptname.sh with your script name.\n2.Once you have the PID, you can access the script's memory through the /proc filesystem.\n\nRemember: Linux FS knowledge is foundational. `man hier` shows the directory hierarchy.\n\nGotcha: Back up configs before editing: `cp file file.bak`. One typo can lock you out.	projects/knowledge/interview/linux/314-you-executed-a-script-and-while-still-running-it-g.txt
linux-filesystem/96a2f77ea0d7	linux-filesystem	easy	linux, man, documentation	Why are there different sections in man? What is the difference?	Man pages are organized into numbered sections by topic.\n\nSections:\n1. User commands (ls, cp, cat)\n2. System calls (open, read, fork)\n3. Library functions (printf, malloc)\n4. Special files (/dev devices)\n5. File formats (/etc/passwd format)\n6. Games\n7. Miscellaneous (conventions, standards)\n8. System admin commands (mount, systemctl)\n\nWhy sections exist:\n- Same name in different contexts\n- Example: printf(1) command vs printf(3) C function\n- Example: passwd(1) command vs passwd(5) file format\n\nAccess specific section:\n- man 1 printf - Command\n- man 3 printf - C function\n- man 5 passwd - File format\n\nFind all:\n- man -k keyword - Search descriptions\n- man -f command - List all sections	projects/knowledge/interview/linux/428-why-there-are-different-sections-in-man-what-is-th.txt

<!-- wiki:related:start -->
---

## Wiki Navigation

### Related Content

- [Case Study: Disk Full Root Services Down](../../../../library/case-studies/datacenter_ops/disk-full-root-services-down/README.md) (Case Study, L1) — Filesystems & Storage
- [Case Study: NVMe Drive Disappeared](../../../../library/case-studies/datacenter_ops/nvme-drive-disappeared/README.md) (Case Study, L2) — Filesystems & Storage
- [Case Study: Runaway Logs Fill Disk](../../../../library/case-studies/linux_ops/runaway-logs-fill-disk/README.md) (Case Study, L1) — Filesystems & Storage
- [Case Study: Stuck NFS Mount](../../../../library/case-studies/linux_ops/stuck-nfs-mount/README.md) (Case Study, L2) — Filesystems & Storage
- [Deep Dive: Linux Filesystem Internals](../../../../library/deep-dives/linux.filesystem.internals.md) (deep_dive, L2) — Filesystems & Storage
- [Deep Dive: Linux Performance Debugging](../../../../library/deep-dives/linux.performance.debugging.md) (deep_dive, L2) — Filesystems & Storage
- [Disk & Storage Ops](../../../../library/topics/disk-and-storage-ops/index.md) (Topic Pack, L1) — Filesystems & Storage
- [Inodes](../../../../library/topics/inodes/index.md) (Topic Pack, L1) — Filesystems & Storage
- Inodes Flashcards *(CLI)* (flashcard_deck, L1) — Filesystems & Storage
- [Kernel Troubleshooting](../../../../library/topics/kernel-troubleshooting/index.md) (Topic Pack, L3) — Filesystems & Storage

<!-- wiki:related:end -->
