You are not logged in.

#1 2017-06-20 10:08:02

kuruvi
Member
Registered: 2017-06-20
Posts: 3

How to hide a SCSI device

Hi all,

This is my post. Please correct me if I posted it in wrong forum.

I have few CD/DVD-ROM devices which are created by iSCSI Initiator.

The system creates different devices for these scsi devices,

/dev/sr*
/dev/sg*

and so on.

Is there anyway I can selectively hide SR* devices. Don't want to unload sr_mod and cdrom modules as these need to work for local CD/DVD ROM devices. Only need to hide connected iSCSI Targets.
These still needs to be accessible via /dev/sg*

Any suggestions?

Thanks
Bala

Offline

#2 2017-06-20 11:44:52

frostschutz
Member
Registered: 2013-11-15
Posts: 1,418

Re: How to hide a SCSI device

You can unbind. Be careful with that, it's easy to crash your system by unbinding the wrong thing.

# ls -l /sys/bus/scsi/drivers/sr
lrwxrwxrwx 1 root root    0 Jun 20 13:41 9:0:0:0 -> ../../../../devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9.1/3-9.1:1.0/host9/target9:0:0/9:0:0:0
--w------- 1 root root 4096 Jun 20 13:40 bind
--w------- 1 root root 4096 Jun 20 11:57 uevent
--w------- 1 root root 4096 Jun 20 13:40 unbind
# echo 9:0:0:0 > /sys/bus/scsi/drivers/sr/unbind

You can get it back by writing the same string to bind instead of unbind there. If it's a USB device, unplugging and replugging might do the same.

Last edited by frostschutz (2017-06-20 11:46:54)

Offline

#3 2017-06-20 12:19:15

kuruvi
Member
Registered: 2017-06-20
Posts: 3

Re: How to hide a SCSI device

frostschutz wrote:

You can unbind. Be careful with that, it's easy to crash your system by unbinding the wrong thing.

# ls -l /sys/bus/scsi/drivers/sr
lrwxrwxrwx 1 root root    0 Jun 20 13:41 9:0:0:0 -> ../../../../devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9.1/3-9.1:1.0/host9/target9:0:0/9:0:0:0
--w------- 1 root root 4096 Jun 20 13:40 bind
--w------- 1 root root 4096 Jun 20 11:57 uevent
--w------- 1 root root 4096 Jun 20 13:40 unbind
# echo 9:0:0:0 > /sys/bus/scsi/drivers/sr/unbind

You can get it back by writing the same string to bind instead of unbind there. If it's a USB device, unplugging and replugging might do the same.

Thank you very much. This solved the sr* name creation.

The device is still visible via "lsscsi"
I suppose it is querying from scsi bus devices. Is it possible to hide the device showing in "lsscsi"
Can a linux filter driver hide the information.

Thank you

Offline

#4 2017-06-20 12:22:51

frostschutz
Member
Registered: 2013-11-15
Posts: 1,418

Re: How to hide a SCSI device

No idea.

Hiding devices is a strange request in the first place. Why are you hiding them?

Programs that scan devices (such as LVM) usually have options to ignore specific devices (you can do filters in the lvm.conf).

Offline

#5 2017-06-20 13:11:07

kuruvi
Member
Registered: 2017-06-20
Posts: 3

Re: How to hide a SCSI device

Have few devices connected via iSCSI. They appears in the system.
Have another layer which runs on top to create ONE virtual device out of few (kind of RAID 0).
Ideally want to hide the individual devices from the system so that accidental write to one device wouldn't corrupt the RAID set.

Single iSCSI device/session has some performance limitation thus by having multiple session/device over iSCSI then having them on RAID-0 to improve the throughput.

Many Thanks

Last edited by kuruvi (2017-06-20 13:17:52)

Offline

Board footer

Powered by FluxBB