Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, Is there a proper command that I should be running before unplugging a SATA hard drive from my motherboard's SATA port? Assuming my motherboard supports SATA hot-swapping of course, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Apr 2008
    Posts
    128

    Properly removing SATA hard drives(hot-swap)


    Hi,

    Is there a proper command that I should be running before unplugging a SATA hard drive from my motherboard's SATA port? Assuming my motherboard supports SATA hot-swapping of course, and that the drive has already been unmounted(or never mounted in the first place)

    I notice that when I just unplug the drive and run "fdisk -l", it will hang there for 10-20s before completing. This seems to indicate that there's a duration where the PC is trying to detect the drive but it isn't there, then it times out.

    So, is there a way for me to let the OS/PC know right before I unplug, that it should switch off the HDD and remove it from its list of detected devices?

    I'm using Mandriva 2009 btw.

    Thanks!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,677
    Since you indicate that you have unmounted the drive, and then unplugged it (detached the sata/esata cable), then look in /dev for the drive id (sda, sdb, ...). If it is gone, then fdisk -l should not "hang". Sometimes it takes a minute for the system to recognize that it is gone. I also recommend that you do a sync command before unmounting the drive, just to be sure that all the cached data has been flushed to the drive. The umount command should do this, but it's better safe than having a corrupted drive.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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