2025/02/16

Topic 712: Storage Devices and BSD Filesystems

This topic covers partitioning and disk labels, creating and maintaining file systems, mounting and unmounting, managing file permissions, using links, and finding files. Understanding these fundamentals is crucial for effective BSD system administration.


712.1: BSD Partitioning and Disk Labels

gpart show           # Show partitions
disklabel -E sd0     # OpenBSD: edit disklabel on sd0
installboot          # Install bootstrap on a disk
Note on partition types

712.2: Create File Systems and Maintain Their Integrity

UFS Examples

newfs /dev/ada0p2     # Create UFS on FreeBSD
fsck -y /dev/ada0p2   # Check and repair

df -h                 # Disk usage
du -sh /home          # Show usage of /home

ZFS Examples (FreeBSD, NetBSD)

zpool create mypool /dev/ada1   # Create ZFS pool
zpool status                    # Check pool status
zfs snapshot mypool/usr@backup  # Create snapshot
Tip: ZFS on NetBSD

NetBSD supports ZFS but might require additional configuration or kernel options depending on release. Always consult official documentation for compatibility.


712.3: Control Mounting and Unmounting of File Systems

ZFS Mounts

zfs mount mypool/usr      # Mount a ZFS filesystem
zfs unmount mypool/usr    # Unmount a ZFS filesystem
Note on mount options

712.4: Manage File Permissions and Ownership

SUID, SGID, and sticky bit

712.5: Create and Change Hard and Symbolic Links

Hard vs. soft links

712.6: Find Files and BSD Directory Layout

find / -name httpd.conf
find /var/log -type f -size +10M
find /home -mtime -1

locate config.php
locate.updatedb

whereis python
which sshd
Tips on searching