HOW TO LIST ALL CONNECTED HARD DRIVES ON UBUNTU

How to List All Connected Hard Drives on Ubuntu

How to List All Connected Hard Drives on Ubuntu

Blog Article





Ubuntu, a popular Linux distribution, provides a robust and user-friendly interface for managing connected devices, including hard drives. Whether you're a seasoned system administrator or a beginner, knowing how to list all connected hard drives is essential for monitoring and managing your system's storage. In this article, we will explore the various methods to list all connected hard drives on Ubuntu.

Method 1: Using the lsblk Command

The lsblk command is a powerful tool for listing all connected block devices, including hard drives, on your Ubuntu system. To use this command, follow these steps:

  1. Open a terminal on your Ubuntu system. You can do this by searching for "Terminal" in the applications menu or by using the keyboard shortcut Ctrl + Alt + T.

  2. Type the command lsblk and press Enter.

  3. The lsblk command will display a list of all connected block devices, including hard drives, on your system.


The output of the lsblk command will display the device name, major and minor numbers, and the device type. For example:
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 1G 0 part /boot
└─sda3 8:3 0 464.3G 0 part /
sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 128M 0 part
└─sdb2 8:18 0 1G 0 part
└─sdb3 8:19 0 930.4G 0 part

Method 2: Using the fdisk Command

The fdisk command is another useful tool for listing all connected hard drives on your Ubuntu system. To use this command, follow these steps:

  1. Open a terminal on your Ubuntu system.

  2. Type the command sudo fdisk -l and press Enter.

  3. The fdisk command will display a list of all connected hard drives on your system.


The output of the fdisk command will display detailed information about each hard drive, including the device name, size, and partition table. For example:
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 977502688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 12345678-1234-1234-1234-123456789012

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 2097151 1046528 512M Linux filesystem
/dev/sda3 2097152 977502687 975225536 465.3G Linux filesystem

Method 3: Using the df Command

The df command is a simple and easy-to-use tool for listing all connected hard drives on your Ubuntu system. To use this command, follow these steps:

  1. Open a terminal on your Ubuntu system.

  2. Type the command df -h and press Enter.

  3. The df command will display a list of all connected hard drives on your system, along with their mounted file systems and available disk space.


The output of the df command will display the device name, total size, used space, available space, and mount point for each hard drive. For example:
Filesystem      Size  Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 794M 1.5M 793M 1% /run
/dev/sda3 465G 120G 330G 27% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 512M 3.5M 509M 1% /boot/efi
/dev/sda2 1.1G 157M 936M 15% /boot

In conclusion, listing all connected hard drives on Ubuntu can be done using various methods, including the lsblk, fdisk, and df commands. Each method provides different information about the hard drives, and the choice of method depends on the specific requirements of the user. By following the steps outlined in this article, users can easily list all connected hard drives on their Ubuntu system and manage their storage effectively.

For more information on managing hard drives on Ubuntu, you can refer to the Commands.page article on listing all connected hard drives on terminal in Ubuntu.

Report this page