0

Im trying to scrape information of drive type. EG USB, RAID Etc..

In windows I can use DISKPART and run the command DETAIL DISK :

Example:


DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> detail disk

WDC WD1600AAJS-75M0A0 Disk ID: 46C9XXXX Type : RAID Status : Online Path : 0 Target : 4 LUN ID : 0 Location Path : PCIROOT(0)#PCI(1F02)#RAID(P00T04L00) Current Read-only State : No Read-only : No Boot Disk : No Pagefile Disk : No Hibernation File Disk : No Crashdump Disk : No Clustered Disk : No

Volume ### Ltr Label Fs Type Size Status Info


Volume 2 D NTFS Partition 97 GB Healthy System


So what is the equivalent command (if it exists) in Parted or other command line utility for Linux?

The key information I am after is the "Type : RAID" output.

I'm looking to integrate a scrape in to an existing program.

1

Take a look as lsblk. Per its man page: "lsblk lists information about all available or the specified block devices.", e.g:

lsblk (to retrieve info on all block devices):

NAME                  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                     8:0    0 273.4G  0 disk 
├─sda1                  8:1    0   487M  0 part /boot
├─sda2                  8:2    0     1K  0 part 
└─sda5                  8:5    0 272.9G  0 part 
  ├─neuron--vg-root   252:0    0 144.9G  0 lvm  /
  └─neuron--vg-swap_1 252:1    0   128G  0 lvm  [SWAP]
sdb                     8:16   0   1.7T  0 disk 
└─sdb1                  8:17   0   1.7T  0 part /home

lsblk /dev/sd* --nodeps --output TYPE(to retrieve Type for all block devices):

TYPE
disk
part
part
part
disk
part

lsblk /dev/sd* --nodeps --output NAME,MODEL,VENDOR,SIZE,TYPE,STATE(to retrieve specified parameters on all block devices):

NAME MODEL            VENDOR     SIZE TYPE STATE
sda  LOGICAL VOLUME   HP       273.4G disk running
sda1                             487M part 
sda2                               1K part 
sda5                           272.9G part 
sdb  LOGICAL VOLUME   HP         1.7T disk running
sdb1                             1.7T part 

lsblk /dev/sda --nodeps --output TYPE (to get Type of sda, which is generally the equivalent of Window's Disk 1):

TYPE
disk 

This is one approach, and you may need to add the package to your particular distribution with, e.g.: sudo apt-get install lsblk (Debian, Ubuntu).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.