Cyber Services / All lessons / CentOS / Linux Administration / Linux File Systems Quick Reference

Linux File Systems Quick Reference

Module 16 of 33 · 1 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Block Devices

  • Storage hardware represented in /dev
  • /dev/sda, /dev/sdb: Physical disks
  • /dev/sda1, /dev/sdb2: Partitions
  • /dev/sr0: Optical drives

Inspection Commands

lsblk
lsblk -f
df -hT

File Systems

  • XFS: Default for CentOS/RHEL
  • ext4: Common on Debian/Ubuntu
  • FAT32/NTFS: Windows compatibility
  • NFS: Network file system

Creation Command

sudo mkfs.xfs /dev/sdb1
Formatting erases all data on the partition!

Mounting

Temporary Mount

sudo mount /dev/sdb1 /mnt/data
sudo umount /mnt/data

Persistent Mount (/etc/fstab)

UUID="..." /data xfs defaults,noatime 0 0
Always backup fstab before editing!
Test with: sudo mount -a

File Search Tools

locate (Fast, uses database)

sudo updatedb
locate filename

find (Powerful, real-time)

find /path -name "*.conf"
find /var -type f -mtime -7
find /tmp -size +10M -exec rm {} \;

find Criteria Examples

find . -name "pattern"
find /path -type f (or d)
find /var -mtime -7
find /tmp -size +100M
find /home -user john
find . -perm 644

Practical Workflow

Adding a New Disk

  1. Identify disk: lsblk
  2. Partition: sudo fdisk /dev/sdb
  3. Format: sudo mkfs.xfs /dev/sdb1
  4. Create mount point: sudo mkdir /data
  5. Get UUID: sudo blkid /dev/sdb1
  6. Add to fstab using UUID
  7. Test: sudo mount -a
Modules (33) ← CentOS / Linux Administration