Finding all storage devices attached to a Linux machine

Clash Royale CLAN TAG#URR8PPP
up vote
26
down vote
favorite
I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted.
The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices (hd* and sd*).
Is there a better solution, or should I stick with this one?
linux storage
add a comment |Â
up vote
26
down vote
favorite
I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted.
The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices (hd* and sd*).
Is there a better solution, or should I stick with this one?
linux storage
reasking an old SO question
â warren
Oct 3 '12 at 16:45
1
Perhaps you want to use udisks?
â derobert
Oct 3 '12 at 17:03
I do not merely want to find what hard disks are on a system - I am looking for all storage devices
â warren
Oct 3 '12 at 18:52
I think we all assumed hard disks and similar. Do you actually mean something else? Like, should it include tape drives, printers, etc.?
â derobert
Oct 3 '12 at 19:22
2
@derobert - yes, hence the title of "all storage devices" :)
â warren
Oct 3 '12 at 19:50
add a comment |Â
up vote
26
down vote
favorite
up vote
26
down vote
favorite
I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted.
The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices (hd* and sd*).
Is there a better solution, or should I stick with this one?
linux storage
I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted.
The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices (hd* and sd*).
Is there a better solution, or should I stick with this one?
linux storage
linux storage
edited Oct 3 '12 at 16:51
Gilles
512k12010151547
512k12010151547
asked Oct 3 '12 at 16:45
warren
6791824
6791824
reasking an old SO question
â warren
Oct 3 '12 at 16:45
1
Perhaps you want to use udisks?
â derobert
Oct 3 '12 at 17:03
I do not merely want to find what hard disks are on a system - I am looking for all storage devices
â warren
Oct 3 '12 at 18:52
I think we all assumed hard disks and similar. Do you actually mean something else? Like, should it include tape drives, printers, etc.?
â derobert
Oct 3 '12 at 19:22
2
@derobert - yes, hence the title of "all storage devices" :)
â warren
Oct 3 '12 at 19:50
add a comment |Â
reasking an old SO question
â warren
Oct 3 '12 at 16:45
1
Perhaps you want to use udisks?
â derobert
Oct 3 '12 at 17:03
I do not merely want to find what hard disks are on a system - I am looking for all storage devices
â warren
Oct 3 '12 at 18:52
I think we all assumed hard disks and similar. Do you actually mean something else? Like, should it include tape drives, printers, etc.?
â derobert
Oct 3 '12 at 19:22
2
@derobert - yes, hence the title of "all storage devices" :)
â warren
Oct 3 '12 at 19:50
reasking an old SO question
â warren
Oct 3 '12 at 16:45
reasking an old SO question
â warren
Oct 3 '12 at 16:45
1
1
Perhaps you want to use udisks?
â derobert
Oct 3 '12 at 17:03
Perhaps you want to use udisks?
â derobert
Oct 3 '12 at 17:03
I do not merely want to find what hard disks are on a system - I am looking for all storage devices
â warren
Oct 3 '12 at 18:52
I do not merely want to find what hard disks are on a system - I am looking for all storage devices
â warren
Oct 3 '12 at 18:52
I think we all assumed hard disks and similar. Do you actually mean something else? Like, should it include tape drives, printers, etc.?
â derobert
Oct 3 '12 at 19:22
I think we all assumed hard disks and similar. Do you actually mean something else? Like, should it include tape drives, printers, etc.?
â derobert
Oct 3 '12 at 19:22
2
2
@derobert - yes, hence the title of "all storage devices" :)
â warren
Oct 3 '12 at 19:50
@derobert - yes, hence the title of "all storage devices" :)
â warren
Oct 3 '12 at 19:50
add a comment |Â
9 Answers
9
active
oldest
votes
up vote
38
down vote
If one is interested only in block storage devices, one can use lsblk from widely-available util-linux package:
$ lsblk -o KNAME,TYPE,SIZE,MODEL
KNAME TYPE SIZE MODEL
sda disk 149.1G TOSHIBA MK1637GS
sda1 part 23.3G
sda2 part 28G
sda3 part 93.6G
sda4 part 4.3G
sr0 rom 1024M CD/DVDW TS-L632M
It lends itself well to scripting with many other columns available.
add a comment |Â
up vote
10
down vote
You could trawl through the output of lshw and extract details about devices in the disk or tape class (and maybe others - storage class gives you details on storage controllers, scsi, sata, sas, etc).
e.g.
lshw -class disk -class tape
The -short option gives a nice compact summary. e.g. on my home zfsonlinux server/workstation/experiment-box (no tape devices unfortunately):
# lshw -class tape -class disk -class storage -short
H/W path Device Class Description
=========================================================
/0/100/4/0 storage JMB362 SATA Controller
/0/100/5/0 scsi10 storage JMB362 SATA Controller
/0/100/5/0/0.0.0 /dev/sdc disk 120GB Patriot Wildfire
/0/100/b/0 scsi1 storage SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]
/0/100/b/0/0.0.0 /dev/sdd disk 1TB WDC WD10EARS-00Y
/0/100/b/0/0.1.0 /dev/sde disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.2.0 /dev/sdf disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.3.0 /dev/sdg disk 1TB ST31000528AS
/0/100/b/0/0.4.0 /dev/sdh disk 1TB ST31000528AS
/0/100/b/0/0.5.0 /dev/sdi disk 1TB ST31000528AS
/0/100/b/0/0.6.0 /dev/sdj disk 1TB ST31000528AS
/0/100/11 scsi2 storage SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
/0/100/11/0 /dev/sda disk 128GB Patriot Torqx 2
/0/100/11/1 /dev/sdb disk 1TB ST31000528AS
/0/1 scsi11 storage
/0/1/0.0.0 /dev/sdk disk 1967MB SCSI Disk
/0/1/0.0.1 /dev/sdl disk SCSI Disk
/0/1/0.0.2 /dev/sdm disk SCSI Disk
/0/1/0.0.3 /dev/sdn disk SCSI Disk
/0/2 scsi66 storage
/0/2/0.0.0 /dev/sdo disk SCSI Disk
/0/3 scsi67 storage
/0/3/0.0.0 /dev/sdp disk 4057MB SCSI Disk
The /0/1 devices are actually a USB card-reader (there's a 2GB SD card plugged in to one of the slots), and the /0/2 device is my android phone plugged in for charging only. The 0/3 device is a 4GB USB flash drive.
lshw can produce plain text, html, xml, and json output. It can also dump hardware details into an sqlite database format.
It is packaged for debian and most other distros. The home page and source is at http://ezix.org/project/wiki/HardwareLiSter
add a comment |Â
up vote
4
down vote
Please, try this command
ls -l /dev /dev/mapper |grep '^b'
It will list you all block devices in your system
add a comment |Â
up vote
3
down vote
You can use lsblk to list all block devices, along with whether or not each device is read only.
You can then use grep and awk to print the names of block devices that are not read only:
lsblk -d -n -oNAME,RO | grep '0$' | awk 'print $1'
this is a great expansion on the previous answer
â warren
Sep 19 '14 at 23:11
add a comment |Â
up vote
3
down vote
lsblk will list all block storage devices.
fdisk -l will list all of the partitions on all devices that are listed in /proc/partitions
lshw -short will give you information about all of the hardware (except perhaps firewire) on the system.
add a comment |Â
up vote
2
down vote
If, as per your response to derobert, you're looking for something that lists tape drives and printers, you may be interested in lsdev, lsusb and lspci.
Of course, that'll fail to find network-attached storage :-(
â derobert
Oct 4 '12 at 15:21
1
Thenfdisk -l
â colons
Oct 4 '12 at 21:18
add a comment |Â
up vote
1
down vote
You can try the following command :
file /dev/disk/by-id/* | awk -F'/' 'NR>1print "47/dev/"$NF' | sort | uniq
1
what does it do and how does that compare to listing block and tape device classes with lshw?
â n611x007
Sep 10 '15 at 7:46
add a comment |Â
up vote
0
down vote
You can use hwinfo to list all disks (documentation).
hwinfo --block --short gives an overview:
disk:
/dev/sdb WDC WD3200AAKS-7
/dev/sda SAMSUNG HD103UJ
partition:
/dev/sdb1 Partition
/dev/sdb2 Partition
/dev/sda1 Partition
cdrom:
/dev/sr1 TSSTcorp DVD+-RW TS-H653B
/dev/sr0 HL-DT-ST DVD-ROM GDRH20N
hwinfo --disk gives more details for each disk.
FYI: on some Linux distributions such as Ubuntus 14.04 and higher, hwinfo isn't present in the official repository.
add a comment |Â
up vote
-3
down vote
This will list all your disks and mounted drives:
$ df -h
4
Actually, that lists filesystemsâ¦
â HalosGhost
Oct 4 '14 at 4:05
add a comment |Â
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
38
down vote
If one is interested only in block storage devices, one can use lsblk from widely-available util-linux package:
$ lsblk -o KNAME,TYPE,SIZE,MODEL
KNAME TYPE SIZE MODEL
sda disk 149.1G TOSHIBA MK1637GS
sda1 part 23.3G
sda2 part 28G
sda3 part 93.6G
sda4 part 4.3G
sr0 rom 1024M CD/DVDW TS-L632M
It lends itself well to scripting with many other columns available.
add a comment |Â
up vote
38
down vote
If one is interested only in block storage devices, one can use lsblk from widely-available util-linux package:
$ lsblk -o KNAME,TYPE,SIZE,MODEL
KNAME TYPE SIZE MODEL
sda disk 149.1G TOSHIBA MK1637GS
sda1 part 23.3G
sda2 part 28G
sda3 part 93.6G
sda4 part 4.3G
sr0 rom 1024M CD/DVDW TS-L632M
It lends itself well to scripting with many other columns available.
add a comment |Â
up vote
38
down vote
up vote
38
down vote
If one is interested only in block storage devices, one can use lsblk from widely-available util-linux package:
$ lsblk -o KNAME,TYPE,SIZE,MODEL
KNAME TYPE SIZE MODEL
sda disk 149.1G TOSHIBA MK1637GS
sda1 part 23.3G
sda2 part 28G
sda3 part 93.6G
sda4 part 4.3G
sr0 rom 1024M CD/DVDW TS-L632M
It lends itself well to scripting with many other columns available.
If one is interested only in block storage devices, one can use lsblk from widely-available util-linux package:
$ lsblk -o KNAME,TYPE,SIZE,MODEL
KNAME TYPE SIZE MODEL
sda disk 149.1G TOSHIBA MK1637GS
sda1 part 23.3G
sda2 part 28G
sda3 part 93.6G
sda4 part 4.3G
sr0 rom 1024M CD/DVDW TS-L632M
It lends itself well to scripting with many other columns available.
edited Oct 4 '14 at 18:53
answered Oct 9 '13 at 4:15
K3---rnc
1,8331119
1,8331119
add a comment |Â
add a comment |Â
up vote
10
down vote
You could trawl through the output of lshw and extract details about devices in the disk or tape class (and maybe others - storage class gives you details on storage controllers, scsi, sata, sas, etc).
e.g.
lshw -class disk -class tape
The -short option gives a nice compact summary. e.g. on my home zfsonlinux server/workstation/experiment-box (no tape devices unfortunately):
# lshw -class tape -class disk -class storage -short
H/W path Device Class Description
=========================================================
/0/100/4/0 storage JMB362 SATA Controller
/0/100/5/0 scsi10 storage JMB362 SATA Controller
/0/100/5/0/0.0.0 /dev/sdc disk 120GB Patriot Wildfire
/0/100/b/0 scsi1 storage SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]
/0/100/b/0/0.0.0 /dev/sdd disk 1TB WDC WD10EARS-00Y
/0/100/b/0/0.1.0 /dev/sde disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.2.0 /dev/sdf disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.3.0 /dev/sdg disk 1TB ST31000528AS
/0/100/b/0/0.4.0 /dev/sdh disk 1TB ST31000528AS
/0/100/b/0/0.5.0 /dev/sdi disk 1TB ST31000528AS
/0/100/b/0/0.6.0 /dev/sdj disk 1TB ST31000528AS
/0/100/11 scsi2 storage SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
/0/100/11/0 /dev/sda disk 128GB Patriot Torqx 2
/0/100/11/1 /dev/sdb disk 1TB ST31000528AS
/0/1 scsi11 storage
/0/1/0.0.0 /dev/sdk disk 1967MB SCSI Disk
/0/1/0.0.1 /dev/sdl disk SCSI Disk
/0/1/0.0.2 /dev/sdm disk SCSI Disk
/0/1/0.0.3 /dev/sdn disk SCSI Disk
/0/2 scsi66 storage
/0/2/0.0.0 /dev/sdo disk SCSI Disk
/0/3 scsi67 storage
/0/3/0.0.0 /dev/sdp disk 4057MB SCSI Disk
The /0/1 devices are actually a USB card-reader (there's a 2GB SD card plugged in to one of the slots), and the /0/2 device is my android phone plugged in for charging only. The 0/3 device is a 4GB USB flash drive.
lshw can produce plain text, html, xml, and json output. It can also dump hardware details into an sqlite database format.
It is packaged for debian and most other distros. The home page and source is at http://ezix.org/project/wiki/HardwareLiSter
add a comment |Â
up vote
10
down vote
You could trawl through the output of lshw and extract details about devices in the disk or tape class (and maybe others - storage class gives you details on storage controllers, scsi, sata, sas, etc).
e.g.
lshw -class disk -class tape
The -short option gives a nice compact summary. e.g. on my home zfsonlinux server/workstation/experiment-box (no tape devices unfortunately):
# lshw -class tape -class disk -class storage -short
H/W path Device Class Description
=========================================================
/0/100/4/0 storage JMB362 SATA Controller
/0/100/5/0 scsi10 storage JMB362 SATA Controller
/0/100/5/0/0.0.0 /dev/sdc disk 120GB Patriot Wildfire
/0/100/b/0 scsi1 storage SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]
/0/100/b/0/0.0.0 /dev/sdd disk 1TB WDC WD10EARS-00Y
/0/100/b/0/0.1.0 /dev/sde disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.2.0 /dev/sdf disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.3.0 /dev/sdg disk 1TB ST31000528AS
/0/100/b/0/0.4.0 /dev/sdh disk 1TB ST31000528AS
/0/100/b/0/0.5.0 /dev/sdi disk 1TB ST31000528AS
/0/100/b/0/0.6.0 /dev/sdj disk 1TB ST31000528AS
/0/100/11 scsi2 storage SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
/0/100/11/0 /dev/sda disk 128GB Patriot Torqx 2
/0/100/11/1 /dev/sdb disk 1TB ST31000528AS
/0/1 scsi11 storage
/0/1/0.0.0 /dev/sdk disk 1967MB SCSI Disk
/0/1/0.0.1 /dev/sdl disk SCSI Disk
/0/1/0.0.2 /dev/sdm disk SCSI Disk
/0/1/0.0.3 /dev/sdn disk SCSI Disk
/0/2 scsi66 storage
/0/2/0.0.0 /dev/sdo disk SCSI Disk
/0/3 scsi67 storage
/0/3/0.0.0 /dev/sdp disk 4057MB SCSI Disk
The /0/1 devices are actually a USB card-reader (there's a 2GB SD card plugged in to one of the slots), and the /0/2 device is my android phone plugged in for charging only. The 0/3 device is a 4GB USB flash drive.
lshw can produce plain text, html, xml, and json output. It can also dump hardware details into an sqlite database format.
It is packaged for debian and most other distros. The home page and source is at http://ezix.org/project/wiki/HardwareLiSter
add a comment |Â
up vote
10
down vote
up vote
10
down vote
You could trawl through the output of lshw and extract details about devices in the disk or tape class (and maybe others - storage class gives you details on storage controllers, scsi, sata, sas, etc).
e.g.
lshw -class disk -class tape
The -short option gives a nice compact summary. e.g. on my home zfsonlinux server/workstation/experiment-box (no tape devices unfortunately):
# lshw -class tape -class disk -class storage -short
H/W path Device Class Description
=========================================================
/0/100/4/0 storage JMB362 SATA Controller
/0/100/5/0 scsi10 storage JMB362 SATA Controller
/0/100/5/0/0.0.0 /dev/sdc disk 120GB Patriot Wildfire
/0/100/b/0 scsi1 storage SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]
/0/100/b/0/0.0.0 /dev/sdd disk 1TB WDC WD10EARS-00Y
/0/100/b/0/0.1.0 /dev/sde disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.2.0 /dev/sdf disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.3.0 /dev/sdg disk 1TB ST31000528AS
/0/100/b/0/0.4.0 /dev/sdh disk 1TB ST31000528AS
/0/100/b/0/0.5.0 /dev/sdi disk 1TB ST31000528AS
/0/100/b/0/0.6.0 /dev/sdj disk 1TB ST31000528AS
/0/100/11 scsi2 storage SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
/0/100/11/0 /dev/sda disk 128GB Patriot Torqx 2
/0/100/11/1 /dev/sdb disk 1TB ST31000528AS
/0/1 scsi11 storage
/0/1/0.0.0 /dev/sdk disk 1967MB SCSI Disk
/0/1/0.0.1 /dev/sdl disk SCSI Disk
/0/1/0.0.2 /dev/sdm disk SCSI Disk
/0/1/0.0.3 /dev/sdn disk SCSI Disk
/0/2 scsi66 storage
/0/2/0.0.0 /dev/sdo disk SCSI Disk
/0/3 scsi67 storage
/0/3/0.0.0 /dev/sdp disk 4057MB SCSI Disk
The /0/1 devices are actually a USB card-reader (there's a 2GB SD card plugged in to one of the slots), and the /0/2 device is my android phone plugged in for charging only. The 0/3 device is a 4GB USB flash drive.
lshw can produce plain text, html, xml, and json output. It can also dump hardware details into an sqlite database format.
It is packaged for debian and most other distros. The home page and source is at http://ezix.org/project/wiki/HardwareLiSter
You could trawl through the output of lshw and extract details about devices in the disk or tape class (and maybe others - storage class gives you details on storage controllers, scsi, sata, sas, etc).
e.g.
lshw -class disk -class tape
The -short option gives a nice compact summary. e.g. on my home zfsonlinux server/workstation/experiment-box (no tape devices unfortunately):
# lshw -class tape -class disk -class storage -short
H/W path Device Class Description
=========================================================
/0/100/4/0 storage JMB362 SATA Controller
/0/100/5/0 scsi10 storage JMB362 SATA Controller
/0/100/5/0/0.0.0 /dev/sdc disk 120GB Patriot Wildfire
/0/100/b/0 scsi1 storage SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]
/0/100/b/0/0.0.0 /dev/sdd disk 1TB WDC WD10EARS-00Y
/0/100/b/0/0.1.0 /dev/sde disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.2.0 /dev/sdf disk 1TB WDC WD10EACS-00Z
/0/100/b/0/0.3.0 /dev/sdg disk 1TB ST31000528AS
/0/100/b/0/0.4.0 /dev/sdh disk 1TB ST31000528AS
/0/100/b/0/0.5.0 /dev/sdi disk 1TB ST31000528AS
/0/100/b/0/0.6.0 /dev/sdj disk 1TB ST31000528AS
/0/100/11 scsi2 storage SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
/0/100/11/0 /dev/sda disk 128GB Patriot Torqx 2
/0/100/11/1 /dev/sdb disk 1TB ST31000528AS
/0/1 scsi11 storage
/0/1/0.0.0 /dev/sdk disk 1967MB SCSI Disk
/0/1/0.0.1 /dev/sdl disk SCSI Disk
/0/1/0.0.2 /dev/sdm disk SCSI Disk
/0/1/0.0.3 /dev/sdn disk SCSI Disk
/0/2 scsi66 storage
/0/2/0.0.0 /dev/sdo disk SCSI Disk
/0/3 scsi67 storage
/0/3/0.0.0 /dev/sdp disk 4057MB SCSI Disk
The /0/1 devices are actually a USB card-reader (there's a 2GB SD card plugged in to one of the slots), and the /0/2 device is my android phone plugged in for charging only. The 0/3 device is a 4GB USB flash drive.
lshw can produce plain text, html, xml, and json output. It can also dump hardware details into an sqlite database format.
It is packaged for debian and most other distros. The home page and source is at http://ezix.org/project/wiki/HardwareLiSter
answered Oct 3 '12 at 23:10
cas
37.9k44495
37.9k44495
add a comment |Â
add a comment |Â
up vote
4
down vote
Please, try this command
ls -l /dev /dev/mapper |grep '^b'
It will list you all block devices in your system
add a comment |Â
up vote
4
down vote
Please, try this command
ls -l /dev /dev/mapper |grep '^b'
It will list you all block devices in your system
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Please, try this command
ls -l /dev /dev/mapper |grep '^b'
It will list you all block devices in your system
Please, try this command
ls -l /dev /dev/mapper |grep '^b'
It will list you all block devices in your system
answered Oct 3 '12 at 16:48
Serge
5,42521324
5,42521324
add a comment |Â
add a comment |Â
up vote
3
down vote
You can use lsblk to list all block devices, along with whether or not each device is read only.
You can then use grep and awk to print the names of block devices that are not read only:
lsblk -d -n -oNAME,RO | grep '0$' | awk 'print $1'
this is a great expansion on the previous answer
â warren
Sep 19 '14 at 23:11
add a comment |Â
up vote
3
down vote
You can use lsblk to list all block devices, along with whether or not each device is read only.
You can then use grep and awk to print the names of block devices that are not read only:
lsblk -d -n -oNAME,RO | grep '0$' | awk 'print $1'
this is a great expansion on the previous answer
â warren
Sep 19 '14 at 23:11
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You can use lsblk to list all block devices, along with whether or not each device is read only.
You can then use grep and awk to print the names of block devices that are not read only:
lsblk -d -n -oNAME,RO | grep '0$' | awk 'print $1'
You can use lsblk to list all block devices, along with whether or not each device is read only.
You can then use grep and awk to print the names of block devices that are not read only:
lsblk -d -n -oNAME,RO | grep '0$' | awk 'print $1'
edited Sep 19 '14 at 17:22
drs
3,26842757
3,26842757
answered Sep 19 '14 at 17:17
Jason Hobbs
804
804
this is a great expansion on the previous answer
â warren
Sep 19 '14 at 23:11
add a comment |Â
this is a great expansion on the previous answer
â warren
Sep 19 '14 at 23:11
this is a great expansion on the previous answer
â warren
Sep 19 '14 at 23:11
this is a great expansion on the previous answer
â warren
Sep 19 '14 at 23:11
add a comment |Â
up vote
3
down vote
lsblk will list all block storage devices.
fdisk -l will list all of the partitions on all devices that are listed in /proc/partitions
lshw -short will give you information about all of the hardware (except perhaps firewire) on the system.
add a comment |Â
up vote
3
down vote
lsblk will list all block storage devices.
fdisk -l will list all of the partitions on all devices that are listed in /proc/partitions
lshw -short will give you information about all of the hardware (except perhaps firewire) on the system.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
lsblk will list all block storage devices.
fdisk -l will list all of the partitions on all devices that are listed in /proc/partitions
lshw -short will give you information about all of the hardware (except perhaps firewire) on the system.
lsblk will list all block storage devices.
fdisk -l will list all of the partitions on all devices that are listed in /proc/partitions
lshw -short will give you information about all of the hardware (except perhaps firewire) on the system.
answered Jun 16 '16 at 4:11
Simon Woodside
19816
19816
add a comment |Â
add a comment |Â
up vote
2
down vote
If, as per your response to derobert, you're looking for something that lists tape drives and printers, you may be interested in lsdev, lsusb and lspci.
Of course, that'll fail to find network-attached storage :-(
â derobert
Oct 4 '12 at 15:21
1
Thenfdisk -l
â colons
Oct 4 '12 at 21:18
add a comment |Â
up vote
2
down vote
If, as per your response to derobert, you're looking for something that lists tape drives and printers, you may be interested in lsdev, lsusb and lspci.
Of course, that'll fail to find network-attached storage :-(
â derobert
Oct 4 '12 at 15:21
1
Thenfdisk -l
â colons
Oct 4 '12 at 21:18
add a comment |Â
up vote
2
down vote
up vote
2
down vote
If, as per your response to derobert, you're looking for something that lists tape drives and printers, you may be interested in lsdev, lsusb and lspci.
If, as per your response to derobert, you're looking for something that lists tape drives and printers, you may be interested in lsdev, lsusb and lspci.
answered Oct 3 '12 at 20:33
colons
22116
22116
Of course, that'll fail to find network-attached storage :-(
â derobert
Oct 4 '12 at 15:21
1
Thenfdisk -l
â colons
Oct 4 '12 at 21:18
add a comment |Â
Of course, that'll fail to find network-attached storage :-(
â derobert
Oct 4 '12 at 15:21
1
Thenfdisk -l
â colons
Oct 4 '12 at 21:18
Of course, that'll fail to find network-attached storage :-(
â derobert
Oct 4 '12 at 15:21
Of course, that'll fail to find network-attached storage :-(
â derobert
Oct 4 '12 at 15:21
1
1
Then
fdisk -lâ colons
Oct 4 '12 at 21:18
Then
fdisk -lâ colons
Oct 4 '12 at 21:18
add a comment |Â
up vote
1
down vote
You can try the following command :
file /dev/disk/by-id/* | awk -F'/' 'NR>1print "47/dev/"$NF' | sort | uniq
1
what does it do and how does that compare to listing block and tape device classes with lshw?
â n611x007
Sep 10 '15 at 7:46
add a comment |Â
up vote
1
down vote
You can try the following command :
file /dev/disk/by-id/* | awk -F'/' 'NR>1print "47/dev/"$NF' | sort | uniq
1
what does it do and how does that compare to listing block and tape device classes with lshw?
â n611x007
Sep 10 '15 at 7:46
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You can try the following command :
file /dev/disk/by-id/* | awk -F'/' 'NR>1print "47/dev/"$NF' | sort | uniq
You can try the following command :
file /dev/disk/by-id/* | awk -F'/' 'NR>1print "47/dev/"$NF' | sort | uniq
answered Oct 3 '12 at 17:09
Gilles Quenot
15.5k13549
15.5k13549
1
what does it do and how does that compare to listing block and tape device classes with lshw?
â n611x007
Sep 10 '15 at 7:46
add a comment |Â
1
what does it do and how does that compare to listing block and tape device classes with lshw?
â n611x007
Sep 10 '15 at 7:46
1
1
what does it do and how does that compare to listing block and tape device classes with lshw?
â n611x007
Sep 10 '15 at 7:46
what does it do and how does that compare to listing block and tape device classes with lshw?
â n611x007
Sep 10 '15 at 7:46
add a comment |Â
up vote
0
down vote
You can use hwinfo to list all disks (documentation).
hwinfo --block --short gives an overview:
disk:
/dev/sdb WDC WD3200AAKS-7
/dev/sda SAMSUNG HD103UJ
partition:
/dev/sdb1 Partition
/dev/sdb2 Partition
/dev/sda1 Partition
cdrom:
/dev/sr1 TSSTcorp DVD+-RW TS-H653B
/dev/sr0 HL-DT-ST DVD-ROM GDRH20N
hwinfo --disk gives more details for each disk.
FYI: on some Linux distributions such as Ubuntus 14.04 and higher, hwinfo isn't present in the official repository.
add a comment |Â
up vote
0
down vote
You can use hwinfo to list all disks (documentation).
hwinfo --block --short gives an overview:
disk:
/dev/sdb WDC WD3200AAKS-7
/dev/sda SAMSUNG HD103UJ
partition:
/dev/sdb1 Partition
/dev/sdb2 Partition
/dev/sda1 Partition
cdrom:
/dev/sr1 TSSTcorp DVD+-RW TS-H653B
/dev/sr0 HL-DT-ST DVD-ROM GDRH20N
hwinfo --disk gives more details for each disk.
FYI: on some Linux distributions such as Ubuntus 14.04 and higher, hwinfo isn't present in the official repository.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can use hwinfo to list all disks (documentation).
hwinfo --block --short gives an overview:
disk:
/dev/sdb WDC WD3200AAKS-7
/dev/sda SAMSUNG HD103UJ
partition:
/dev/sdb1 Partition
/dev/sdb2 Partition
/dev/sda1 Partition
cdrom:
/dev/sr1 TSSTcorp DVD+-RW TS-H653B
/dev/sr0 HL-DT-ST DVD-ROM GDRH20N
hwinfo --disk gives more details for each disk.
FYI: on some Linux distributions such as Ubuntus 14.04 and higher, hwinfo isn't present in the official repository.
You can use hwinfo to list all disks (documentation).
hwinfo --block --short gives an overview:
disk:
/dev/sdb WDC WD3200AAKS-7
/dev/sda SAMSUNG HD103UJ
partition:
/dev/sdb1 Partition
/dev/sdb2 Partition
/dev/sda1 Partition
cdrom:
/dev/sr1 TSSTcorp DVD+-RW TS-H653B
/dev/sr0 HL-DT-ST DVD-ROM GDRH20N
hwinfo --disk gives more details for each disk.
FYI: on some Linux distributions such as Ubuntus 14.04 and higher, hwinfo isn't present in the official repository.
edited Apr 13 '17 at 12:22
Communityâ¦
1
1
answered Aug 13 '16 at 17:15
Franck Dernoncourt
1,25462451
1,25462451
add a comment |Â
add a comment |Â
up vote
-3
down vote
This will list all your disks and mounted drives:
$ df -h
4
Actually, that lists filesystemsâ¦
â HalosGhost
Oct 4 '14 at 4:05
add a comment |Â
up vote
-3
down vote
This will list all your disks and mounted drives:
$ df -h
4
Actually, that lists filesystemsâ¦
â HalosGhost
Oct 4 '14 at 4:05
add a comment |Â
up vote
-3
down vote
up vote
-3
down vote
This will list all your disks and mounted drives:
$ df -h
This will list all your disks and mounted drives:
$ df -h
edited Oct 4 '14 at 3:49
slmâ¦
239k65495665
239k65495665
answered Oct 4 '14 at 2:53
Haider Abbas
11
11
4
Actually, that lists filesystemsâ¦
â HalosGhost
Oct 4 '14 at 4:05
add a comment |Â
4
Actually, that lists filesystemsâ¦
â HalosGhost
Oct 4 '14 at 4:05
4
4
Actually, that lists filesystemsâ¦
â HalosGhost
Oct 4 '14 at 4:05
Actually, that lists filesystemsâ¦
â HalosGhost
Oct 4 '14 at 4:05
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f49786%2ffinding-all-storage-devices-attached-to-a-linux-machine%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
reasking an old SO question
â warren
Oct 3 '12 at 16:45
1
Perhaps you want to use udisks?
â derobert
Oct 3 '12 at 17:03
I do not merely want to find what hard disks are on a system - I am looking for all storage devices
â warren
Oct 3 '12 at 18:52
I think we all assumed hard disks and similar. Do you actually mean something else? Like, should it include tape drives, printers, etc.?
â derobert
Oct 3 '12 at 19:22
2
@derobert - yes, hence the title of "all storage devices" :)
â warren
Oct 3 '12 at 19:50