Version: 4.6 (using KDE 4.6.1) OS: Linux I've been using an external (USB) had disk with multiple partitions and always used 'safely remove' from KDE device notifier (or Dolphin) to unmount all partitions and then disconnect the USB connection. Recently, I've noticed that the disk has developed errors, possibly due to removal before spin down. On Windows, after I do a 'safely remove', the lamp on the HDD goes a little dim and the manual says that it's then safe to disconnect the drive. On Linux, using the Palimpsest Disk Utility (http://library.gnome.org/users/palimpsest/ ), I can do a 'power down' and the same dimming of the lamp is observed. It'd be great (and safe) if this would automatically be done when unmounting from KDE. Otherwise, it's a risk to disconnect the drive even after 'safely removing' it. Reproducible: Always
*** Bug 292759 has been marked as a duplicate of this bug. ***
The new version of Palimpsest (or 'Gnome Disk Utility' or just 'Disks' in F17) doesn't have the 'Safe removal' option anymore. Now there's no (easy) way to power down the HDD on KDE or GNOME. :-(
Confirmed by duplicate.
This is always a problem. Some people want only a umount, some want eject and spin down. My guess is 1) umount is sufficient, and is the most proper way to deal with USB flash storage devices; 2) For CDROMs or other devices that can actually eject, eject is what most users want; 3) For external hard disks, an additional "hdparm -Y" is also welcome.
BTW, If you know you want to spin down your block device, just add an "hdparm -Y" to "/usr/lib/kde4/libexec/kdeeject" for the moment (before there can be a sophisticated solution).
My mistake. The proper place to spin down a hard drive seems to be in KDiskFree instead of the command line utility kdeeject.
Luka, any thoughts on this?
Created attachment 77554 [details] proposed patch to spid down the drive Can you try the attached patch?
For the patch to work you have to use udisk2.
Closing the thread for lack of activity. @Lukáš Tinkl Should we push this to master ? or just drop the patch?
Without proper feedback, nope
This is now the behavior in all major OS and DE: Windows, Mac OS, Gnome... KDE should also do it. This is far safer for disk drive to be shut before being unplugged.
*** Bug 324981 has been marked as a duplicate of this bug. ***
Voted +20 for this. This is a basic feature that (hopefully) extends the lifespan of external harddisks.
*** Bug 338912 has been marked as a duplicate of this bug. ***
Lukáš, what feedback do you need? Is this patch risky to apply?
Since most of us don't build kde by ourselves, it's better to just merge the patch with the testing / beta KDE branch. So that, when the package manager syncs the testing branch, it will be automatically applied and built and ready for testing. Let the beta tester do the test. The rest is simple. Patch maker should listen to the feedback and bug reports on the testing branch. If no serious issue reported during the testing period, the patch is ready to go stable branch.
So when can we get this patch applied please ? Meanwhile, we are using that stuff daily...
No need to force developers to implement a feature that they don't consider to be important. Because it's your removable hdds which are at risks, not their fixed hdds. I always power off my removable drive by issuing the following command after unmounting all mounted partitions on the particular drive. ``` udisksctl power-off /dev/sdb ``` Udisksctl comes from udisks2 package, which is installed by default on most distributions. That solves this problem without needs to apply this half-hearted patch.
Unfortunately, I cannot force anyone. The purpose is that they should just follow the common sense, and optionally listen to their users. KDE is propably the last modern environment not implementing this (at least, it works well on Gnome, Windows and Mac OS). Honnestly, I don't care there is a command line (I knew about this one). When you use KDE for working, you just don't want to throw a command every time you use external disks (in my case, often). Such dumb functionalities should be managed by the desktop environment. Again, that's common sense. Nothing else.
Hi, I have the exact same problem (an external usb drive not spinning down after ejecting). I just found this bugreport and I would love to help to get this worked out. Is there any way I can help? I'm just a common Kubuntu user so I don't have any advanced experience, but I definitely can do testing and give feedback.
The patch that needs testing is attached here.
(In reply to Christoph Feck from comment #22) > The patch that needs testing is attached here. Okay, after some googling, I've realized I'm treading much deeper water than I expected. (Yay, go newbies.) I'll still try and help, but in case anyone with more experience than me is reading this, feel free to pick this up, it'll probably be faster. :P Otherwise I'll, uh, get back if/when I get it to work.
I vote for reopening this bug. I can”t understand why it has status CLOSED/WONTFIX, this should be fixed.
There seems to be enough demand and 'activity' for this report. Reopening.
Hello guys, the following command has solved this problem (as root): # hdparm -B 127 /dev/sdb I've noted that previous value was 128 (never spin down)
Comment 26 does not work for me. Although "udisksctl power-off -b /dev/sdX" does work. How can I, in a Fedora 22 system can test the proposed patch? I am using plasma-workspace 5.4.2, framework 5.15.0 and applications 15.08.2. I suggest bumping this bug(or feature request) for plasma5 series.
The attached patch is of no use in frameworks I presume, judging from the date this was done in Qt4, so could somebody take care of this?
I'm willing to test this patch on KDE 4.14 (Kubuntu 14.04). Could a dev please give me a hint about where to start with compiling KDE4?
Ok, I've searched a lot and I think I need to compile "Solid" with kdesrc-build. If not possibile to just compile Solid (not sure about it), then I'm going to compile the whole "kdelibs". Please let me know if I'm in the right direction.
I modified the patch to work with the current git master branch. Should I attach it? I'm trying it on manjaro linux, plasma-desktop 5.5.5-1.1, kio 5.19.0-1, dolphin 15.12.2-1. Still, it doesn't work. I have an external usb drive with three partitions, when I choose "safely remove" on the last mounted partition, the hard disk is still spinning. udisks --detach works for me too.
I do hope this will get fixed eventually, my external HDD makes unhealthy screeching noises when I unplug it without letting it spin down. I can't imagine it being healthy in the long run - especially since it seems to trigger the "unexpected power loss" counter on S.M.A.R.T. statistics. The same HDD gracefully (and silently) spins down in windows.
Oh and all "udisksctl power-off /dev/sdx" does in my case is spin the HDD down.... then up again. OT: why can't I seem to find the vote link for this bug?
I am affected by this bug, HDD spins down and then right back up again and shows up in Device Notifier.
I think the udisks subsystem of KDE should distinguish between unmounting the partitions of a drive and safely removing the drive. Unmounting the mounted filesystem should be clearly assigned as unmount action. This is the dependency of safely remove. Safely removing the drive should ensure that all partitions are unmounted prior to powering off the drive. The proper graphical application to power off external disk is gnome-disk[1]. This application can be used as reference on how to implement power-off feature for safely removing external hard disks. Unfortunately, there is no equivalent app on KDE. [1] https://git.gnome.org/browse/gnome-disk-utility/ @Soukyuu: I mistyped the command. The proper udisksctl command to power off the drive is ``udisksctl power-off -b /dev/sdb`` ``udisksctl power-off --block-device /dev/sdb``
(In reply to Alivema4ever from comment #35) > I think the udisks subsystem of KDE should distinguish between unmounting > the partitions of a drive and safely removing the drive. > //snip Absolutely. Normally there are three actions to unload a mounted drive: unmount, power off, and eject. This does not take into account anything to do with the device mapper, or there can be more actions. To me it is acceptable to do all three by default, but it's obviously inconvenient if the other choices are not available in the context menu (right-click pop-up menu).
There is currently no way to remove external disks safely in KDE. `udisksctl power-off --block-device /dev/sdb` spins down the disk for about a second, before KDE spins it back up. Workarounds: 1) Turn off your computer, remove disk, turn on your computer. 2) Kill X server, udiskctl spin down, start X server Those workarounds should be satisfactory enough for everybody. /rant
5 years and this is still not fixed?! We're talking about users' hard disks undermining here, not just some random crash or arguable behiaviour.
*** Bug 371161 has been marked as a duplicate of this bug. ***
(In reply to David Polák from comment #37) > There is currently no way to remove external disks safely in KDE. > > `udisksctl power-off --block-device /dev/sdb` spins down the disk for about > a second, before KDE spins it back up. > Consider my vote added. > Workarounds: > 1) Turn off your computer, remove disk, turn on your computer. > 2) Kill X server, udiskctl spin down, start X server > > Those workarounds should be satisfactory enough for everybody. /rant Is this workaround successful for you? Step 1 Eject in dolphin 2 # hdparm -y /dev/sdb 3 Press HDD enclosure power button/Remove USB cable to external HDD Some more background to this. Turns out that most cheap external USB/SATA/firewire enclosures don’t properly issue a stop command to the drive when you flick the power switch. Instead, the power switch simply cuts power to the drive, which forces the drive to do an emergency head retract. If you think that sounds bad, you’re right. Emergency retracts aren’t going to brick your drive immediately, but if they occur regularly they’re putting a lot of unnecessary wear and tear on the drive. In fact, some drives monitor how often this happens with S.M.A.R.T. attribute 192.
Well, it's just shameful that KDE still can't power off an USB removable hard disk. Others DEs do it: Gnome, XFCE, Windows, MacOS... Perhaps LXDE. I still rely on Gnome Disk Utility (Disks) for safe removal of an external HD...
Created attachment 109812 [details] ~/.local/share/solid/actions/usb-drive-eject.desktop
Created attachment 109813 [details] ~/bin/usb-drive-eject Maybe this helps. (plus attachment of previous post) Works for me for > 2 years I never had the problem of respinning though
Me neither. My external backup hard drive always spins down after being ejected. Are people still experiencing this using KDE Frameworks 5.41+?
Yes. OpenSUSE 42.3, Nautilus (Gnome) spins down the disk, Dolphin in KDE session does not. But sadly I doubt it will be fixed some day.
(In reply to Nate Graham from comment #44) > Me neither. My external backup hard drive always spins down after being > ejected. > > Are people still experiencing this using KDE Frameworks 5.41+? Do you know a distro with the version of KDE Frameworks you mentioned so that I can report if it works on my PC? I'm currently on Kubuntu 16.04, KDE Frameworks 5.18.0. udisksctl works for me, but the "safe remove" from Dolphin doesn't spin down the disk.
I'm on Debian Testing, with KDE Plasma 5.10.4 and KDE Frameworks 5.37.0, and external drive is still not stopped when "safely" removing it.
Maybe I should check on KDE Neon live cd, that should have latest KDE, yes?
The problem is still present with KDE Neon (KDE Frameworks 5.41). The script usb-drive-eject works when launched from the CLI. The .desktop launcher does not work, I receive the following error message: "The desktop entry of type Service is unknown".
@Davide Click Device manager icon in toolbar Click 'actions for ...' for a mounted partition. You should see something like 'Eject' or 'Auswerfen' Click that and you disk should power down.
(In reply to Michael Heidelbach from comment #50) > @Davide > Click Device manager icon in toolbar > Click 'actions for ...' for a mounted partition. > > You should see something like 'Eject' or 'Auswerfen' > Click that and you disk should power down. Thanks! Previously I forgot to move the .desktop file in the correct folder. I now see the action for the external disk.
I use 'hdparm -y' to spin down the external SATA disk. This command needs root privileges, so I am wondering whether (or how) Solid could do it without root access.
(In reply to Christoph Feck from comment #52) > I use 'hdparm -y' to spin down the external SATA disk. This command needs > root privileges, so I am wondering whether (or how) Solid could do it > without root access. $ udisksctl power-off -b ... can do for unpriviledged users. $ dbus --system org.freedesktop.UDisks2 /org/freedesktop/UDisks2/drives/TOSHIBA_MQ01UBD100_44K3TR2HT void org.freedesktop.UDisks2.Drive.PowerOff(QVariantMap options) also looks promising. Couldn't use it with qdbus due to (QVariantMap options)
Yeah, external HDDs still don't spin down with the safe remove option for me. Seconded on the uncomfortable noise coming from the HDD if you just pull it out - it can't be good for the drive. Power off has been the default option in all Windows' except 7 I think, and Thunar, Nautilus etc. and their respective DEs do power off HDDs if you press Eject. A big vote from me for fixing this.
As a user who prefers not to fiddle with terminal commands to do something simple as powering off an ext. HDD, I second this. Either a) provide option in Device Notifications to power off HDDs that support it or b) make unmount from Device Notifications automatically power off HDDs that support it
I can confirm this on Kubuntu 18.04, KDE frameworks v. 5.44.0. Cutting the connection manually after "safely removing" a drive makes an awful noise and leaves me wondering each time how many days I've shaved off of the drive's life time. Seriously though, this seems like such an important issue that I really do need to ask why this has yet to be addressed after 5 years? I would absolutely understand if this were an incredibly complex and novel problem that nobody in the Linux world has been able to fix yet, but it seems like all distros outside of KDE have found a solution for it. So what gives? If there is any additional information you need us to provide to help with tracking this down, please let us now. I'm sure that everyone subscribed to this bug report is annoyed enough by this issue to invest as much time as they can to help with fixing it.
Can Framework's specific method of ejecting a harddrive be invoked from the command line, for debugging purposes?
We don't need more information; what we need is for someone who has familiarity with the code involved to fix it. In FOSS, the general limitation is manpower.
@Michael Heidelbach: Thanks a lot for the custom eject action! I've just set it up and it seems like it's working perfectly so far. @Nate: I understand. I'm sorry if my last comment came off as antagonistic. I appreciate all the time and effort you and all the other KDE contributors put into these projects. It's just that issues with the core system like these can be very frustrating sometimes – especially if they've been open for so long and you feel like there's nothing you can do to help move things along. I really do hope that somebody picks this up eventually.
I do too! :)
*** Bug 393632 has been marked as a duplicate of this bug. ***
(In reply to Nate Graham from comment #58) > We don't need more information; what we need is for someone who has > familiarity with the code involved to fix it. In FOSS, the general > limitation is manpower. Can't we implement the script someone provided here as the solution for the bug? This should get fixed immediately and this could work somehow?
I did not have success with the .desktop file that was attached in this thread, but I did with this other one found on Reddit so I'm copy pasting it: "I think I've found a workaround (at least for me). Create a file called poweroff.desktop at ~/.local/share/solid/actions/ with the following content: [Desktop Action open] Exec=solid-hardware unmount %i && udisksctl power-off -b %d Icon=kt-stop Name=Power off device [Desktop Entry] Actions=open; Type=Service X-KDE-Action-Custom=true X-KDE-Solid-Predicate=[ IS StorageVolume AND StorageVolume.ignored == false ] Then log out and in again. The file creates a new entry for the device notifier in the control panel to power off the device. The command first unmounts the drive and then powers it off. In contrast to OP's experience my external HDD stays off and doesn't restart again." - by a user who's now deleted his post or even account
(In reply to Filip from comment #63) > I did not have success with the .desktop file that was attached in this > thread, but I did with this other one found on Reddit so I'm copy pasting it: > > "I think I've found a workaround (at least for me). Create a file called > poweroff.desktop at ~/.local/share/solid/actions/ with the following content: > > [Desktop Action open] > Exec=solid-hardware unmount %i && udisksctl power-off -b %d > Icon=kt-stop > Name=Power off device > > [Desktop Entry] > Actions=open; > Type=Service > X-KDE-Action-Custom=true > X-KDE-Solid-Predicate=[ IS StorageVolume AND StorageVolume.ignored == false ] > > Then log out and in again. The file creates a new entry for the device > notifier in the control panel to power off the device. The command first > unmounts the drive and then powers it off. In contrast to OP's experience my > external HDD stays off and doesn't restart again." - by a user who's now > deleted his post or even account i had to modify this a little bit to make it work with the latest edition of plasma: [Desktop Action open] Exec=udisksctl unmount -b %d; udisksctl power-off -b %d Icon=kt-stop Name=Power off device [Desktop Entry] Actions=open; Type=Service X-KDE-Action-Custom=true X-KDE-Solid-Predicate=[ IS StorageVolume AND StorageVolume.ignored == false (changed solid-hardware unmount to udisksctl unmount)
Adding to this request. Every other distro I have used powers off the spinning HDDs when "ejecting" or "safely removing". This is a fundamental behavior and can cause damage to drives when people are on KDE but muscle memory from other distros takes over. Please either build in the power off to "safely remove drive" as other distros do, or add another option that does include powering down like "eject and poweroff" etc. Users shouldnt need to take multiple steps in disk utilities or the terminal to do this simple task.
Git commit 867f53608d3a5145e3380e8c1686f40be8f06c31 by Stefan Brüns. Committed on 08/10/2018 at 19:42. Pushed by bruns into branch 'master'. [UDisks2] Power down drive on remove if supported Summary: It is preferable to to do a controlled shutdown prior to disconnecting and eventually cutting of power to the drive. Closes T9730 Test Plan: Connect external drive, select "Savely Remove" from context menu 1. if drive has only on partition, fs is unmounted and drive spins down 2. if drive has multiple partitions: a) first (not last) partition can be unmounted and remounted b) "Remove"ing last partition spins down drive Reviewers: #frameworks, ngraham, broulik Reviewed By: ngraham, broulik Subscribers: broulik, kde-frameworks-devel, ngraham Tags: #frameworks Maniphest Tasks: T9730 Differential Revision: https://phabricator.kde.org/D15932 M +10 -1 src/solid/devices/backends/udisks2/udisksstorageaccess.cpp https://commits.kde.org/solid/867f53608d3a5145e3380e8c1686f40be8f06c31
*** Bug 399792 has been marked as a duplicate of this bug. ***
External HDD now spins down in Debian Buster! Thanks!
And powering off an external drive can be a real pain, as I then need to physically unplug and re-insert as device if I want to use it again. I may well want to unmount a device (as I don;t need it "now"), but leave it plugged in as I may need it later. So I've opened https://bugs.launchpad.net/ubuntu/+source/dolphin/+bug/1827778 to re-add the option to *just* unmount a device.