Operations 10 min read

Master Linux Storage: Device Discovery, Mounting, Partitioning & Quotas

This guide covers essential Linux storage management techniques, including how to list devices, mount and unmount filesystems, use the find command for file searches, create and manage disk partitions, configure swap space, and set up disk quotas for user limits.

Raymond Ops
Raymond Ops
Raymond Ops
Master Linux Storage: Device Discovery, Mounting, Partitioning & Quotas

Linux Storage Management Basics

Storage management is a fundamental topic in Linux, covering device identification, viewing, mounting, file location, and disk partitioning.

1. Device Viewing

Use commands to inspect devices:

fdisk -l   # view partition table
lsblk     # show block devices
blkid     # display device IDs
df        # list mounted filesystems
cat /proc/partitions   # view system-recognized devices

2. Device Mounting

Only devices with a system ID can be used. Basic mount commands:

mount -o [options] device mount_point
umount device|mount_point   # unmount

Example:

mount -o rw /dev/vda1 /dir
mount -o remount,ro /dir   # remount read‑only

When a device is busy, use:

fuser -kvm device|mount_point   # kill processes, show details

Temporary mounts are performed with the above commands; permanent mounts are defined in /etc/fstab: vim /etc/fstab # edit fstab After editing, apply with: mount -a # reload fstab Incorrect fstab entries can prevent boot; comment out errors and reboot.

3. Finding Files on Devices

Common find examples: find /etc/ -name passwd Search only the /etc directory (no subdirectories): find /etc/ -maxdepth 1 -name passwd Search one level deep: find /etc/ -maxdepth 2 -name passwd Search only subdirectories: find /etc/ -maxdepth 2 -mindepth 2 -name passwd Search files owned by a specific user: find /mnt -user westos Combine conditions with OR or AND:

find /mnt -user westos -o -user lee   # OR
find /mnt -user westos -a -group lee   # AND

Search by type, permission, and execute actions:

find /mnt -type d                     # directories
find /mnt -perm 111                   # exact permission 111
find /mnt -perm -111                  # at least these bits
find /mnt -perm /111                  # any of the bits
find /mnt -perm /111 -type f -exec chmod ugo-x {} \;

4. Disk Partitioning

Standard Partitions

MBR partition scheme includes primary, extended, and logical partitions.

Primary partitions are directly usable; extended partitions act as containers for logical partitions.

Partitioning tools:

fdisk /dev/vdb   # interactive partitioning
parted           # non‑interactive or interactive mode

After creating partitions with fdisk, synchronize the partition table before listing: partprobe # or re‑run fdisk -l Format new partitions before mounting, e.g. XFS:

mkfs.xfs -K /dev/<disk_name>   # -K speeds up formatting

Swap Partition

Swap provides a memory buffer when RAM is exhausted. swapon -s # view swap Create swap:

mkswap /dev/<disk_name>       # format as swap
swapon /dev/<disk_name> -p 0  # enable with priority

Make swap permanent by adding to /etc/fstab:

vim /etc/fstab   # add: /dev/<disk_name> swap swap defaults,pri=1 0 0
swapon -a        # apply

Remove swap by editing /etc/fstab and running swapoff.

Device Deletion

Delete partitions using:

dd if=/dev/zero of=/dev/<disk_name> bs=1M count=1   # wipe partition table
fdisk /dev/<disk_name>   # interactive delete (d)
parted                  # non‑interactive delete with rm

5. Disk Quotas

Quotas limit the amount of space a user can consume.

mount /dev/<disk_name> /pub/ -o usrquota   # enable quota on mount
quotaon -uv /dev/<disk_name>               # activate
edquota -u lee                            # edit user quota

Typical edquota output shows soft and hard limits for blocks and inodes.

Make quotas permanent by adding usrquota to /etc/fstab:

vim /etc/fstab   # /dev/sda1 /pub xfs defaults,usrquota 0 0

Disable with quotaoff -uv /dev/<disk_name> and remove the option from /etc/fstab.

Test quota by attempting to write beyond the limit, e.g. using dd if=/dev/zero of=/path/file bs=1M count=22, which should fail after reaching the soft limit.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PartitioningSwapStorage ManagementDisk QuotaMounting
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.