Announcement

Collapse
No announcement yet.

Proper way to plug/unplug an eSATA hard disk?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Proper way to plug/unplug an eSATA hard disk?

    For my Linux hardware problems, Google is often my friend. Unfortunately with regard to SATA hot-plug (or hot-swap) support under Linux, all the links I've come across refer to solutions several kernel releases out-of-date.

    The problem: what is the proper procedure (on the software/OS side) to follow when plugging or unplugging an (e)SATA drive? Is a simple "umount /dev/sd[:alpha:][:digit:]" enough?

    Among the "obsolete" solutions I've come across is to use a program called "scsiadd":

    /usr/sbin/scsiadd -s
    scsiadd:scsiadd(): could not open /proc/scsi/scsi (w): No such file or directory

    Also SATA hot-plugging is as yet unsupported by the wonderful new devkit framework. To unplug a USB drive, I use "devkit-disks --detach /dev/sd[:alpha:]" or its GUI "safely remove hardware" equivalent. This doesn't work with the eSATA interface of my external hard disk enclosure.

    To be sure, an examination of the contents of /dev/ shows Linux gracefully removing the nodes (both disk and partition) for an unplugged eSATA drive. This is confirmed by the dmesg output.

    (Note: I have enabled AHCI and disabled IDE mode for SATA in the motherboard BIOS, so SATA device recognition is not the issue. I'm looking for the proper or most elegant way to unplug/replug an eSATA drive.)

  • #2
    I'm not completely sure on how devkit-disks does it, but have you tried eject -s /dev/sdX? A scsi eject might be the proper way.

    Comment


    • #3
      Unmount, then pull wire.

      Comment


      • #4
        I see you said "(e)SATA" and not "eSATA". If you're under the impression that all normal SATA drives can be unplugged, you're wrong. Your SATA controller has to specifically support this. If it doesn't say anything about SATA hotplugging, then it's not supported. Trying it should be safe, but there's always a chance of hardware damage.

        eSATA is always hotpluggable.

        Comment


        • #5
          It would help if you would specify your chipset on your motherboard. As RealNC said some chipsets do not support hotplugging in linux (Some AMD chipsets come to mind).

          Comment


          • #6
            Originally posted by deanjo View Post
            It would help if you would specify your chipset on your motherboard. As RealNC said some chipsets do not support hotplugging in linux (Some AMD chipsets come to mind).
            lspci gives it as:

            SATA controller: ATI Technologies Inc SB700/SB800 SATA Controller [AHCI mode]

            I'm assuming it does, since Linux appears to recognize that the disk has been unplugged or plugged. The "links" for both disk and partition (for example, /dev/sdb and /dev/sdb1) disappear when unplugged and appear when unplugged. This is not the case when I ran the disk in IDE mode (where the disk and partition were registered as /dev/hda and /dev/hda1).

            So my problem then is figuring out a more graceful way to, let's say, power down the drive. For USB, "devkit-disks --detach /dev/sdb" is able to turn off the LED of my USB Flash Drive. I see that as proof that the UFD has been turned off.

            Is there a software means of powering off an eSATA drive?

            Comment


            • #7
              Originally posted by droidhacker View Post
              Unmount, then pull wire.
              What I've read thus far says it should be power down first before pulling off wire.

              Comment


              • #8
                Originally posted by RealNC View Post
                eSATA is always hotpluggable.
                What then do you do on the software side before unplugging? Is it a simple "umount /dev/sd"[drive letter]?

                Comment


                • #9
                  Originally posted by An(noymous)droid View Post
                  What then do you do on the software side before unplugging? Is it a simple "umount /dev/sd"[drive letter]?
                  after unmounting the device, to "power off" (or sleep) the unit:

                  Code:
                  hdparm -Y /dev/sdX
                  (where X represents the device you wish to power off. for example: /dev/sdb)

                  this will power the drive down allowing for it's removal w/o risk of voltage surge.

                  Comment


                  • #10
                    All SATA and eSATA hardware is physically able to be hotplugged (ie. not damaged if you insert/pull the plug).

                    How the chipset and driver handles this is another question. Some driver/chipset combinations do not properly handle hotplugging and need a warmplug command such as the following one:
                    Code:
                    echo 0 - 0 > /sys/class/scsi_host/hostX/scan
                    Replace X with the appropriate number for your SATA/eSATA port.

                    Comment

                    Working...
                    X