Get disk information linux

How to see disk details like manufacturer in Linux

@jennifer: Install at least one of them! All the information they return is available elsewhere, but they have the advantage of collecting all that information from many different places.

Running the command lshw -class disk as a regular user does not display information on disk (Ubuntu 15.04). Hopefully the bottom printed line says «WARNING: output may be incomplete or inaccurate, you should run this program as super-user.» Running again using sudo fixes the issue 🙂

The name /dev/cciss/c0d0 indicates the OP’s system uses a HP SmartArray hardware RAID controller, and so any «disk» shown by it is actually a RAID set, which may or may not correspond directly to any single physical disk. In that specific situation, you’ll need a tool that knows how to talk to the RAID controller and get the information on actual physical drives from it. hwinfo , lshw or smartctl mentioned in other answers all understand some types of hardware RAID controllers; a vendor-specific RAID management tool will usually get the most information.

You could read the disk properties directly through sysfs, also check the other files/dirs in /sys/class/block/sda/device/ (replace sda with drive you need).

cat /sys/class/block/sda/device/

Use a recent kernel maybe, what distro are you using? try dmesg | less , should see the disks get probed.

@jennifer: cat /sys/block/sd?/device/ ( /sys/class/block only appeared fairly recently, and your distribution is a little old).

try running smartctl -a /dev/hda (could be sda in your case; cat /proc/partitions will show you the device type to use)

In your case it’s behind a cciss controller, so the option should be -d cciss,0 or similar.

lsblk (List Block)

You can use lsblk command:

$ lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL NAME FSTYPE LABEL MOUNTPOINT SIZE MODEL . nvme0n1 119.2G TS128GMTE110S ├─nvme0n1p1 vfat /boot/efi 512M └─nvme0n1p2 ext4 / 118.8G 

Perfectly informed, my NVMe SSD is a Transced 110S 128GB (TS128GMTE110S)

I know these answers are 3 years old, but for anyone looking around. In older versions you could find that under ( ? should be a number):

/sys/class/scsi_device/. /device/model 
cat /sys/class/scsi_device/0\:0\:0\:0/device/

(The backslashes next to zeros are for escaping special char : .)

lsblk (List blocks) gives a list with device, size, type and mount_point

sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk └─sda1 8:1 0 465.8G 0 part /data sdb 8:16 0 1.8T 0 disk ├─sdb1 8:17 0 1002.3G 0 part │ └─lvmvolumeSda6-home 254:0 0 2.8T 0 lvm /home └─sdb2 8:18 0 860.7G 0 part sdc 8:32 0 232.9G 0 disk └─sdc1 8:33 0 232.9G 0 part sdd 8:48 1 3.7T 0 disk └─sdd1 8:49 1 3.7T 0 part /mnt/backups sde 8:64 1 1.8T 0 disk ├─sde1 8:65 1 864.5G 0 part │ └─lvmvolumeSda6-home 254:0 0 2.8T 0 lvm /home └─sde2 8:66 1 998.6G 0 part └─lvmvolumeSda6-home 254:0 0 2.8T 0 lvm /home sr0 11:0 1 1024M 0 rom sr1 11:1 1 1024M 0 rom nvme0n1 259:0 0 465.8G 0 disk ├─nvme0n1p1 259:1 0 134.8G 0 part ├─nvme0n1p2 259:2 0 1.9G 0 part /boot ├─nvme0n1p3 259:3 0 1K 0 part ├─nvme0n1p4 259:4 0 87G 0 part / ├─nvme0n1p5 259:5 0 15G 0 part [SWAP] └─nvme0n1p6 259:6 0 227.2G 0 part /data_nvme 

lsblk -S gives model, vendor, etc.

sudo lsblk -S NAME HCTL TYPE VENDOR MODEL REV TRAN sda 0:0:0:0 disk ATA WDC WDS500G1B0A- 10WD sata sdb 1:0:0:0 disk ATA WDC WD20EFRX-68E 0A82 sata sdc 5:0:0:0 disk ATA Samsung SSD 850 1B6Q sata sdd 10:0:0:0 disk ATA WDC WD40EFRX-68W 0A82 sata sde 11:1:0:0 disk ATA WDC WD20EARS-00M AB51 sata sr0 9:0:0:0 rom ASUS BC-12D2HT 1.00 sata sr1 11:0:0:0 rom TSSTcorp CDDVDW SH-222BB SB00 sata 

Источник

Читайте также:  Zip directory in linux command

6 Different Ways to List Hard Drives in Linux

This detailed guide will give you enough information to start using Emacs, and enough extra to make you want more.

There are several ways to list all the hard drives present in a system through Linux command lines.

Keep in mind a hard drive could be physically connected, virtually connected or even emulated (for example: when you use storage devices such as EMC, Sun or IBM).

Here are some different commands which can list the hard drives, keep in mind there are others but these are probably the most commonly used and easy to get the job done.

Listing Hard Drives in Linux

Please note that some of these commands are actually disk partitioning tools and listing disk partition is one of their features.

Let’s see what commands you can use to show disk info in Linux.

1. df

The df command in Linux is probably one of the most commonly used. It lists the actual “disk space usage” and it can give you information about what hard disks (or current disk space) is being used in the entire system.

The most common way to use it is with the -h argument which means “human readable” (because we are not machines, right?):

[email protected]:~$ df -h Filesystem Size Used Avail Use% Mounted on udev 7.8G 0 7.8G 0% /dev tmpfs 1.6G 3.5M 1.6G 1% /run /dev/sda2 468G 204G 242G 46% / tmpfs 7.8G 109M 7.7G 2% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/loop0 7.5M 7.5M 0 100% /snap/canonical-livepatch/54 /dev/loop1 90M 90M 0 100% /snap/core/6034 /dev/loop2 5.0M 5.0M 0 100% /snap/canonical-livepatch/50 /dev/loop4 90M 90M 0 100% /snap/core/6130 /dev/loop3 4.8M 4.8M 0 100% /snap/canonical-livepatch/49 /dev/loop5 89M 89M 0 100% /snap/core/5897 /dev/sda1 511M 6.1M 505M 2% /boot/efi tmpfs 1.6G 16K 1.6G 1% /run/user/121 tmpfs 1.6G 44K 1.6G 1% /run/user/1000

As you can see, the first column is the current logic name (or the name you can find it within your system), the second column is how big is each of them, the third column is how much is currently used (in bytes), the fourth column is how much is currently available in each for usage (in bytes), the fifth column is how much is used (in %) and the sixth and last column is where is it physically mounted in your Linux system.

2. fdisk

fdisk is another common option among sysops. It currently lists the different partitions (which is related to hard drives as a hard drive can be divided into several partitions) in your system.

[email protected]:~$ fdisk -l Disk /dev/loop0: 7.5 MiB, 7811072 bytes, 15256 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 Disk /dev/loop1: 89.5 MiB, 93818880 bytes, 183240 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 Disk /dev/loop2: 4.9 MiB, 5148672 bytes, 10056 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 Disk /dev/loop3: 4.7 MiB, 4919296 bytes, 9608 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 Disk /dev/loop4: 89.5 MiB, 93835264 bytes, 183272 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 Disk /dev/loop5: 88.2 MiB, 92483584 bytes, 180632 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 Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 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: 129F4EE6-2A54-4639-BFCA-2CC09DFC8566 Device Start End Sectors Size Type /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 1000214527 999163904 476.4G Linux filesystem 

This will return the entire amount of space (in GB or MB), the entire amount of bytes and the entire amount of sectors per each partition and as a summary, it also gives you the start and end sectors, the amount of disk space (in Bytes) and the type of partition.

Читайте также:  Show listen ports linux

Tip: Usually a SATA disk is labelled with sd.

3. lsblk

This one is a little more sophisticated but gets the job done as it lists all block devices. It will give you a very simple list of all devices:

[email protected]:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 7.5M 1 loop /snap/canonical-livepatch/54 loop1 7:1 0 89.5M 1 loop /snap/core/6034 loop2 7:2 0 4.9M 1 loop /snap/canonical-livepatch/50 loop3 7:3 0 4.7M 1 loop /snap/canonical-livepatch/49 loop4 7:4 0 89.5M 1 loop /snap/core/6130 loop5 7:5 0 88.2M 1 loop /snap/core/5897 sda 8:0 0 477G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi └─sda2 8:2 0 476.4G 0 part /

It is probably more visual than the others as it even shows the partitions per each disk in a visual way (like the sda in the example above). It also gives information about the total size per each partition and disk and the physical location for each. This is very commonly used when you need to mount things to be used (like a USB stick or similar) so you can know where is it in order to proceed to mount it.

4. cfdisk

cfdisk is probably the most advanced one in GUI (Graphical User Interface), as it is absolutely visual and interactive. It allows at first to list all disks/partitions in your system but it also allows you to manage them by selecting them and then applying actions such as “Delete”, “Resize”, “Type” (to change partition Type) and “Write” changes done to partitions.

It also gives you very friendly information about each partition and disk as it gives you where does each partition cylinders start and ends, amount of sectors used by each one and the full size of each one with its type. It won’t give you for example how much is used or free to use.

Читайте также:  Запуск linux в live режиме

5. parted

This one is similar to previous ones mentioned, it lists all partitions and allows to manage them. Its main difference is that it also informs you the brand and model of your hard disks and even the type of connectivity used in it (scsi, sata, etc) and total disk size.

[email protected]:~$ sudo parted -l Model: ATA LITEON CV1-8B512 (scsi) Disk /dev/sda: 512GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp

6. sfdisk

This is very similar to fdisk, however sfdisk allows you to see both physical and logical volumes and also gives you a “summary” of the actual physical volumes’ partitions with the cylinders (start and end), sectors, size and type.

Probably the “s” is for “super”, as it is a fdisk with super powers:

[email protected]:~$ sudo sfdisk -l Disk /dev/loop0: 88.2 MiB, 92483584 bytes, 180632 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 Disk /dev/loop1: 4.7 MiB, 4919296 bytes, 9608 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 Disk /dev/loop2: 4.9 MiB, 5148672 bytes, 10056 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 Disk /dev/loop3: 89.5 MiB, 93818880 bytes, 183240 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 Disk /dev/loop4: 7.5 MiB, 7811072 bytes, 15256 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 Disk /dev/loop5: 89.5 MiB, 93835264 bytes, 183272 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 Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 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: 129F4EE6-2A54-4639-BFCA-2CC09DFC8566 Device Start End Sectors Size Type /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 1000214527 999163904 476.4G Linux filesystem

These commands should allow you to at least see what logical volumes, partitions and hard drives you have in your system and make use of this information for whatever reason you need it, being this just to know more or manipulate any of these.

Most of these commands also give you managing capabilities to modify and manipulate partitions at your will, so make sure to use them with responsibility.

If you like checking system information, do read the article about getting processor information in Linux command line.

If you have any questions or suggestions, do let me know in the comment section.

Источник

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