The Computer Oracle

How to disable kernel probing for drive?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping

--

Chapters
00:00 How To Disable Kernel Probing For Drive?
00:40 Answer 1 Score 0
01:26 Accepted Answer Score 1
03:06 Answer 3 Score 5
03:31 Thank you

--

Full question
https://superuser.com/questions/599333/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #harddrive

#avk47



ANSWER 1

Score 5


I went and wrote a kernel patch for you that implements the ability to disable a single disk at boot time, so that you don't need to bother with disabling it in udev, or the waiting during the initial boot.

http://dev.gentoo.org/~robbat2/patches/3.13-libata-disable-disks-by-param.patch

Should apply to many kernels very easily (the line above it was added 2013-05-21/v3.10-rc1*, but can be safely applied manually without that line).




ACCEPTED ANSWER

Score 1


Two solutions here: one is fast to apply, although solves the problem only partially, the other one is the complete one but requires you to compile your own kernel.

The correct answer is a kernel patch.

Robin H. Johnson wrote a patch for the SATA kernel driver (find it in Unix/Linux stack exchange site) which hides completely the drive.

Update The patch is now upstream (at least in 3.12.7 stable kernel), see the git repository. I asked for backport in the Ubuntu launchpad.

Once the patch is installed, adding

 libata.force=2.00:disable

to the kernel boot parameters will hide the disk from the Linux kernel. Double check that the number is correct; searching for the device name can help:

(0)samsung-romano:~% dmesg | grep iSSD
[    1.493279] ata2.00: ATA-8: SanDisk iSSD P4 8GB, SSD 9.14, max UDMA/133
[    1.494236] scsi 1:0:0:0: Direct-Access     ATA      SanDisk iSSD P4  SSD  PQ: 0 ANSI: 5

Workaround

Answered by Unix StackExchange user Emmanuel in https://unix.stackexchange.com/a/103742/52205

You can at least solve the suspend problem by issuing the command

echo 1 > /sys/block/sdb/device/delete

before suspend.

To automate it, I added the following file: (note the flags, it must be executable)

-rwxr-xr-x 1 root root 204 Dec  6 16:03 99_delete_sdb

in the directory /etc/pm/sleep.d/

#!/bin/sh

# Tell grub that resume was successful

case "$1" in
    suspend|hibernate)
        if [ -d /sys/block/sdb ]; then
            echo Deleting device sdb 
            echo 1 > /sys/block/sdb/device/delete       
        fi
        ;;
esac

...and now the system suspends (and resume) correctly. I added the snippet

if [ -d /sys/block/sdb ]; then
      echo Deleting device sdb 
      echo 1 > /sys/block/sdb/device/delete     
fi

to /etc/rc.local too, for good measure.




ANSWER 3

Score 0


I have researched this and found a solution that can be implemented quite easily on Ubuntu. The distro uses kmod, so the following should work fine on that and any distro that uses kmod.

Depending on what driver you're using, you will need to blacklist it if you want to disable all SATA devices. Try lsmod | grep sata and figure out which driver(s) you're using. Then in your /etc/modprobe.d/ create a new file with echo blacklist (module) > blacklist.conf to add it to the blacklist. Rebuild your initramfs with mkinitramfs for it to take effect. Reboot.

Alternately, just add modprobe.blacklist=(module) to your kernel parameters.