I have a Samsung laptop (Chronos s7) with one SATA hard disk on bus ata:1, which is detected as /dev/sda, an 8G SSD on ata:2, /dev/sdb, and various other devices on the rest of SATA interface.
The problem is that the SSD disk is
- soldered to the main board (unmovable)
- busted (it just gives I/O errors for any operation)
- it does not appear in the bios (probably because it is broken)
Now this disk:
- delays the boot three to five minutes trying to probe the failing disk, which is annoying;
- but the most annoying thing is that the system fails to suspend due to
/dev/sdbfailing.
Notice that I can live with the delay at boot — what worries me is the resume/suspend thing.
So the question is: can I tell the kernel to avoid even probing the device on ata:2?
In older kernel (<3.0), when I was still able to dig a bit into the source, there was a command-line parameter of the style hdb=ignore that would have done the trick.
I have tried all the tricks proposed below with udev and libata:force kernel parameters, to no avail. Specifically, the following does not work:
-
Adding to one of the following
/etc/udev/rules.d/a file (in early execution like00-ignoredisk.rulesor in late as99-ignoredisk.rulesor in both places)SUBSYSTEMS=="scsi", DRIVERS=="sd", ATTRS{rev}=="SSD ", ATTRS{model}=="SanDisk iSSD P4 ", ENV{UDISKS_IGNORE}="1"nor
KERNEL=="sdb", ENV{UDISKS_IGNORE}="1"nor a lot of intermediate solutions — this makes the disk not accessible after boot, but it is probed at boot, and still checked when suspending — causing the suspend to fail.
-
Editing the system files
/lib/udev/rules.d/60-persistent-storage.rules(andudisks,udisks2) changingKERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-|md", GOTO="persistent_storage_end"
to
KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-|md|sdb*", GOTO="persistent_storage_end"
again, this has some effect, masking the disk from userspace, but the disk is still visible to the kernel.
-
Booting with all the possible combinations (well, a lot of them) of the
libata:forceparameters (found for example here) in order to disable DMA, lower speed or whatever about the failing disk — does not work. The parameter is used, but the disk is still probed and fails.Full
udevadm info -a -n /dev/sdbpasted to http://paste.ubuntu.com/6186145/smartctl -i /dev/sdb -T permissivegives:<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e694898992a695878b95938881cb94898b878889">[email protected]</a>:/home/romano# smartctl -i /dev/sdb -T permissive smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.8.0-31-generic] (local build) Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net Vendor: /1:0:0:0 Product: User Capacity: 600,332,565,813,390,450 bytes [600 PB] Logical block size: 774843950 bytes >> Terminate command early due to bad response to IEC mode page
which is clearly wrong. Nevertheless:
<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7d0f1212093d0e1c100e08131a500f12101c1312">[email protected]</a>:/home/romano# fdisk -b 512 -C 970 -H 256 -S 63 /dev/sdb fdisk: unable to read /dev/sdb: Input/output error
(SSD data from http://ubuntuforums.org/showthread.php?t=1935699&p=11739579#post11739579 ).
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
libata does not have a noprobe option at all; that was a legacy IDE option…
But I went and wrote a kernel patch for you that implements it. It 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).
Update The patch is now upstream (at least in 3.12.7 stable kernel). It is in the standard kernel distributed with Ubuntu 14.04 (which is based on 3.13-stable).
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 (obviously, you have to check the kernel messages before adding the boot parameters):
(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
The important number is the ata2.00 in the first line above.
Method 2
Hardware problems have physical hardware solution.
Did you consider to unsolder or cut the power supply of the drive ?
EDIT: Ok if thats not an option people are using this before to hot-plug a hard drive. You could use that to disable your drive.
echo 1 > /sys/block/sdb/device/delete
Note that any other process can force a scan of the SATA bus, and then makes it to be back. Try to do that just before hibernating the laptop.
Edited by OP: it worked. I added the following file :
-rwxr-xr-x 1 root root 204 Dec 6 16:03 99_delete_sdb
with content:
#!/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.
Method 3
BIOS
Does this device not show up in any type of way via your BIOS?
Often times HDDs are configured in an “auto” mode, I would go through and make sure that these devices are in a disabled state and even go to the extent of explicitly enabling only the one HDD and disabling everything else.
Kernel Boot Options
Often times you can disable various subsystems from being auto-detected by the booting Linux Kernel through the use of different boot options that can be passed to it as switches.
Most if not all of the options are listed here:
Linux in a Nutshell book
You might want to skim through the O’Reilly book, Linux Kernel in a Nutshell, specifically, Chapter 7: Customizing a Kernel.
This book is made available for free by its author, Greg Kroah-Hartman, on his personal website. The entire book can be downloaded as well.
Method 4
Linux way to check for lock: sudo hdparm -I /dev/sdX (with X = a..z ; you must know what device your drive is, of course). At the end of the (big) output, you MUST be able to read at in the last 10 lines: *not* locked.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0