Click ▲Follow "CU Technology Community" and mark the official account with a star
More exciting first time direct
In this article, I will show you how to list the disks (ie SSDs, HDDs, USB drives) connected to your computer from Ubuntu.
**Use the lsblk command: **
You can use the lsblk command to list all connected disks on your computer from Ubuntu as follows:
$ sudo lsblk
A TYPE disk is a disk physically connected on the computer.
The TYPE part is the partition of the disk.
The lsblk command without any filters shows many loop devices used by the Ubuntu snap application. I know this is annoying, but fortunately, you can easily remove them from the list.
You can use the -e7 option with lsblk to hide the loop device.
$ sudo lsblk -e7
Now that the loop device is gone, the list now looks clearer.
You can also use grep to perform the same operation.
$ sudo lsblk | grep -v '^loop'
You can also hide CD/DVD rom devices from the list. Just add -e11 option and -e7 option together.
$ sudo lsblk -e7 -e11
You can also use lsblk to list the connected disks on your computer and their vendor and model information, as shown below:
$ sudo lsblk --scsi
As you can see, all connected disks on my computer are listed. Also listed their supplier and model information.
**Use the fdisk command: **
You can also use the fdisk command to list all connected disks on your computer from Ubuntu, as shown below:
$ sudo fdisk -l
fdisk displays all disks, the total size of the disk, partitions, the size of each partition, etc. But the list is too long, there is no easy way to hide the loop device.
However, if you know the device name of the disk (ie sda, sdb), you can easily find more information about this device using fdisk.
$ sudo fdisk -l / dev / sdb
You can also use fdisk to find information about multiple disks at the same time. Just put the disk paths as fdisk parameters one by one.
$ sudo fdisk -l / dev / sda / dev / sdb
**Use the parted command: **
You can use parted to do the same thing. By default, parted may not be installed on Ubuntu. But you can easily install it with the following command:
$ sudo apt install parted -y
For all storage disks connected to the computer, you can get fdisk similar to the output, as shown below:
$ sudo parted -l
As you can see, the output format is the same as in fdisk, but parted does not list annoying loop devices. This is a good thing.
Use GNOME Disk Application:
If you don't like using the command line, you can use many graphical programs to list the disks on Ubuntu.
GNOME Disk is the default partitioning application on the GNOME desktop environment. You can use it to list the disks connected to your computer.
First, open "GNOME Disk" from the "Applications" menu.
The GNOME disk should open. On the left, you will see all connected storage devices/disks on your computer. To find more information about the disk, click to select the disk. The disk size, partitions, and other information about the disk should be listed on the right.
Use the GParted app:
If you don't like the command line, you can also use the GParted Partition Editor application to list all connected disks on your computer.
GParted is not installed by default on Ubuntu. But you can easily install GParted with the following command:
$ sudo apt install gparted -y
GParted should be installed.
You can now launch GParted from the "Applications" menu.
In order to use GParted, you will need super user permissions. Enter your login password and click Authenticate.
GParted should start. You can select a disk from the drop-down menu in the upper right corner of GParted.
As you can see, all the disks connected to my computer are listed in the drop-down menu. Just select a disk from the list.
The partition of the selected disk should be displayed.
This is how you list all the connected disks of Ubuntu on your computer.
I have shown some common methods in this article. If you know of any other way to list disks on Ubuntu, you can write it in the comments.
Only good-looking people can order
Recommended Posts