I'm currently developing a program that fetches and validates the information inside 5 SSDs at the same time. My problem is the command I'm using to scan the drives (/sbin/rescan-scsi-bus
) takes too long and sometimes freezes my program or the entire computer. So what I'm looking for is a way to scan the SSDs even if I need to change some environment variables or so. I'm using a test board to perform this scan and I've tried other commands like the following:
echo 1 > /sys/block/sdX **with** echo "- - -" | tee /sys/class/scsi_host/host?/scan
/sbin/rescan-scsi-bus --luns=0 --ids=0 --channels=0
/sbin/rescan-scsi-bus # with other parameters
And a bash command to delete all disks except the one that has the OS mounted.
echo 1 > /sys/block/sdX
andecho "- - -" | tee /sys/class/scsi_host/host?/scan
supposed to be two separate commands ?echo 1 > /sys/block/sdX
and then scanning all of them with theecho "- - -" | tee /sys/class/scsi_host/host?/scan
command.