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
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
- Identify disk: lsblk
- Partition: sudo fdisk /dev/sdb
- Format: sudo mkfs.xfs /dev/sdb1
- Create mount point: sudo mkdir /data
- Get UUID: sudo blkid /dev/sdb1
- Add to fstab using UUID
- Test: sudo mount -a