Detecting only external hard drives
Detecting only external hard drives
Hi everyone,
I have a project which works on centos 7.It's basically about disk management and i also wanted to show the user the external hard drives.But first i need to detect those devices using commands.Is there a specific command/script that shows only the storage devices among all usb devices.
I know about the "df" command but i can't test that if centos auto-mount the external hard drives when plugged.
I have a project which works on centos 7.It's basically about disk management and i also wanted to show the user the external hard drives.But first i need to detect those devices using commands.Is there a specific command/script that shows only the storage devices among all usb devices.
I know about the "df" command but i can't test that if centos auto-mount the external hard drives when plugged.
Re: Detecting only external hard drives
Have you looked at the command "lsblk"?erkutr wrote: ↑2021/07/16 12:21:35Hi everyone,
I have a project which works on centos 7.It's basically about disk management and i also wanted to show the user the external hard drives.But first i need to detect those devices using commands.Is there a specific command/script that shows only the storage devices among all usb devices.
I know about the "df" command but i can't test that if centos auto-mount the external hard drives when plugged.
Re: Detecting only external hard drives
I know about "lsblk" but i need to distinguish the external hard drive from internal ones.Is there a way?Whoever wrote: ↑2021/07/17 01:58:40Have you looked at the command "lsblk"?erkutr wrote: ↑2021/07/16 12:21:35Hi everyone,
I have a project which works on centos 7.It's basically about disk management and i also wanted to show the user the external hard drives.But first i need to detect those devices using commands.Is there a specific command/script that shows only the storage devices among all usb devices.
I know about the "df" command but i can't test that if centos auto-mount the external hard drives when plugged.
Re: Detecting only external hard drives
The "external" hard drives are mounted by the desktop system.
If you don't have a desktop running, they won't be mounted. This would identify external drives.
If you do have a desktop running, then you could look at where the drives are mounted and use that to identify external drives,
If you don't have a desktop running, they won't be mounted. This would identify external drives.
If you do have a desktop running, then you could look at where the drives are mounted and use that to identify external drives,
Re: Detecting only external hard drives
It is hard for a machine to know what is "inside" and what is "outside".
There have been USB, Firewire, eSATA, SCSI external drives. Probably some others too.
(Some SCSI controllers have both internal and external ports.)
You can probably put NVME drive on PCIe outside of case (just like you can have GPU in external box).
GNOME automounts under /media, does it? (But CD/DVD/Bluray might show there too?)
There have been USB, Firewire, eSATA, SCSI external drives. Probably some others too.
(Some SCSI controllers have both internal and external ports.)
You can probably put NVME drive on PCIe outside of case (just like you can have GPU in external box).
GNOME automounts under /media, does it? (But CD/DVD/Bluray might show there too?)
Re: Detecting only external hard drives
Well you can certainly attach them via USB. I see nothing in the output from lshw -class disk to indicate that it's removeable:You can probably put NVME drive on PCIe outside of case (just like you can have GPU in external box).
Code: Select all
*-disk
description: SCSI Disk
product: SSD 960 EVO
vendor: Samsung
physical id: 0.0.0
bus info: scsi@11:0.0.0
logical name: /dev/sdd
version: 0209
serial: DD564198838A6
size: 931GiB (1TB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=6 logicalsectorsize=512 sectorsize=4096 signature=000ca4b0
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Detecting only external hard drives
This capability parameter actually saved me.I can seperate external storage by this way for my project.TrevorH wrote: ↑2021/08/04 16:56:10Well you can certainly attach them via USB. I see nothing in the output from lshw -class disk to indicate that it's removeable:You can probably put NVME drive on PCIe outside of case (just like you can have GPU in external box).
Code: Select all
*-disk description: SCSI Disk product: SSD 960 EVO vendor: Samsung physical id: 0.0.0 bus info: scsi@11:0.0.0 logical name: /dev/sdd version: 0209 serial: DD564198838A6 size: 931GiB (1TB) capabilities: partitioned partitioned:dos configuration: ansiversion=6 logicalsectorsize=512 sectorsize=4096 signature=000ca4b0
Thank you guys for your help.
Re: Detecting only external hard drives
I use minimal centos 7 and it didnt mount external hard drives that i've tried, and i've tried many.Whoever wrote: ↑2021/08/04 14:28:51The "external" hard drives are mounted by the desktop system.
If you don't have a desktop running, they won't be mounted. This would identify external drives.
If you do have a desktop running, then you could look at where the drives are mounted and use that to identify external drives,