Tag: File System

Linux Disk & Filesystem: lsblk, mount, fstab, fsck

Working reference for Linux disk and filesystem management. The four-layer model (block device > partition > filesystem > mount point), lsblk for orientation, df -h vs df -i (inode exhaustion looks like out-of-space), du and ncdu for finding disk hogs, partitioning with fdisk / parted / cfdisk (and when MBR vs GPT), mkfs for ext4 / xfs / btrfs / vfat, manual mount and umount with -l lazy and lsof / fuser to find what's blocking unmount, persistent /etc/fstab (UUID-not-device, six-field syntax, mount -a to test before reboot, nofail for non-critical), the menu of mount options (noatime, nosuid, noexec), fsck only on unmounted FS, swap setup with fallocate / mkswap / swapon. Pitfalls: out of inodes, fstab blocks boot, sdX name shift, fsck on mounted, missing chmod 600 on swap.

Linux File & Directory Operations: ls, cd, cp, mv, rm, find

Working reference for the Linux file and directory commands you type thousands of times a year. ls with -l/-la/-lh/-ltr/-ld variations, the cd - bounce trick, mkdir -p for idempotent path creation, cp -a for archive-style copies (with the trailing-slash gotcha), mv for both rename and move, rm -rf danger and the safer find -print -> find -delete pattern, find by name/size/mtime/owner with -exec and -delete, locate vs find (locate is fast but stale), symbolic links with ln -s, the 10 commands that cover 95 percent of daily use, and the common pitfalls (rm -rf with unset variable, trailing-slash confusion, unquoted spaces in filenames).