To **discover drives on a Linux system**, here are several essential commands and tools you can use, each serving a slightly different purpose:
—
## β **Common Commands to Discover Drives**
### π 1. `lsblk` β List Block Devices
“`bash
lsblk
“`
– Shows all disks and partitions in a tree-like structure.
– Great overview of drive names, sizes, and mount points.
Add `-f` to show file system info:
“`bash
lsblk -f
“`
—
### π§Ύ 2. `fdisk -l` β Detailed Disk Info
“`bash
sudo fdisk -l
“`
– Lists all partitions on all detected drives.
– Shows partition sizes and types.
– Useful for both internal and external drives.
—
### π§© 3. `blkid` β Show UUIDs and File Systems
“`bash
sudo blkid
“`
– Shows block devices with UUIDs and file system types.
– Helps with identifying drives for mounting.
—
### π¦ 4. `df -h` β Show Mounted Drives and Usage
“`bash
df -h
“`
– Displays all mounted file systems with used/available space.
– Doesnβt show unmounted drives.
—
### π 5. `ls /dev/sd*` β List Disk Device Files
“`bash
ls /dev/sd*
“`
– Lists devices like `/dev/sda`, `/dev/sdb1`, etc.
– NVMe drives will appear as `/dev/nvme0n1`, `/dev/nvme0n1p1`, etc.
—
### π₯οΈ 6. `lshw -class disk` β Hardware Info
“`bash
sudo lshw -class disk
“`
– Detailed info including vendor, size, and bus type (e.g., SATA, NVMe).
You can also run:
“`bash
sudo lshw -short | grep disk
“`
—
### π§ 7. `dmesg` β Kernel Messages for Drive Detection
“`bash
dmesg | grep -i sd
“`
– Useful after plugging in a new drive to see detection logs.
—
### π 8. For USB or External Drives
“`bash
lsusb
“`
– Lists connected USB devices (including external drives).
—
### Optional Tools for GUI or Interactive Use
– **`gnome-disks`** β Disk utility for GNOME (GUI).
– **`ncdu`** β For analyzing disk space in terminal.
– **`parted`**, **`gparted`** β Tools for partition management.
—
Let me know if you’re trying to find **new, unmounted drives**, or preparing to **mount or format a new disk**, and Iβll guide you step by step.