Add support for btrfs #447
Replies: 7 comments 11 replies
-
Thanks for asking about this @luigir-it . I'll have to give the matter some thought. It would mostly just be a matter of adding copy and delete functionality when the source and target are on different filesystems. Although there are some extra things I'd have to be careful of (See the 'Implementation notes' at https://specifications.freedesktop.org/trash-spec/trashspec-latest.html). Here's a bit of an explanation from ChatGPT why Dolphin works. I'm pretty sure it's true that Dolphin is doing a copy/delete instead of rename, because rename can't rename files across file systems (So rename and mv are essentially the same, a very quick operation).
Consider when using 'mv' at the command line when the source and target are on the same filesystem:
|
Beta Was this translation helpful? Give feedback.
-
@luigir-it Right now I don't think I'll be adding support for moving files. It's not a feature I would use personally because I prefer to avoid the extra wear-and-tear on my drive. It's possible I might change my mind though and add it anyway, but I don't know when that would happen. One option I could suggest to you so that you could use rmw or trash-cli is to have a script that moves the files.
If you have the trash folder on your other filesystem in the rmw config file, it will still purge (permanently delete) any expired files based on when they were first trashed. So while I can suggest that, I won't recommend it. The only problem I can think of is if you run rmw (or trash-cli) at the same time your script is moving files. There's the potential for them to get confused as they read the .trashinfo files and it's possible the corresponding file might not exist yet if it's being moved. |
Beta Was this translation helpful? Give feedback.
-
That's totally understandable. And I also think it's reasonable to have a However, btrfs subvolumes are not exactly different filesystems. In my case, the This means that mv should, in theory, just update metadata, not perform copy-and-delete operation. I confirmed this by:
|
Beta Was this translation helpful? Give feedback.
-
I agree. I hope we can figure out a reasonable solution.
I see. That explains why rmw is attempting the rename (move). Normally if it sees the target file and Trash folder are on different devices, you'd get the message: "No WASTE folder defined in '/home/luigi/.config/rmwrc' that resides on the same filesystem." So rmw is detecting they are on the same device (using 'dev_t') but rename() is failing. ChatGPT says:
Because in your case 'mv' isn't using the fallback copy/delete method, there should be a way to do this with rmw. Can you provide a few lines on how I'd replicate your setup on my system so I can do some testing? |
Beta Was this translation helpful? Give feedback.
-
@luigir-it Are you using the GNU Coreutils 'mv'? I can look for clues here. |
Beta Was this translation helpful? Give feedback.
-
If you want to replicate my setup:
you first need to create
|
Beta Was this translation helpful? Give feedback.
-
Closing. See issue #451 for further discussion. |
Beta Was this translation helpful? Give feedback.
-
Hi.
Today I did some changes on how I handle trash. I decided to create a
@Trash
subvolume and symlink~/.local/share/Trash
to it.There aren't any issue with Dolphin (KDE gui file manager), everything works as before: I can trash files, folders, restore them...
But the utility I was using before (
trash-cli
) stopped working. So I tried everything else I could find on the AUR, and none of them did work.I came across rmw, and it looks simple and straightforward, but has the same issue: with
WASTE=$HOME/.local/share/Trash
in the config file, deleting files yield this result::error: while trying to move (rename) haha -> /home/luigi/.local/share/Trash/files/haha_195333-240326 -- remove_to_waste:L362 rename(): Invalid cross-device link
This
Invalid cross-device link
is the same output error of trash-cli and similar utilities.Is there a way to fix it? Like I said, Dolphin works fine with this new setup.
Beta Was this translation helpful? Give feedback.
All reactions