4

I have an e-sata external enclosure with a port expander and 4 sata disks in it that I use for periodic backups. I have what I think is a sound method for powering it off, but not sure if it is the best method. After unmounting the filesystem and stopping the volume group on the disks, here is what I currently do:

echo 1 > /sys/block/sdg/device/delete 
echo 1 > /sys/block/sdh/device/delete 
echo 1 > /sys/block/sdi/device/delete 
echo 1 > /sys/block/sdj/device/delete

or

smartctl -s standby,now /dev/sdg
smartctl -s standby,now /dev/sdh
smartctl -s standby,now /dev/sdi
smartctl -s standby,now /dev/sdj

or

echo "scsi remove-single-device 5 0 0 0" > /proc/scsi/scsi
echo "scsi remove-single-device 5 1 0 0" > /proc/scsi/scsi
echo "scsi remove-single-device 5 2 0 0" > /proc/scsi/scsi
echo "scsi remove-single-device 5 3 0 0" > /proc/scsi/scsi

Of these options, I like the last one because it is the only one that writes something to the log, e.g.

sd 5:0:0:0: [sdg] Stopping disk
ata6.00: disabled
sd 5:1:0:0: [sdh] Synchronizing SCSI cache
sd 5:1:0:0: [sdh] Stopping disk
ata6.01: disabled
sd 5:2:0:0: [sdi] Synchronizing SCSI cache
sd 5:2:0:0: [sdi] Stopping disk
ata6.02: disabled
sd 5:3:0:0: [sdj] Synchronizing SCSI cache
sd 5:3:0:0: [sdj] Stopping disk
ata6.03: disabled

And then I flip the power swtich on the enclosure to remove power from the disks. I've never had problems with any of these methods, but I do get a lot of complaints from the ata device when I poweroff. This is what the log shows when turning off the enclosure (note the disks are synced and stopped by this point via one of the methods above, this is just from flipping the switch):

ata6.00: failed to read SCR 1 (Emask=0x40)
ata6.01: failed to read SCR 1 (Emask=0x40)
ata6.02: failed to read SCR 1 (Emask=0x40)
ata6.03: failed to read SCR 1 (Emask=0x40)
ata6.04: failed to read SCR 1 (Emask=0x40)
ata6.15: exception Emask 0x50 SAct 0x0 SErr 0x4490801 action 0xe frozen
ata6.15: irq_stat 0x00400040, connection status changed
ata6.15: SError: { RecovData HostInt PHYRdyChg 10B8B Handshk DevExch }
ata6.00: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen
ata6.01: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen
ata6.02: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen
ata6.03: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen
ata6.04: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen
ata6.15: hard resetting link
ata6.15: SATA link down (SStatus 0 SControl 300)
ata6.15: qc timeout (cmd 0xe4)
ata6.15: failed to read PMP GSCR[0] (Emask=0x4)
ata6.15: PMP revalidation failed (errno=-5)
  • Is there anything I can to do to cleanly stop the ata device (ata6.15 in this case) similar to how I deal with the block devices prior to poweroff?

Note: I have seen this question which might seem like a dupe at first glance, but it focuses on deregistering the disks and doesn't address the portion of my question about properly closing the ata bus device, if able.

casey
  • 14,754
  • Try for every device: smartctl -s standby,now device and/or what is documented here: http://www.met.reading.ac.uk/~swsellis/tech/linux/linux_scsi_hotswap.html To remove a SCSI device from the driver. – Johan Mar 26 '14 at 12:35
  • @Johan thanks for the suggestion and the link. I've added both methods to the Q but they all produce the same results upon powering off the enclosure. I'm not worried about the data on the disks, just curious if I can somehow notify the kernel that the ata device is going away and cleanly remove it. – casey Jun 18 '14 at 02:30

0 Answers0