Linux/Unix Tutorial
Estimated reading: 3 minutes 279 views

Linux/Unix: Storage, Archiving & Compression – Tools, Mounting, Disk Space & Compression Explained

Introduction – Master Storage & Space Management in Linux

Linux and Unix systems offer powerful tools for managing disks, mounting partitions, tracking disk usage, and compressing files for archiving or transmission. Whether you’re a developer, sysadmin, or power user, understanding these commands is essential for effective space management and backup strategies.

In this guide, you’ll learn:

  • How to inspect drives and partitions
  • How to mount and unmount storage volumes
  • How to track file and directory disk usage
  • How to compress and extract files using tar, gzip, zip, and more

Topics Covered

Subtopic Description
Storage Tools (lsblk, blkid, etc.)Identify disks, partitions, and their properties
Mounting (mount, umount)Attach or detach filesystems to directories
Disk Usage (df, du)Check space availability on filesystems and usage by files/directories
Compression Tools (tar, gzip, etc.)Archive, compress, or extract files with popular formats

Linux/Unix: Storage Tools (lsblk, blkid, fdisk, parted)

lsblk – List Block Devices

lsblk

Shows all connected disks and partitions in a tree-like format.


blkid – View Partition UUIDs & File Systems

blkid

fdisk – Partition Table Editor (MBR)

sudo fdisk /dev/sda

Useful for viewing and editing MBR partition tables.


parted – Manage GPT & Large Drives

sudo parted /dev/sda

Linux/Unix: Mounting (mount, umount)

mount – Mount a File System

sudo mount /dev/sdb1 /mnt

Attaches the partition /dev/sdb1 to /mnt.


umount – Unmount a Mounted Volume

sudo umount /mnt

View All Mounts

mount | column -t

Create and Mount ISO

sudo mount -o loop file.iso /mnt

Linux/Unix: Disk Usage (df, du)

df – View Filesystem Disk Space

df -h

Shows space usage on each mounted partition in human-readable format.


du – Estimate File/Folder Space

du -sh /home/user/*

Useful for identifying large directories.


Linux/Unix: Compression Tools (tar, gzip, zip, bzip2, xz, 7z)

tar – Archive Multiple Files

tar -cvf archive.tar file1 file2
tar -xvf archive.tar

gzip / gunzip – Compress Single File

gzip file.txt
gunzip file.txt.gz

zip / unzip – Portable Compression

zip archive.zip file1 file2
unzip archive.zip

bzip2 / xz – Better Compression Ratios

bzip2 file.txt
xz file.txt

7z – High-Ratio Archiving (needs p7zip package)

7z a archive.7z file1 file2
7z x archive.7z

Summary – Recap & Next Steps

Linux provides an efficient suite of commands for analyzing storage, managing disk usage, and archiving data. These tools are essential for system maintenance, backups, and keeping your file systems optimized and organized.

Key Takeaways:

  • Use lsblk and blkid to identify drives and partitions.
  • Use mount and umount to attach or detach volumes.
  • Monitor space with df and inspect heavy files with du.
  • Compress and extract files using tar, gzip, zip, xz, and 7z.

Real-World Applications:

  • Back up a project directory with tar.gz
  • Mount external drives or ISO files
  • Analyze disk usage to prevent system overload
  • Share files efficiently using compressed archives

Frequently Asked Questions

What is the difference between df and du?
df shows disk space for mounted filesystems. du shows space used by individual files or directories.


Which compression tool gives the best compression?
xz and 7z often give higher compression than gzip or zip, but may take longer.


How can I mount an ISO file in Linux?
Use:

sudo mount -o loop file.iso /mnt

Can I extract .zip files without a GUI?
Yes, use the unzip command in the terminal.


Is fdisk safe to use on a running system?
It’s safe for viewing partitions, but avoid changes unless you understand the risks.


Share Now :
Share

πŸ’Ύ Linux/Unix: Storage, Archiving & Compression

Or Copy Link

CONTENTS
Scroll to Top