Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: Proper way to plug/unplug an eSATA hard disk?

  1. #1

    Question 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. #2
    Join Date
    Feb 2008
    Location
    Linuxland
    Posts
    4,752

    Default

    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.

  3. #3
    Join Date
    Oct 2009
    Posts
    1,993

    Default

    Unmount, then pull wire.

  4. #4
    Join Date
    Jul 2008
    Location
    Greece
    Posts
    3,766

    Default

    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.

  5. #5
    Join Date
    May 2007
    Location
    Third Rock from the Sun
    Posts
    6,532

    Default

    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).

  6. #6

    Default

    Quote 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?

  7. #7

    Default

    Quote 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.

  8. #8

    Default

    Quote 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]?

  9. #9
    Join Date
    Jul 2008
    Posts
    29

    Default

    Quote 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.

  10. #10
    Join Date
    Jul 2008
    Location
    Berlin, Germany
    Posts
    790

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •