List volume in linux

How to list disks, partitions and filesystems in Linux? [duplicate]

In Windows, if you type LIST DISK using DiskPart in a command prompt it lists all physical storage devices, plus their size, format, etc. What is the equivalent of this in Linux?

3 Answers 3

There are many tools for that, for example fdisk -l or parted -l , but probably the most handy is lsblk (aka list block devices):

Example

$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 238.5G 0 disk ├─sda1 8:1 0 200M 0 part /boot/efi ├─sda2 8:2 0 500M 0 part /boot └─sda3 8:3 0 237.8G 0 part ├─fedora-root 253:0 0 50G 0 lvm / ├─fedora-swap 253:1 0 2G 0 lvm [SWAP] └─fedora-home 253:2 0 185.9G 0 lvm 

It has many additional options, for example to show filesystems, labels, etc. As always man lsblk is your friend.

@Dor it is worth explaining what additional options do, if you are recommending their use. -f or —fs shows the information about filesystems, such as format, crypto, raid member, etc. It is somewhat slower than the default though.

You’ll like this : you can do sudo lsblk —scsi and this shows the disk types including name(sda,sdb. ), scsi addr, type,vendor, model, rev, .. it’s easy to find which is which when you want to physically locate the disk.

Another way to quickly see the filesystems is the command df. On my machine (Finnish localization) it shows like this:

ptakala@athlon:/mnt$ df Tiedostojärjestelmä 1K-lohkot Käyt Vapaana Käy% Liitospiste /dev/root 38317204 19601752 16762352 54% / devtmpfs 4063816 0 4063816 0% /dev tmpfs 4097592 81988 4015604 3% /dev/shm tmpfs 4097592 10120 4087472 1% /run tmpfs 5120 8 5112 1% /run/lock tmpfs 4097592 0 4097592 0% /sys/fs/cgroup /dev/sda9 535267140 287403688 220666804 57% /work /dev/sda7 288239836 201635356 71956016 74% /home tmpfs 819520 4 819516 1% /run/user/113 tmpfs 819520 8 819512 1% /run/user/1000 /dev/sda1 39070048 37083304 1986744 95% /mnt/sda1 /dev/sda10 22662140 14032580 8629560 62% /mnt/sda10 /dev/sda5 29280176 20578032 8702144 71% /mnt/sda5 

It won’t show the file system type, but usually that is non-essential, and you see by one eyedrop everything needed.

ptakala@athlon:/mnt$ df -h Tiedostojärjestelmä Koko Käyt Vapaa Käy% Liitospiste /dev/root 37G 19G 16G 54% / devtmpfs 3,9G 0 3,9G 0% /dev tmpfs 4,0G 89M 3,9G 3% /dev/shm tmpfs 4,0G 9,9M 3,9G 1% /run tmpfs 5,0M 8,0K 5,0M 1% /run/lock tmpfs 4,0G 0 4,0G 0% /sys/fs/cgroup /dev/sda9 511G 275G 211G 57% /work /dev/sda7 275G 193G 69G 74% /home tmpfs 801M 4,0K 801M 1% /run/user/113 tmpfs 801M 8,0K 801M 1% /run/user/1000 /dev/sda1 38G 36G 1,9G 95% /mnt/sda1 /dev/sda10 22G 14G 8,3G 62% /mnt/sda10 /dev/sda5 28G 20G 8,3G 71% /mnt/sda5 

Источник

4 Ways to View Disks and Partitions in Linux

In this guide, we will show how to list storage disks and partitions in Linux systems. We will cover both command-line tools and GUI utilities. By the end of this guide, you will learn how to view or report information about disks and partitions on your Linux server or desktop computer, or workstation.

Читайте также:  Запрет чтения файла linux

1. List Linux Disks Using fdisk Command

fdisk is a widely-used command-line tool for manipulating disk partition tables. You can use it to view disks and partitions on your Linux server as follows.

The -l flag implies list partitions, if no device is specified, fdisk will display partitions from all disks. It requires root privileges for you to invoke it, so use the sudo command where necessary:

Check Linux Disk Partitions

2. View Linux Disk Partitions Using lsblk Command

lsblk is a utility for listing block devices. You can use it to view disks and partitions on your Linux computer as follows. It runs well without the sudo command:

View Linux Disk Partitions

To view extra information about disks, use the -f command line option as shown:

View Linux Partitions Info

3. View Linux Disks Using hwinfo Command

hwinfo is another useful utility for viewing information about your hardware, particularly storage disks. If you can not find the hwinfo command on your system, run the following command to install it:

$ sudo apt install hwinfo [On Debian, Ubuntu and Mint] $ sudo yum install hwinfo [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a sys-apps/hwinfo [On Gentoo Linux] $ sudo pacman -S hwinfo [On Arch Linux] $ sudo zypper install hwinfo [On OpenSUSE]

Once you have the hwinfo package installed, run the command with the —disk command line option as shown:

View Linux Disk Information

From the output of the previous command, there is a lot of information about a disk or its partitions that hwinfo displays. If you wish to view an overview of block devices, run this command:

View Linux Disks Overview

To show a summary of all disks, run the command:

List Summary of Linux Disks

4. Find Linux Partitions Information Using Disk Tool

On a Linux desktop computer, you can also use a graphical user interface (GUI) application to view a list of disks attached to your computer. First, search for disks application in the system menu. Then open it to view your disks and their partitions.

Find Linux Disk Partitions Info

That’s all for now. For more information about the commands used in this guide, check out their man pages. You can also share your thoughts with us via the comment form below.

Источник

List Disks on Ubuntu

You can list all the attached disks on your computer from Ubuntu using the lsblk command as follows:

The ones with the TYPE disk are the physically attached disks on your computer.

The ones with the TYPE part are the partitions of the disks.

The lsblk command without any filter shows a lot of loop devices that are used by the Ubuntu snap apps. It is annoying I know. Luckily, you can easily get rid of them from the list.

You can use the -e7 option with lsblk to hide the loop devices.

Now that the loop devices are gone, the list looks much clearer now.

You can also do the same thing with grep.

You can also hide the CD/DVD rom device from the list. Just add the -e11 option along with -e7 option.

You can also list the attached disks on your computer, and their vendor and model information using lsblk as follows:

As you can see, all the attached disks on my computer are listed. Their vendor and model information are also listed.

Using fdisk Command:

You can also list all the attached disks on your computer from Ubuntu using the fdisk command as follows:

Читайте также:  Linux dvd usb tool

fdisk shows all the disks, their total size, their partitions, size of each partitions etc. But sadly, the list is too long and there is no easy way to hide the loop devices.

But if you know the device name (i.e. sda, sdb) of your disk, you can find more information about it very easily with fdisk.

You can also find information about more than one disk at the same time with fdisk. Just put the disks paths as fdisk arguments one after the other.

Using parted Command:

You can use parted to do the same thing. parted may not be installed by default on Ubuntu. But you can easily install it with the following command:

You can get a fdisk like output for all the storage disks attached on your computer with parted as follows:

As you can see, the output format is the same as in fdisk, but parted does not list the annoying loop devices. That’s a good thing.

Using GNOME Disks App:

If you don’t like to use the command line, then there are many graphical programs you can use to list disks on Ubuntu.

GNOME Disks is the default partitioning app on GNOME desktop environment. You can use it to list the disks attached on your computer.

First, open GNOME Disks from the Application Menu.

GNOME Disks should be opened. On the left side, you will see all the attached 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 side.

Using GParted App:

If you don’t like the command line, then you can also use the GParted Partition Editor app to list all the attached disks on your computer.

GParted is not installed by default on Ubuntu. But you can easily install GParted with the following command:

GParted should be installed.

Now, you can start GParted from the Application Menu.

In order to use GParted, you will need superuser privileges. Type in your login password and click on Authenticate.

GParted should start. You can select a disk from the dropdown menu at the top right corner of GParted.

As you can see, all the disks attached on my computer is listed in the dropdown menu. Just select a disk from the list.

The partitions of your selected disk should be displayed.

So, that’s how you list all the disks attached on your computer from Ubuntu.

I’ve shown some of the common methods in this article. If you know of listing disks any other way on Ubuntu, be sure to let me know.

Thanks for reading this article.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.

Источник

Смотрим список дисков Linux

Linux отображает подключённые жёсткие диски иначе, чем Windows. В операционной системе от Microsoft мы привыкли к тому, что у нас есть диск C, D, E, и нам не нужно задумываться о реальных именах разделов и жёстких дисков. Все диски размещены в проводнике и очень просто доступны.

В Linux такой возможности нет, как и нет такой абстракции. Диски и разделы именуются как есть, и вы будете иметь дело именно с этими именами. В этой статье мы разберём, как посмотреть список дисков Linux.

Читайте также:  Linux команды командной строки windows

Как посмотреть список дисков в Linux

В Linux все отображается в файловом виде, в том числе и устройства. Все подключённые к операционной системе Linux устройства размещаются в каталоге /dev/ здесь вы найдете микрофоны, камеры, жёсткие диски, флешки, одним словом, все внешние и внутренние устройства.

Жёсткие диски имеют особенные названия. В зависимости от интерфейса, через который подключён жёсткий диск, название может начинаться на:

  • sd — устройство, подключённое по SCSI;
  • hd — устройство ATA;
  • vd — виртуальное устройство;
  • mmcblk — обозначаются флешки, подключённые через картридер;

В наше время большинство блочных устройств Linux подключаются через интерфейс SCSI. Сюда входят жёсткие диски, USB-флешки, даже ATA-диски теперь тоже подключаются к SCSI через специальный переходник. Поэтому в большинстве случаев вы будете иметь дело именно с дисками sd.

Третья буква в имени диска означает его порядковый номер в системе. Используется алфавитная система. Например sda — первый диск, sdb — второй диск, sdc — третий и так далее. Дальше следует цифра — это номер раздела на диске — sda1, sda2.

Самый простой способ увидеть все подключённые диски — это посмотреть содержимое каталога /dev/ и отфильтровать устройства sd:

Как видите, в моей системе сейчас есть только один диск и два раздела. Дальше мы можем посмотреть, куда примонтирован каждый из разделов:

Здесь, кроме дисков, будут отображаться различные специальные файловые системы: procfs, sysfs, tmpfs, cgroup и так далее. Однако все эти команды не помогут нам получить доступ к информации о дисках. Поэтому нам понадобится кое-что другое. Посмотреть подключённые диски с выводом информации о размере и свободном пространстве можно с помощью утилиты df:

Здесь отображается уже подробная информация. Но вы можете узнать ещё больше с помощью команды lsblk:

В этом случае список примонтированных дисков Linux включает ещё и информацию о точке монтирования, типе раздела (диск, раздел, привод) и его мажорном и минорном номере, по которым можно понять, что это за устройство. Если вам нужна информация о размере, то лучше использовать fdisk:

Это все утилиты, которыми вы можете воспользоваться, чтобы просмотреть список дисков Linux. Но есть ещё и графические утилиты.

Посмотреть список дисков в GUI

Во-первых, если к компьютеру подключено несколько дисков, то вы сможете их увидеть на левой панели файлового менеджера Nautilus или Dolphin. Там будет отображаться список подключенных устройств Linux, их метки и размер:

В Gnome есть программа Disks, которая позволяет настраивать поведение дисков, она же может отображать список подключенных устройств к системе. Вы можете найти её в главном меню:

Утилита отображает всю доступную информацию о дисках и разделах на них, вы можете даже посмотреть информацию о состоянии smart. Список дисков находится на панели слева, а справа разделы на этом диске:

Ещё одна утилита, которую вы можете использовать, чтобы посмотреть список жёстких дисков Linux — это Gparted. Это редактор разделов для Linux, но вы можете посмотреть подключнёные диски и структуру каждого из них. Раскрывающийся список вы найдёте в верхнем правом углу:

А в основной части окна программы отображается список разделов.

Выводы

В этой статье мы разобрали несколько способов посмотреть список примонтированных дисков Linux. Каждый из них может понадобиться в различных ситуациях. Если у вас остались вопросы, спрашивайте в комментариях!

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Источник

Оцените статью
Adblock
detector