How to List Disks in Ubuntu: A Complete Beginner’s Guide

Welcome to your ultimate guide on how to list disks in Ubuntu!

While Ubuntu’s graphical interface is fantastic, using the terminal is often a faster and more powerful way to manage your system’s hardware.

If you need to find a USB drive, check your hard drive space, or get a detailed report on your storage devices, you’re in the right place.

Knowing how to check your disks is a crucial skill for any Ubuntu user.

It’s essential for system maintenance, partitioning new drives, and troubleshooting storage issues.

This guide will walk you through four simple, built-in commands to do just that.

First, How Ubuntu Names Your Drives

Before we open the terminal, let’s quickly understand how your Ubuntu system identifies storage devices.

Instead of the “C:” drive you might see in Windows, Ubuntu uses a file-based system.

All your hardware devices can be found in the /dev/ directory. Storage drives typically follow this naming convention:

  • /dev/sdX: The standard naming for most SATA hard drives (HDDs), solid-state drives (SSDs), and USB flash drives. The X is a letter (a, b, c…) that represents the drive’s order. /dev/sda is usually your main system drive.
  • /dev/nvmeXnY: This is the name for modern NVMe SSDs, which connect directly to the motherboard for incredible speeds.
  • Partitions: When you see a number at the end (e.g., /dev/sda1), this indicates a specific partition on that drive. Partitions are like creating separate, logical sections on a single physical disk.

With that knowledge, let’s explore the commands available right in your Ubuntu terminal.

See also: Mastering the Linux Command Line — Your Complete Free Training Guide

Quick Comparison: Which Command Should You Use in Ubuntu?

CommandBest ForOutput Style
lsblkA quick, easy-to-read tree view of all disks and partitions.Clean & Hierarchical
fdisk -lDetailed partition table information for a specific disk.Technical & Verbose
df -hChecking used and available space on mounted filesystems.Simple & Readable Table
parted -lA comprehensive overview of disk models and partition layouts.Detailed & Powerful

Method 1: The lsblk Command (The Best All-Rounder)

The lsblk (list block devices) command is your best friend for a quick overview. It comes pre-installed on Ubuntu and displays all your storage devices in a clean, tree-like structure.

Open your terminal (you can use the shortcut Ctrl+Alt+T) and run:

lsblk

The output makes it easy to see the relationship between disks and their partitions:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0   512M  0 part /boot/efi
└─sda2        8:2    0 465.3G  0 part /
sdb           8:16   1  57.7G  0 disk
└─sdb1        8:17   1  57.7G  0 part /media/user/SANDISK

Pro Tip: For more details, like the filesystem type (e.g., ext4) and UUID, use the -f flag. This is useful for editing system files like /etc/fstab.

lsblk -f

Best for: Getting a quick, readable map of all storage devices on your Ubuntu system.


Method 2: The fdisk -l Command (The Classic Inspector)

For a deeper, more technical dive into your disk’s partition tables, fdisk is a classic Linux tool available on Ubuntu. Using fdisk with the -l flag will list the details without any risk of making changes. As it requires elevated permissions, you must use sudo.

sudo fdisk -l

This command gives a verbose report for each disk, showing:

  • The exact disk model and total size.
  • The partition table type (e.g., GPT, the modern standard).
  • A detailed list of every partition, its start and end sectors, and its type.

Best for: When you need highly technical details about your partition tables for advanced tasks.


Method 3: The df -h Command (The Space Checker)

If your main goal is simply to see how much free space you have, the df (disk free) command is the perfect tool. The -h (human-readable) flag conveniently shows the sizes in GB, MB, etc.

df -h

This gives you a tidy table of your mounted filesystems:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       458G  120G  315G  28% /
/dev/sda1       511M  6.1M  505M   2% /boot/efi

This is the fastest way to check your available disk space in Ubuntu.

Best for: A quick, simple report on used and available space on your active partitions.


Method 4: The parted -l Command (The Powerful Alternative)

parted is another powerful utility for partition management that is included with Ubuntu. Running parted -l provides a comprehensive summary of your storage devices, much like fdisk, but some users find its output cleaner.

sudo parted -l

This command gives you a well-structured report for each disk, including the disk model, size, and a partition list with filesystem info.

For more information on its advanced features, you can refer to the official GNU parted documentation.

Best for: Ubuntu users who want a detailed report combining disk model and partition info in one command.

Now that you can identify your disks, your next step might be to format a new drive. Feel free to check out our guide on how to format a USB drive in Ubuntu.

Frequently Asked Questions (FAQ)

Q: How do I find a specific USB drive in the Ubuntu terminal? A: The easiest method is to run lsblk just before and just after you plug in the USB drive. The new device that appears in the list (e.g., /dev/sdb) is your USB.

Q: What if my disk doesn’t show up in Ubuntu? A: If a disk isn’t listed, first check its physical connection. For external drives, try a different USB port. You can also open Ubuntu’s “Disks” utility (a graphical tool) to see if it’s detected there. If it’s still missing, it may be a hardware failure.

Q: How can I see only hard drives in Ubuntu and not their partitions? A: Use the command lsblk -d. The -d flag tells it to list only the main disk devices, hiding the individual partitions for a cleaner view.

David Cao
David Cao

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

Articles: 545

Leave a Reply

Your email address will not be published. Required fields are marked *