View all disks linux

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

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

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

Как посмотреть список дисков в 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:

Читайте также:  Mqtt клиент для linux

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

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

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

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

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

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

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

Выводы

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

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

Источник

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.

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:

Читайте также:  Удаление файлов linux через консоль

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.

Источник

This post and this website contains affiliate links. See my disclosure about affiliate links.

how to list all hard disks in linux from command line

Hard Disk, Hard Drive, Disk Drive or Hard Disk Drive are all names for a data storage device (hardware device) for storing and retrieving digital information usually in a computer. A computer can have multiple hard disks attached to it, both internal and external.

Now these hard disks can be further divided to multiple logical containers in order to host different file systems or to keep file systems/files separate. These are called partitions and they can then mounted independently with out affecting the other disks and partitions. At a high level abstraction, you can view partition as separate disks as well.

Hard disks on a system are detected and/or identified by various device drivers in the kernel and then assigned an unique device id at boot time, enabling it to be mounted and read later (yeah, this is an over simplification of how it all works but it should suffice for this post). We will see later in the post how you can list disks that have been identified by the system.

The hard disks can be differentiated based on the interface used to interact with them. Some of the commonly used types of disk are SCSI (Small Computer System Interface), ATA or IDE (Advanced Technology Attachment), SATA (Serial ATA), SAS (Serial Attached SCSI) among others. As I mentioned, the physical hard disk is assigned an unique id at startup. This can configured (using udev among others) so that you can assign it pretty much id, but usually most systems follow some universally accepted conventions when naming devices.

By convention, the IDE disks use the device id prefixed with hd and the SCSI (and SATA) disks prefix their device id with sd. So, an IDE disk would be located at /dev/hd(*). eg: /dev/hda, /dev/hdb etc. Similarly, the SCSI disks would be /dev/sda, /dev/sdb etc or in general of the format /dev/sd(*).

Источник

Читайте также:  Kaspersky agent astra 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 

Источник

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