Filesystem and Devices
Filesystem and Devices tests creating, mounting, checking, growing and limiting filesystems, plus the device interfaces that expose kernel state.
Rules and tools
mkfs.ext4andmkfs.xfscreate filesystems;e2fsckchecks ext4 andxfs_repairchecks XFS. Check ext4 offline or read-only.- ext4 grows online with
resize2fs; XFS grows withxfs_growfson the mountpoint and cannot shrink. /etc/fstabfields are device, mountpoint, type, options, dump, pass. PreferUUID=fromblkidover kernel device names.mount -o remount,ro /changes state;mount -avalidates fstab;noatimereduces metadata writes.- Swap:
mkswap,swapon,swapoff; fstab entrynone swap sw 0 0. - Quotas need
usrquota/grpquotamount options,quotacheck -cug,quotaon, thenedquotaandrepquota. - udev rules live in
/etc/udev/rules.d;/procand/sysare kernel interfaces, not ordinary files.
Worked example
An ext4 filesystem on /dev/vg/data, mounted at /data, is full. Run lvextend -L +10G /dev/vg/data, then resize2fs /dev/vg/data while mounted. If it were XFS, use xfs_growfs /data instead. Reasoning: the block device must grow first, then the filesystem; ext4 supports online growth, while XFS grows to the device size via its mountpoint.
Traps
- Running
fsckon a mounted read-write filesystem. - Relying on
/dev/sdbnames that can reorder. - Forgetting quota mount options or the fstab pass field.
- Trying to shrink XFS.