콘텐츠로 이동

Disk Mounting Guide

Persistent local and network mounts using /etc/fstab and, where present, systemd mount generation.

The filesystem must already exist and the device identity, ownership, backup, filesystem and init-system versions must be verified.


Prerequisites

  • Root/sudo access
  • Target disk identified (/dev/sdX)
  • Filesystem already created on the disk

Workflow

flowchart LR
    A[Identify Disk] --> B[Get UUID]
    B --> C[Create Mount Point]
    C --> D[Edit fstab]
    D --> E[Test Mount]
    E --> F[Reboot Verify]

Step-by-Step Guide

1. Identify Available Disks

# List all block devices
sudo lsblk

# Show detailed disk information
sudo fdisk -l

# Show disk partitions with filesystem types
lsblk -f

2. Get Disk UUID

# Get UUID for specific disk
sudo blkid /dev/sdX1

# Example output:
# /dev/sdb1: UUID="a1b2c3d4-5678-90ab-cdef-1234567890ab" TYPE="ext4"

3. Create Mount Point

# Create directory for mounting
sudo mkdir -p /mnt/data

# Or use descriptive name
sudo mkdir -p /mnt/storage

4. Configure Permanent Mount

Edit /etc/fstab:

sudo nano /etc/fstab

Add entry:

# Format: UUID=<uuid> <mount-point> <type> <options> <dump> <pass>
UUID=a1b2c3d4-5678-90ab-cdef-1234567890ab /mnt/data ext4 defaults 0 2

Back up /etc/fstab and edit the intended entry deliberately. Blind tee -a use can create duplicate mount points or conflicting UUID entries.

5. Test the Configuration

# Test fstab without reboot
sudo mount -a

# Verify mount
df -h | grep /mnt/data

# Check mount details
mount | grep /mnt/data

Mount Options Reference

Option Description
defaults rw, suid, dev, exec, auto, nouser, async
noatime Don't update access time (performance)
nofail Don't fail boot if device missing
ro Read-only
rw Read-write
user Allow non-root users to mount
x-systemd.automount Mount on first access

Common Configurations

SSD/NVMe (performance):

UUID=xxx /mnt/ssd ext4 defaults,noatime,discard 0 2

Network share (NFS):

server:/share /mnt/nfs nfs defaults,nofail 0 0

External drive (optional):

UUID=xxx /mnt/external ext4 defaults,nofail,x-systemd.automount 0 2


Troubleshooting

Mount Failed After Reboot

# Check fstab syntax
sudo findmnt --verify

# Check system logs
journalctl -b | grep mount

Permission Issues

# Inspect before changing ownership
namei -l /mnt/data
findmnt --target /mnt/data

# Change only the mount root when policy requires it
sudo chown "$USER:$USER" /mnt/data

Completion and rollback evidence

Run findmnt --verify, mount only the target, and confirm source/type/options plus service-account read/write behavior. Network mounts also require server-loss and recovery tests. If validation fails, unmount safely, restore the backed-up fstab, and verify again. A bad boot entry must be corrected in rescue mode, not by formatting the device.