Filesystems, Mounting & fstab
Creating & Mounting Filesystems
| FS | Notes |
|---|---|
ext4 | Long-standing Linux default, journaling |
xfs | RHEL default, great for large files |
btrfs | Snapshots, subvolumes |
vfat/exfat | Cross-platform removable media |
$ mkfs.ext4 /dev/sdb1 # create a filesystem
$ mkdir /data
$ mount /dev/sdb1 /data # mount temporarily
$ umount /data # unmount
Persistent mounts - /etc/fstab
Each line: <device> <mountpoint> <fstype> <options> <dump> <pass>
UUID=1234-5678 /data ext4 defaults 0 2
- Prefer UUID (from
blkid) over/dev/sdX- device names can change. - Test without rebooting:
mount -amounts everything in fstab. pass= fsck order:0skip,1root,2others.
Exam trap: A bad/etc/fstabcan leave a system unbootable. Alwaysmount -aafter editing to catch errors before rebooting.