How can I safely remove my USB hard drive in Fedora 17?

29,129

Solution 1

After a lot of web surfing I came across the solution suggested by someone in askubuntu.com. Thank you everybody. I just needed to install udisks package! To power off my hard disk I have to enter the following command in terminal after unmounting all of its partitions:

udisks --detach /dev/sdX

Solution 2

There is no safe removal button for the USB drive. You can eject the USB drive by clicking the small triangle which is on the side of the USB drive.

For ejecting a flash drive follow these steps:

  1. First see the USB drive by entering this command:

    fdisk -l
    
  2. Assuming your USB drive is /dev/sdb1, eject it with the following command:

    umount /dev/sdb1
    

    Alternatively:

    eject /dev/sdb1 
    

This will allow you to safely remove your USB drive.

Solution 3

Try

eject /dev/sdX

where X is the letter of your device.

Edit

You can find all available drive letters by using fdisk -l.

Solution 4

As of Ubuntu 20.04

udisksctl power-off -b /dev/sdb turns off the LED of an external HDD.

Note: regarding eject, it apparently has multiple methods that it tries until one of them "succeeds" (use -v to see what's going on). Nothing really helped:

  • eject -v /dev/sdb tried CDROM ejection and reported success, but didn't actually do anything (no LED changes, no dmesg messages)
  • eject -v --scsi /dev/sdb (explicitly chosen method) actually succeeded in ejecting, but the drive was detected right back (as evidenced by dmesg)
Share:
29,129
Mehrdad
Author by

Mehrdad

Updated on September 18, 2022

Comments

  • Mehrdad
    Mehrdad almost 2 years

    In Fedora 17, when I want to plug my USB hard disk out, I can only unmount it. But the problem is that the hard drive won't be powered off so that I can plug it out.

    In some other distros like Ubuntu there is a Safely Remove option which powers the hard drive off.

    How can I fix that?

    • slhck
      slhck over 11 years
      Does hdparm -y /dev/sdX work?
    • Mehrdad
      Mehrdad over 11 years
      Nope sir. This command removes the drive name from nautilus menu but does not power it off.
  • slhck
    slhck over 11 years
    Could you explain how to find out what the device letter is? I would assume this can be confused quite easily.
  • Mehrdad
    Mehrdad over 11 years
    This did not help. I also checked eject's man page in which it is written that this command does the same as umount according to the device in use.
  • vonbrand
    vonbrand over 11 years
    eject /media/THE_DISK should also work (if it is mounted there). @Mehrdad, don't believe too much what manuals say. They might be wron (report to bugzilla if so).
  • Lorenzo Von Matterhorn
    Lorenzo Von Matterhorn about 11 years
    @Josiah please mention fdisk -l in your answer as the means to check drive letters, or any other mean you find appropriate.
  • Matthew Walker
    Matthew Walker about 9 years
    The "little triangle" can be found under Activities > Files and by locating the USB drive on the left pane. The icon is to the right of the USB drive's label.
  • gluk47
    gluk47 over 8 years
    As of ubuntu 15.10, this seems to be udisksctl power-off -b /dev/sdb. BTW, as a response, my HDD switched off its light but still emitted noise and vibration until I physically plugged it off.
  • Totem
    Totem over 7 years
    @gluk47's comment is worked for me on ubuntu 16.04. Though my hard-drive did fully power down.
  • gluk47
    gluk47 over 7 years
    If you are not root, you can still get an idea what the drive letter is, using blkid.
  • tdwong.star
    tdwong.star about 3 years
    On Ubuntu 16.04, sudo eject /dev/sdX1 works for me. To find out which device letter is, use mount | grep /dev/sd