4 Ways to View Disks and Partitions in Linux

As an open-source operating system, Linux provides various tools and commands that allow users to manage their disk and partition configurations. Whether you're a system administrator or a casual user, understanding how to view disk and partition information is essential for system maintenance and troubleshooting.

Using fdisk Command

The fdisk command is a powerful command-line utility that displays detailed partition table information. It shows disk geometry, partition types, and sector information for storage devices.

To view all partitions on a specific disk, use the -l (list) option

sudo fdisk -l /dev/sda

This command displays comprehensive information including disk size, sector size, partition layout, and file system types. The output shows each partition's starting and ending sectors, size, and partition type ID.

To view partitions of a specific type only, use the -t option

sudo fdisk -l -t 83

Using lsblk Command

The lsblk command provides a tree-like view of all block devices, making it easy to understand the hierarchical relationship between disks and their partitions. It displays information in a clean, readable format without requiring root privileges for basic viewing.

To display all block devices in the system

lsblk

For customized output showing specific information, use the -o option

lsblk -o NAME,SIZE,MOUNTPOINT,FSTYPE /dev/sda

This command displays device names, sizes, mount points, and file system types in a clear columnar format.

Using blkid Command

The blkid command specializes in displaying file system information, including UUIDs, labels, and file system types. This information is crucial for mounting partitions and writing fstab entries.

To view information for all partitions

sudo blkid

For a specific partition

sudo blkid /dev/sda2

The -p option provides machine-readable output, useful for scripting

sudo blkid -p /dev/sd*

Using GParted Tool

GParted is a graphical partition editor that provides an intuitive interface for viewing and managing disk partitions. It's particularly useful for users who prefer visual tools over command-line interfaces.

First, install GParted using your distribution's package manager, then launch it

sudo gparted

GParted displays a graphical representation of all storage devices and their partitions. You can easily see partition sizes, file system types, and unused space. The tool also allows you to perform partition operations like resizing, creating, and deleting partitions.

Additional Useful Commands

The df command shows disk usage for mounted file systems

df -h

The parted command provides an alternative to fdisk with support for larger disks

sudo parted -l

Comparison of Methods

Tool Interface Best For Root Required
fdisk Command-line Detailed partition information Yes
lsblk Command-line Hierarchical device view No (for viewing)
blkid Command-line File system identification Yes
GParted Graphical Visual partition management Yes

Conclusion

Linux offers multiple approaches to view disk and partition information, each with its own strengths. Command-line tools like fdisk, lsblk, and blkid provide detailed system information and are ideal for scripting, while GParted offers a user-friendly graphical interface for visual partition management.

Updated on: 2026-03-17T09:01:38+05:30

66K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements