0

Is it possible to disable disk using command line? I got spam like this:

[2245922.091035] ata3: EH complete
[2245922.150696] ata3.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[2245922.150701] ata3.00: irq_stat 0x40000001
[2245922.150703] ata3.00: failed command: FLUSH CACHE EXT
[2245922.150704] ata3.00: cmd ea/00:00:00:00:00/00:00:00:00:00/a0 tag 18
                          res 71/04:00:00:00:00/00:00:00:00:00/a0 Emask 0x1 (device error)
[2245922.150708] ata3.00: status: { DRDY DF ERR }
[2245922.150709] ata3.00: error: { ABRT }
[2245922.151027] ata3.00: configured for UDMA/33
[2245922.151030] ata3.00: device reported invalid CHS sector 0
[2245922.151034] ata3: EH complete
[2245922.238686] ata3.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[2245922.238692] ata3.00: irq_stat 0x40000001
[2245922.238696] ata3.00: failed command: FLUSH CACHE EXT
[2245922.238697] ata3.00: cmd ea/00:00:00:00:00/00:00:00:00:00/a0 tag 24
                          res 71/04:00:00:00:00/00:00:00:00:00/a0 Emask 0x1 (device error)
[2245922.238701] ata3.00: status: { DRDY DF ERR }
[2245922.238702] ata3.00: error: { ABRT }
[2245922.239043] ata3.00: configured for UDMA/33
[2245922.239047] ata3.00: device reported invalid CHS sector 0
[2245922.239053] sd 2:0:0:0: [sdd] tag#24 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
[2245922.239056] sd 2:0:0:0: [sdd] tag#24 Sense Key : Illegal Request [current]
[2245922.239058] sd 2:0:0:0: [sdd] tag#24 Add. Sense: Unaligned write command
[2245922.239060] sd 2:0:0:0: [sdd] tag#24 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
[2245922.239063] I/O error, dev sdd, sector 0 op 0x1:(WRITE) flags 0x800 phys_seg 0 prio class 3

the problematic disk not mounted and already removed from /etc/fstab

sdd             8:48   0 223.6G  0 disk
├─sdd1          8:49   0   1.9G  0 part
├─sdd2          8:50   0     1K  0 part
└─sdd5          8:53   0 221.7G  0 part

# 256GB GALAX SSD
#UUID=48c76170-0392-44ce-a8c6-f790673c8f32 /media/asd/galax250 ext4 noatime,user 0 0

haven't reboot since I'm still using the PC. It makes everything a bit laggy tho.

GALAX SSD

Kokizzu
  • 9,257
  • 12
  • 55
  • 82
  • 1
    `libata.force=3:disable` might work as a kernel parameter (should disable ata3), another example https://unix.stackexchange.com/a/255890/30851 — not sure about disabling it at runtime though – frostschutz Jun 06 '23 at 07:39
  • 1
    there is `delete` https://unix.stackexchange.com/a/103742/30851 but it's not quite the same as disabling the ata port – frostschutz Jun 06 '23 at 07:41
  • 1
    Ultimately, the only solution is to remove (and optionally replace) the failing disk. I hope you've been making regular backups. – cas Jun 07 '23 at 04:40

1 Answers1

2

The last line in the dmesg snippet indicates there is a failing write operation.

You can try:

echo 1 | sudo tee /sys/block/sdd/device/delete

Because of write caching, the application that sent the data to the disk was already "promised" that the data is as good as written, and the kernel will absolutely try to keep that promise. So as long as the disk seems to be available, the kernel will keep trying to write the data. This command tells the kernel to prepare the disk for hot-unplugging. If it works, /dev/sdd will vanish, and the kernel may attempt to spin down the disk if possible.

(If anyone knows how to explicitly tell Linux kernel "I order you to lose any cached write operations to this disk", feel free to write your own answer or edit it into this one.)

telcoM
  • 87,318
  • 3
  • 112
  • 232