Operations 10 min read

Master Linux Storage Management: Devices, Mounting, Partitioning & Quotas

This guide walks through Linux storage fundamentals—including device identification, viewing, mounting (temporary and permanent), file searching, disk partitioning methods, swap setup, device removal, and disk quota configuration—providing practical commands and best‑practice tips for system administrators.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux Storage Management: Devices, Mounting, Partitioning & Quotas

1. Device Inspection

Use the following commands to inspect devices: fdisk -l – view disk partition information lsblk – display block device usage blkid – show device IDs and management methods df – list currently mounted devices cat /proc/partitions – view system‑recognized devices

2. Device Mounting

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

mount -o <em>options</em> <em>device</em> <em>mount_point</em>
umount <em>device|mount_point</em>    # unmount
mount                         # view mount info
mount -o rw /dev/vda1 /dir    # mount read‑write
mount -o remount,ro /dir      # remount read‑only

Note: The above are temporary mounts. For permanent mounts edit /etc/fstab:

(1) vim /etc/fstab    # edit fstab file
Device   MountPoint   FS_Type   Options   Dump   Pass
/dev/sr0 /westos      iso9660   defaults   0      0
mount -a               # reload fstab

3. Finding Files on Devices

Common find examples: find /etc/ -name passwd – locate files named passwd under /etc recursively find /etc/ -maxdepth 1 -name passwd – search only the top‑level /etc directory find /etc/ -maxdepth 2 -mindepth 2 -name passwd – search exactly one level below

/etc
find /mnt -user westos

– files owned by user westos find /mnt -user westos -o -user lee – files owned by westos OR lee find /mnt -user westos -a -group lee – files owned by westos AND belonging to group lee find /mnt -type d – list directories find /mnt -perm 111 – files with exact permission 111 find /mnt -perm -111 – files where all three permission bits include execute find /mnt -perm /111 -type f -exec chmod ugo-x {} \\; – remove execute bits from matching regular files

4. Disk Partitioning

Standard Partitioning (MBR)

Primary partition – recorded in the partition table and directly usable

Extended partition – container for logical partitions, not directly usable

Logical partition – resides within an extended partition

Partition tools: fdisk /dev/vdb – interactive partitioning parted – supports both interactive and non‑interactive modes

Important:

After using fdisk, run the partition‑table sync command before checking with fdisk -l.

After creating partitions, format them before mounting, e.g. mkfs.xfs -K /dev/yourdisk -f (‑K speeds up formatting by not discarding empty blocks).

Swap Partition

Swap provides a disk‑based memory buffer when RAM is exhausted. Commands:

swapon -s                     # view swap info
# Create swap:
# 1. Create a partition of type Linux‑swap
# 2. mkswap /dev/yourdisk       # format as swap
# 3. swapon /dev/yourdisk -p 0  # enable with priority
# To make it permanent, add to /etc/fstab:
/dev/yourdisk swap swap defaults,pri=1 0 0
swapon -a                     # activate all swaps in fstab
# To remove swap:
# Edit /etc/fstab to delete the line, then:
swapoff /dev/yourdisk

Device Deletion

Delete partitions using various methods: dd if=/dev/zero of=/dev/yourdisk bs=1M count=1 – wipe all partitions at once fdisk /dev/yourdisk – interactive delete (choose d then partition number) parted /dev/yourdisk rm <em>partition_number</em> – non‑interactive delete

Note: Unmount devices before modifying partitions.

5. Disk Quotas

Quotas limit the amount of storage a user can consume.

# Steps:
1. Create a partition and format it.
2. Enable quota on mount:
   mount /dev/yourdisk /pub -o usrquota
   quotaon -uv /dev/yourdisk
   edquota -u lee   # edit user lee's quota
3. Make quota permanent by adding to /etc/fstab:
   /dev/sda1 /pub xfs defaults,usrquota 0 0
4. Disable quota:
   quotaoff -uv /dev/yourdisk
   # remove usrquota from /etc/fstab

Important: Only modify the hard limit; other fields are system‑generated.

# Test quota:
su - lee
cd /target_dir
dd if=/dev/zero of=/target_dir/file bs=1M count=22   # should fail after 20 MiB
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
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

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.