Your Course Progress

Topics
0 / 0
0.00%
Practice Tests
0 / 0
0.00%
Tests
0 / 0
0.00%
Assignments
0 / 0
0.00%
Content
0 / 0
0.00%
% Completed

Linux Disk Management

A Basic Guide

This article provides a beginner-friendly guide to managing disks in Linux systems. We'll explore the essential commands and best practices for viewing, formatting, and mounting drives.

Linux Disk Management

Introduction

This article provides a basic guide to disk management in Linux. We will cover how to view disks and partitions, and how to format and mount drives.

Viewing Disks and Partitions

Do You Know

Understanding your disk layout is crucial before performing any modifications.

lsblk

The lsblk command provides a tree-like view of block devices. It's a simple and efficient way to see your disks, partitions, and their sizes.

lsblk

fdisk

fdisk is a powerful tool for creating and managing partitions. Use it with caution, as incorrect usage can lead to data loss.

sudo fdisk /dev/sda

Important Note

Always back up your data before using fdisk.

Formatting and Mounting Drives

After creating partitions, they need to be formatted with a filesystem (like ext4) before they can be used.

sudo mkfs.ext4 /dev/sda1

Once formatted, the partition can be mounted to a directory.

sudo mkdir /mnt/mydrive
sudo mount /dev/sda1 /mnt/mydrive

Avoid This

Unmount a drive before unplugging it to prevent data loss or corruption.

Summary

  • lsblk shows a tree view of block devices.
  • fdisk is used to create and manage partitions.
  • Use mkfs to format partitions.
  • Use mount to mount partitions to directories.
  • Always backup data before major disk operations.

Discussion