Arch Linux Disk Utilities - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Arch Linux Disk Utilities Guide

Complete beginner-friendly guide to disk utilities on Arch Linux, including disk partitioning, formatting, disk health checks, and disk management tools.


Table of Contents

  1. Partitioning Tools
  2. Formatting Tools
  3. Disk Health
  4. Disk Cloning
  5. Troubleshooting

Partitioning Tools

fdisk

Use fdisk:

# Install fdisk
sudo pacman -S util-linux

# Partition disk
sudo fdisk /dev/sda

# Commands:
# n - new partition
# d - delete partition
# w - write changes

cfdisk

Use cfdisk:

# Install cfdisk
sudo pacman -S util-linux

# Partition disk
sudo cfdisk /dev/sda

parted

Use parted:

# Install parted
sudo pacman -S parted

# Partition disk
sudo parted /dev/sda

GParted

Install GParted:

# Install GParted
sudo pacman -S gparted

# Launch
sudo gparted

Formatting Tools

mkfs

Format partitions:

# ext4
sudo mkfs.ext4 /dev/sda1

# btrfs
sudo mkfs.btrfs /dev/sda1

# xfs
sudo mkfs.xfs /dev/sda1

# FAT32
sudo mkfs.fat -F32 /dev/sda1

Disk Health

SMART Tools

Check disk health:

# Install smartmontools
sudo pacman -S smartmontools

# Check SMART
sudo smartctl -a /dev/sda

# Short test
sudo smartctl -t short /dev/sda

# Long test
sudo smartctl -t long /dev/sda

Badblocks

Check for bad blocks:

# Install badblocks
sudo pacman -S e2fsprogs

# Check disk
sudo badblocks -v /dev/sda

Disk Cloning

dd

Clone disk:

# Clone disk
sudo dd if=/dev/sda of=/dev/sdb bs=4M status=progress

# Clone to image
sudo dd if=/dev/sda of=backup.img bs=4M status=progress

Clonezilla

Use Clonezilla:

# Download ISO from clonezilla.org
# Boot from ISO
# Follow wizard

Troubleshooting

Disk Errors

Fix errors:

# Check filesystem
sudo fsck.ext4 /dev/sda1

# Auto-repair
sudo fsck.ext4 -a /dev/sda1

Partition Table Issues

Fix partition table:

# Test partition table
sudo partprobe -s

# Re-read partition table
sudo partprobe /dev/sda

Summary

This guide covered partitioning, formatting, disk health, cloning, and troubleshooting.


Next Steps


This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.