9

I have samsung laptop with 30GB ExpressCache SanDisk SSD soldered on mainbord. SSD died (gives tons of errors when i try to access it somehow), but it is still probed on kernel boot, i see it's partition, ubuntu's unity shows unmounted drive icon in app drawer, and worst of all I can't suspend laptop, because sending suspend command to ssd device fails. I tried to pass sdb=noprobe kernel parameter, but it looks like it is obsoleted long ago in 3.8.0 kernel (Ubuntu 13.04). How can I disable sata device in recent kernels?

0

3 Answers 3

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.

2
  • Thanks @Rmano, echo stuff worked. But it is unclear, where should I place 99_delete_sdb executable file? In /etc/rc0.d/ maybe? Dec 9, 2013 at 0:44
  • Sorry --- added the relevant information.
    – Rmano
    Dec 9, 2013 at 2:48
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).

6
  • 1
    Thanks for your efforts. Perhaps you can comment (for those who are not so familiar with kernel patches), how to apply the patch and how to use it (probably sdb=disable as kernel parameter).
    – mpy
    Dec 8, 2013 at 9:28
  • 1
    kernel.org/doc/Documentation/applying-patches.txt covers applying kernel patches in general, but many distributions have specific methods of applying patches. This patch more specifically implements a 'disable' force flag for libata. The user will need to use it with libata.force=ID:disable where ID is a number or number.number tuple identifying the drive in question.
    – robbat2
    Dec 8, 2013 at 21:06
  • I do not know if this instructions: wiki.ubuntu.com/Kernel/BuildYourOwnKernel are up-to-date. I will try if I can this week...
    – Rmano
    Dec 9, 2013 at 3:09
  • By the way, in the case of the Samsung Laptop the command should probably be "libata.force=2.00:disable" (grep iSSD /var/log/syslog should give you an hint).
    – Rmano
    Dec 9, 2013 at 3:16
  • 1
    FYI, it's merged to the kernel for 3.13 as well as the stable kernel tree. The nodisable option was NOT accepted however.
    – robbat2
    Dec 18, 2013 at 8:49
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.

3
  • 1
    It will disable all sata devices including hard drive, so my laptop will not boot anymore. And sata support is compiled into kernel (not as a module), so I can't blacklist it. Sep 23, 2013 at 0:35
  • Okay, so then just open up your laptop and remove the drive...
    – Hector
    Sep 23, 2013 at 20:22
  • Unfortunately I am not competent enough to do it - it is soldered on mainbord, not attached via sata cable. I am not even shure that laptop will be functional if I just remove it. Sep 24, 2013 at 0:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .