4

I have an external USB 3.0 HDD with several partitions on it, and I can't safely remove it (spin it down) before unplugging in Ubuntu 15.04.

I can run "Unmount" on each partition; but after unmounting all partitions disk is still spinning (it vibrates and I hear the spinning), and I think it may be unsafe to unplug it in such condition.

There is a Safely Remove Drive context menu option in Nautilus, Safely remove parent device in left Unity panel, and there is the command udisks --detach /dev/sdb (recommended in this Ubuntu Forums post). After any of these actions HDD spins down for 0.4-0.5 seconds, and then it is detected again as plugged in; all its partitions are auto-mounted just like when I insert its USB cable for the first time.

In dmesg I see

[ 46.592192] usb 3-1: USB disconnect, device number 4
[ 47.003378] usb 3-1: new SuperSpeed USB device number 5 using xhci_hcd
...
[ 48.638436] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)

Click "Safely Remove Drive" for second time:

[ 68.815860] usb 3-1: USB disconnect, device number 6
[ 69.229567] usb 3-1: new SuperSpeed USB device number 7 using xhci_hcd
....
[ 71.199942] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)

How can I safely unmount and spindown an external HDD without having it get redetected in seconds?

1
  • 2
    I'm facing the same problem, the drive is mounted again automatically. How can we remove it safely then??? Aug 2, 2015 at 9:15

1 Answer 1

0

First of all, you must unmount all partitions mounted on the USB HDD, then try detach it. I gave an example below with udisksctl

1 Use lsblk to see your USB HDD and all mounted partition on it:

Shell@localhost:~$ lsblk
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   128M  0 part 
└─sda2   8:2    0 931.4G  0 part /
sdb      8:16   0 501.8G  0 disk 
└─sdb1   8:20   0 500.2G  0 part /USBDRIVE

2 Unmount all mounted partition for USB HDD

sudo umount /dev/sdb1

3 Power off the USB HDD using next command :

udisksctl power-off -b /dev/sdb

replace /dev/sdb with the correct USB HDD.

2
  • What are real actions done by "udisksctl power-off"?
    – osgx
    Jun 1, 2018 at 15:10
  • Arranges for the drive to be safely removed and powered off. On the OS side this includes ensuring that no process is using the drive, then requesting that in-flight buffers and caches are committed to stable storage. The exact steps for powering off the drive depends on the drive itself and the interconnect used. For drives connected through USB, the effect is that the USB device will be deconfigured followed by disabling the upstream hub port it is connected to. Jun 1, 2018 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.