Linux fdisk Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux fdisk Guide
Complete beginner-friendly guide to fdisk on Linux, covering Arch Linux, CachyOS, and other distributions including disk partitioning, creating partitions, and partition management.
Table of Contents
Understanding fdisk
What is fdisk?
fdisk is disk partition manipulator.
Uses:
- Create partitions: Make new partitions
- Delete partitions: Remove partitions
- Modify partitions: Change partition properties
- View partitions: List partition table
Warning:
- Data loss: Can erase data
- Backup first: Always backup important data
- Be careful: Double-check before writing
fdisk Basics
List Devices
Find disk:
# List block devices
lsblk
# Or
fdisk -l
Start fdisk
Open disk:
# Open disk for editing
sudo fdisk /dev/sda
# Interactive mode
# Type 'm' for help
Creating Partitions
Create New Partition
Steps:
# Start fdisk
sudo fdisk /dev/sda
# Create new partition
n
# Choose partition type
# p = primary, e = extended
# Partition number
# Enter number or press Enter
# First sector
# Press Enter for default
# Last sector
# Enter size (e.g., +10G) or press Enter
Write Changes
Apply changes:
# In fdisk
w
# Write partition table and exit
Managing Partitions
View Partitions
List partitions:
# In fdisk
p
# Print partition table
Delete Partition
Remove partition:
# In fdisk
d
# Select partition number
# Enter number
Change Partition Type
Modify type:
# In fdisk
t
# Select partition
# Enter hex code for type
Troubleshooting
Partition Not Showing
Update system:
# Reload partition table
sudo partprobe /dev/sda
# Or reboot
fdisk Errors
Check disk:
# Check disk
sudo fdisk -l /dev/sda
# Verify partition table
sudo sfdisk -V /dev/sda
Summary
This guide covered fdisk usage, partition creation, and disk management for Arch Linux, CachyOS, and other distributions.
Next Steps
- Disk Utilities - Disk tools
- Filesystem Management - Filesystem setup
- lsblk Guide - List devices
- fdisk Documentation:
man fdisk
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.