# steps to take before unplugging SATA drive

## peter4

Are there any extra steps I need to take before I unplug a SATA disk (other than unmounting it naturally)? If I just pull out the cable there are scary looking messages in dmesg, like

```
[18773.723950] ata5: exception Emask 0x10 SAct 0x0 SErr 0x4010000 action 0xe frozen

[18773.723954] ata5: irq_stat 0x00400040, connection status changed

[18773.723957] ata5: SError: { PHYRdyChg DevExch }
```

or 

```
[18785.074834] sd 4:0:0:0: [sdc] Stopping disk

[18785.074841] sd 4:0:0:0: [sdc] START_STOP FAILED

```

Though everything seems to be working fine afterwards. I wonder now, should I take some extra steps to warn the kernel that I'm about to disconnect the device? Or can I just rip it out like an USB drive?

----------

## Jaglover

Google says: http://www.sakana.fr/blog/2009/05/04/linux-sata-hot-plug-unplug/

----------

## peter4

Thanks, that seems to do the trick.

----------

## Mad Merlin

FWIW, I frequently hotplug and hotunplug SATA drives, and I've never had to tell the kernel to rescan or remove drives, it just works.

----------

## Ant P.

If you're paranoid:

```
hdparm -F /dev/sdb # force flush write cache

hdparm -Y /dev/sdb # spin down and switch off the drive completely (until the kernel makes it spin up again)
```

----------

## frostschutz

 *Mad Merlin wrote:*   

> FWIW, I frequently hotplug and hotunplug SATA drives, and I've never had to tell the kernel to rescan or remove drives, it just works.

 

Same here (as long as the controller is running in AHCI mode). Just plug / mount / umount / unplug same as with USB.

----------

