You are not logged in.

#1 2017-06-29 14:58:22

e2.gal
Member
Registered: 2011-08-16
Posts: 6

[Solved] External HDD doesn't turn off when ejected

Hello!

I have an external HDD, connected to USB.
When I try to eject the drive (by using Caja's "Safely Remove Drive" menu), it doesn't turn off.
How do I make it turn off my drive when I want to eject it?
I've tried it on Windows and Ubuntu 16.04 too, and both of them turned off my HDD when I eject it.

Last edited by e2.gal (2017-07-01 22:53:57)

Offline

#2 2017-06-29 20:50:08

dockland
Member
From: Sweden
Registered: 2015-06-06
Posts: 861

Re: [Solved] External HDD doesn't turn off when ejected

e2.gal

Have you installed hdparm?

https://wiki.archlinux.org/index.php/hdparm


I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.

Offline

#3 2017-06-29 23:08:37

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [Solved] External HDD doesn't turn off when ejected

Try with 'udisksctl power-off -b /dev/sdX'. If that doesn't work, 'unmount && sync && hdparm -Y /dev/sdX' should do the trick.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2017-06-30 13:17:19

e2.gal
Member
Registered: 2011-08-16
Posts: 6

Re: [Solved] External HDD doesn't turn off when ejected

R00KIE wrote:

Try with 'udisksctl power-off -b /dev/sdX'. If that doesn't work, 'unmount && sync && hdparm -Y /dev/sdX' should do the trick.

After unmounting the drive from Caja, I tried both of those commands but both of them failed to find the disk.

# udisksctl power-off -b /dev/sdc
Error looking up object for device /dev/sdc
# hdparm -Y /dev/sdc
/dev/sdc: No such file or directory

Looks like the device file disappeared after I eject it from Caja.

If I used that command without ejecting the drive from Caja, udiskctl gave me this:

# udisksctl power-off -b /dev/sdc
Error powering off drive: The drive in use: Device /dev/sdc1 is mounted (udisks-error-quark, 14)

It turns off successfully with the second command, though:

# umount /dev/sdc1 && sync && hdparm -Y /dev/sdc

/dev/sdc:
 issuing sleep command

But for me it's too inconvenient if I must do this everytime I want to unplug my drive.
Is there any way to make Caja do this when I choose Safely Remove menu?

The drive appears as /dev/sdc in my computer, by the way.

/dev/sdc1 on /run/media/e2.gal/Disk type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)

Last edited by e2.gal (2017-06-30 13:18:03)

Offline

#5 2017-06-30 14:24:57

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [Solved] External HDD doesn't turn off when ejected

From your description I'd say that the only way for you to power down the disk is really using hdparm. When you use udisksctl to power off a disk it will usually vanish from the system and that's most probably what caja is doing. Regarding how to make caja run your script instead of doing its thing I can't help, but I'd guess it's not going to be easy.

What you could do is create a script yourself and use zenity or something similar to give it a pretty gui.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#6 2017-07-01 22:53:37

e2.gal
Member
Registered: 2011-08-16
Posts: 6

Re: [Solved] External HDD doesn't turn off when ejected

R00KIE wrote:

From your description I'd say that the only way for you to power down the disk is really using hdparm. When you use udisksctl to power off a disk it will usually vanish from the system and that's most probably what caja is doing. Regarding how to make caja run your script instead of doing its thing I can't help, but I'd guess it's not going to be easy.

What you could do is create a script yourself and use zenity or something similar to give it a pretty gui.

Oh, okay. Thanks very much.

Offline

Board footer

Powered by FluxBB