Bug 377253

Summary: Show option to format USB drive in context menu
Product: [Frameworks and Libraries] frameworks-kio Reporter: Gregor Mi <codestruct>
Component: PlacesAssignee: KIO Bugs <kio-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: AmpleSpencer, bharadwaj.raju777, bugseforuns, claudius.ellsel, dev.bacteriostat, elvis.angelaccio, f.alexander.wilms, gudvinr+kde, hasannisanci, jeremy9856, jgqehj55, justin.zobel, kbarcza, kde, kdelibs-bugs, kfm-devel, luwx, nate, null, p.wibberley, postix, private, ricardo_0617, rockonthemoonfm, rosswzyang, safeerpasha7, toolforger
Priority: HI Keywords: usability
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 224056    
Attachments: UI Mockup

Description Gregor Mi 2017-03-05 19:30:25 UTC
CURRENT SITUATION:

1. Insert an USB stick
2. Open the "Device Actions" (Device Notifier -> Storage Volume -> click the item that represents the USB stick "14,7 GiB Removable Media")
3. Two device actions are popping up
- Open with File Manager 
- Download Photos with digiKam

WISH:

1. Show the filesystem type (FAT32, EXT4, NTFS).
2. Have an option to reformat the drive to another filesystem.

USE CASE:

I tried to copy a 4,3 GiB iso image to the stick and after 4 GB there was an error message (it did not say the exact reason). The next step would be to find out the reason (current filesystem is FAT32) and then to reformat the drive and then copy the file again.
Comment 1 Kai Uwe Broulik 2017-03-05 19:39:55 UTC
Imho a super-destructive action such as formatting a drive should not be presented in the main UI.

Also, KIO could have told you that the file system didn't support such a file size :P
Comment 2 Gregor Mi 2017-03-05 19:51:57 UTC
What about having "expert" options? In Windows they use the Shift key to show more advanced options. (I personally am not really fond of this key pressing concept but in the field it works fine)

On the other hand, reformatting an USB stick is not an uncommon operation:

One could add a link to a partitioning program (gparted, KDE Partition Manager, YaST Partitioner). These normally show a warning that formatting a drive is a destructive business. :)

When a friend calls me and asks why his/her DVD movie file does not fit on the newly bought big-sized USB stick it would be nice to have something simple to explain.
Comment 3 Nate Graham 2018-03-25 13:39:17 UTC
Maybe a sane option here would be adding an option "Manage with KDE Partition Manager" or something like that. Then it could also expose a servicemenu option that could be accessible in Dolphin.
Comment 4 Andrius Štikonas 2018-03-25 13:53:11 UTC
(In reply to Nate Graham from comment #3)
> Maybe a sane option here would be adding an option "Manage with KDE
> Partition Manager" or something like that. Then it could also expose a
> servicemenu option that could be accessible in Dolphin.

KDE Partition Manager is already accessible from Dolphin. Right click on Available Space->More->KDE Partition Manager. So I am not sure why this bug is assigned to me. 

Dolphin can also (maybe optionally) link to KPMcore library and allow do perform those operations directly but like Kai Uwe Broulik said, it might not be good to expose destructive actions there.
Comment 5 Gregor Mi 2018-03-25 15:18:33 UTC
I often read the argument that a destructive action should not easily accessible. One question and one observation from my side:

Question: are there reports of users that lost their data because such an action was easily accessible? Provided that enough warning messages were implemented which inform the user what he/she is about to do.

Observation: If I cannot find a GUI to do a task I want/need to to, I search the web to find shell commands. I consider the risk for the average user to do something wrong with these commands considerably higher. 

> Maybe a sane option here would be adding an option "Manage with KDE Partition Manager" or something like that. Then it could also expose a servicemenu option that could be accessible in Dolphin.

+1 to link to an already existing program like KDE Partition Manager. The menu could even be named "Format/Manage with KDE Partition Manager".
Comment 6 jeremy9856 2018-03-25 18:12:58 UTC
Like Nautilus (at least on Ubuntu) and the Windows file explorer, having an option to format external devices such usb and memory card by right clicking on the device and formatting it with an optional luks passphrase would be a nice thing to have.
Comment 7 Nate Graham 2018-03-25 19:10:25 UTC
Andrius, the idea is to allow two specific use cases:

- Plug in a new device -> device notifier plasmoid has a "manage with KDE Partition Manager" entry
- Right-click on a device in the Devices section in Dolphin's Places panel -> a menu item has a "manage with KDE Partition Manager" entry

Either of them would, when executed, open KDE Partition Manager with the target disk/volume pre-selected.

My sense is that the app itself would have to export these services (KIO might need extra support to show it in the Places panel context menu though), but let me know if I'm barking up the wrong tree.
Comment 8 Andrius Štikonas 2018-03-25 19:25:55 UTC
(In reply to Nate Graham from comment #7)
> Andrius, the idea is to allow two specific use cases:
> 
> - Plug in a new device -> device notifier plasmoid has a "manage with KDE
> Partition Manager" entry
> - Right-click on a device in the Devices section in Dolphin's Places panel
> -> a menu item has a "manage with KDE Partition Manager" entry
> 
> Either of them would, when executed, open KDE Partition Manager with the
> target disk/volume pre-selected.
> 
> My sense is that the app itself would have to export these services (KIO
> might need extra support to show it in the Places panel context menu
> though), but let me know if I'm barking up the wrong tree.

Ok, so on KDE Partition Manager side we just need to restore functionality to filter other devices (which was lost when somebody ported it away from Solid), i.e. "partitionmanager /dev/sda" only shows /dev/sda (which is quite easy to do codewise).

But I think the rest of the stuff must be done on Pasma device notifier side and similarly on Dolphin. If dolphin can find KDE Partition Manager when you right click on available space widget, it should be possible to reuse the same menu when right clicking on the device.
Comment 9 Nate Graham 2018-03-27 21:23:05 UTC
(In reply to Andrius Štikonas from comment #8)
> Ok, so on KDE Partition Manager side we just need to restore functionality
> to filter other devices (which was lost when somebody ported it away from
> Solid), i.e. "partitionmanager /dev/sda" only shows /dev/sda (which is quite
> easy to do codewise).
> 
> But I think the rest of the stuff must be done on Pasma device notifier side
> and similarly on Dolphin. If dolphin can find KDE Partition Manager when you
> right click on available space widget, it should be possible to reuse the
> same menu when right clicking on the device.

At least in Dolphin, KService entries provided by individual apps are available via [right-click] > Actions. That's kind of what I had in mind. But I can look into your idea too.
Comment 10 Nate Graham 2018-03-27 21:24:11 UTC
Regarding being able to open partitionmanager targeting specific disks, do we have a bug tracking that work, or is too trivial?
Comment 11 Andrius Štikonas 2018-03-27 21:50:11 UTC
(In reply to Nate Graham from comment #10)
> Regarding being able to open partitionmanager targeting specific disks, do
> we have a bug tracking that work, or is too trivial?

There is no tracking bug. The coding part is simple. But it might need coordination with Adriaan de Groot (Calamares) as this might need a new API in KPMcore (we need to tell the KPMcore library which devices we want to ignore) if  we decide to do the filtering in the library.

See e.g. https://cgit.kde.org/kpmcore.git/tree/src/plugins/sfdisk/sfdiskbackend.cpp?id=ad863cc6b107e97fdcb903d571d4bc6b633f74f5#n62

Right now there is an argument to ignore read only devices (I think Calamares uses it). Camalares might also be interested in some other filters (e.g. not ISO9660). So the issue is not the difficulty of coding, but more like what should the new API look like, so that we won't need to change it again.

On the other hand, we might let KPMcore library just scan all devices and try to filter devices at the GUI level (KDE Partition Manager, not the library) in partitionmanager/src/gui/listdevices.cpp in ListDevices::updateDevices.
Comment 12 Andrius Štikonas 2018-03-28 18:54:42 UTC
(In reply to Nate Graham from comment #10)
> Regarding being able to open partitionmanager targeting specific disks, do
> we have a bug tracking that work, or is too trivial?

Nate, how about a Dolphin plugin? I think Dolphin plugin might even link directly to KPMcore.

Although, I am not sure yet what can Dolphin plugins actually do and what are their limitations?
Comment 13 Lucas 2018-10-30 06:43:43 UTC
This is much needed. I don't see this as a destructive action, provided that it's only applied for remove media and has a proper warning.

Not beeing able to easily format a usb drive in dolphin is a huge usability issue, all other environments (Windows, macos, gnome, etc) have a similar context menu feature.

This is requested a lot too:
https://bugs.kde.org/show_bug.cgi?id=398843
https://forum.kde.org/viewtopic.php?f=83&t=112188
https://forum.kde.org/viewtopic.php?f=83&t=44893
https://www.reddit.com/r/kde/comments/644znx/dolphin_extension_for_formatting_and_viewing/
Comment 14 Elvis Angelaccio 2019-06-30 20:00:52 UTC
*** Bug 409119 has been marked as a duplicate of this bug. ***
Comment 15 Unknown 2019-07-26 03:35:01 UTC
Created attachment 121734 [details]
UI Mockup
Comment 16 Claudius Ellsel 2020-08-08 19:53:00 UTC
*** Bug 425147 has been marked as a duplicate of this bug. ***
Comment 17 Claudius Ellsel 2020-08-08 20:00:24 UTC
Shell we leave this open? This is basically a duplicate of https://bugs.kde.org/show_bug.cgi?id=224056, but we could treat that as some kind of meta bug then.
Comment 18 Nate Graham 2020-08-08 22:46:19 UTC
IMO same deal as Bug 154499: ideally this would get implemented in KIO's Places Panel implementation, and Dolphin would get ported to use it, rather than having to implement it redundantly in both places.
Comment 19 Nate Graham 2020-08-08 22:48:09 UTC
Anyway yes, Bug 224056 is really a meta bug, and the individual requests should probably be marked as blockers of it, rather than duplicates of it.
Comment 20 Claudius Ellsel 2020-08-09 17:00:47 UTC
*** Bug 398843 has been marked as a duplicate of this bug. ***
Comment 21 Claudius Ellsel 2020-08-09 17:01:13 UTC
*** Bug 410591 has been marked as a duplicate of this bug. ***
Comment 22 Claudius Ellsel 2020-08-09 17:01:36 UTC
*** Bug 418383 has been marked as a duplicate of this bug. ***
Comment 23 Claudius Ellsel 2020-08-09 17:09:08 UTC
Alright. I just restructured the corresponding bugs.
Comment 24 Nate Graham 2020-08-09 21:33:14 UTC
Thanks Claudius! Looks good to me.
Comment 25 Nate Graham 2020-09-09 03:30:09 UTC
*** Bug 137724 has been marked as a duplicate of this bug. ***
Comment 26 Nate Graham 2020-11-18 18:52:05 UTC
*** Bug 429317 has been marked as a duplicate of this bug. ***
Comment 27 hsnnsnc 2021-06-18 20:00:30 UTC
Format feature from file manager (Dolphin) to removable disks (USB, External Disk etc.) is the most requested feature.
Comment 28 Peter 2022-02-13 14:43:58 UTC
(In reply to hsnnsnc from comment #27)
> Format feature from file manager (Dolphin) to removable disks (USB, External
> Disk etc.) is the most requested feature.

Can I second this comment?  I acknowledge the comments that formatting is a destructive process, and should not be easily accessible.  However, I think the worry for many users is that, unless I 'm very much mistaken, KDE Partition Manager requires superuser privileges and the worry is that, by mistake, you are going to do something drastic to the hard drive, rather than the USB stick.  In contrast, for most users, reformatting a USB stick is no more drastic than deleting a set of files.

Thanks and regards
Comment 29 gudvinr+kde 2022-08-05 17:31:36 UTC
I don't do this often, but when I do need to format drive it drives me crazy that it is so inconvenient to do in KDE.
Windows makes it simple, even GNOME has somewhat convenient procedure. But if you use KDE you must be no less than advanced Linux user to do task that is as simple as it gets.
Comment 30 rosswzyang 2022-12-20 05:10:50 UTC
this feature is actually important to most used
Comment 31 toolforger 2024-08-09 12:41:52 UTC
Repeating the points made before:

* Yes, it is a destructive action. Just as with file deletion (not moving it to the trash bin); a confirmation dialog is warranted, but not necessarily more (bootable media might be an exception, dunno).
* All alternative actions like GPartEd or command-line tools are MUCH riskier. You can't argue "destructive action" and "use the system tools" from the same book, that's self-contradictory.
* It is a common operation, particularly under Linux where you're forced to alternate between extfs and fatXX on a pretty regular basis.

Any non-tech users that to format a USB stick will have to go into root mode and lose the wrong data if they make any mistake when identifying the drive.
There's no safe recipe for them to be sure that they chose the right device. The name could be /dev/sda, or /dev/sdb if they pulled the stick out and put it back in, or possibly /dev/sdc if they have a setup where /dev/sda is a fixed disk. I wouldn't even want to give a recipe, in case some naming scheme gives them something totally different if, say, the stick sits behind some insane USB bridge or something with Bluetooth; I know somebody will come and tell me "ah, but USB will always be some /dev/sdX device" but how do I know that this will remain true, or that the advice is even correct enough that I'll confidently bet their data on that information?

This is actually the one reason why I have been staying away from recommending KDE to any non-tech user.
I don't want to be the person who put them on the path to data loss, and I cannot and will not force them to become device name experts; these people identify disks by their labels.