Reply to topic

Add a Hard link option when moving/copying files in Dolphin

69

Votes
78
9
fudokai
Registered Member
Posts
6
Karma
0
I can't believe that this hasn't been raised before but a quick google didn't produce any useful results.

When I drag & drop files using Dolphin I get the offer of Move, Copy or Link but the Link option generates a symbolic link not a hard link.

Now I fully realise that people moving from Windoze won't know what I'm talking about but those of us who've been using *nix for some time know what hard linking is and I, for one, would like to be able to use it without dropping to the CLI or having to create a special action and get it to work in the Context (RMB) menu.

My suggestion would be to have this as an optional entry in the Copy/Move/Link dialogue which is not present by default but can be added if required.
Obviously enough hard linking only works within the same file system and so it should only be offered when drag and dropping files within a single file system.

Since the term 'Hard Link' would confuse things with 'Symbolic link' I'd suggest that we use the term 'Clone' for a hard link whilst retaining 'Link' for the symbolic link.
User avatar Madman
Registered Member
Posts
593
Karma
1
OS
For those of us uninitiated, could you tell us what a hard link is, how it's different to a symbolic link and why we might use it?


Madman, proud to be a member of KDE forums since 2008-Oct.
User avatar ivan
KDE Developer
Posts
918
Karma
14
OS
Files in /our/ filesystems are identified by a number (inode). The file name only points to that number.

When creating a hard link, you are creating a new path/filename that points to the same inode. So, instead of having two files, you have only one with two paths and filenames.

If you delete one of them, it just unlinks the path/filename from the inode. The file is deleted only when there are no links to it.

As for 'what we might use it for', I'll leave it to OP, since I haven't really used them for anything. :)


Image
User avatar Snowhog
Registered Member
Posts
198
Karma
1
OS
Dated (2004) but a well written explanation of the difference between soft (symbolic) and hard links.

http://linuxgazette.net/105/pitcher.html


Administrator
Kubuntu Forums . Net - https://kubuntuforums.net
Rms-Mit
Registered Member
Posts
58
Karma
0
OS
I too would like this option but I think it would not be used enough to justify a position in the move/copy/link context menu.

Maybe make it that if you are holding a modifier key like shift or Alt when this menu comes up it could show you this additional option?
User avatar Moult
Global Moderator
Posts
663
Karma
2
OS
The hard link is a feature of the unix system and should be treated as such - not hidden simply because Windows users don't know what it is. It's massively useful in backing up and mirroring files. I think it deserves a place next to the normal link menu option.


Moult, proud to be a member of KDE forums since 2008-Oct.
thinkMoult - source for tech, art, and animation: hilarity and interest ensured!
WIPUP.org - a unique system to share, critique and track your works-in-progress projects.
User avatar ivan
KDE Developer
Posts
918
Karma
14
OS
> It's massively useful in backing up and mirroring files.

Could you please elaborate on this one (it is always good to see different backup methods)?


I have mixed feelings for this one. From my point of view, there are two different reasonings, and both valid.

1. It is an important feature of the file-system, why not support it?

2. It is an obscure* feature that no (to my knowledge) GUI programs use. So, why would anyone want to create hard links via Dolphin, and then switch to console to do other stuff.

2a. And, due to its obscurity, it can be *very* dangerous for people who don't understand it completely.


Image
User avatar Moult
Global Moderator
Posts
663
Karma
2
OS
I often use rsnapshot-style backups for single directories when version control isn't quite what scratches my itch. I find it useful for managing large amounts of images I'm sorting out and editing.

I agree about the obscurity part. I don't use it that often myself, but seeing as there are only 2 options in that menu (and "link here" isn't exactly intuitive to a Windows user who is used to "create shortcut") I don't see anything wrong with adding one more option ;)


Moult, proud to be a member of KDE forums since 2008-Oct.
thinkMoult - source for tech, art, and animation: hilarity and interest ensured!
WIPUP.org - a unique system to share, critique and track your works-in-progress projects.
User avatar david_edmundson
KDE Developer
Posts
359
Karma
1
OS
I've been using Linux for 4+ years and I don't think I've ever wanted to manually create a hard link. Sure there are probably loads on my computer, and I've used backup programs that create them - but I've never wanted to make one myself.

@fudokai - did you actually want to make a hard link or did you just notice you didn't have an option.

My view:
There's no point putting in an option if no-one actually wants it. (as the reporter said, not even searching the internet found anything)

As dolphin has a deliberate focus on usability I'm voting this down.
Pietro Pizzi
Registered Member
Posts
2
Karma
0
OS
I have a scenario where it was VERY useful:

I have my whole multimedia files on a NAS with a big ext4 file system, this dir. is mounted on my PC. There I have created an Folder with all the HDTV Movies, another with my SDTV, a more complicated structure for my series, and so on.

Now i have mounted this dir also on my HTPC in the living room. Especially my SDTV folder has a lot of files and i don't want to see all this movies in the next time. So i linked the movies i will see in a "next"-folder.

Soft-Links don't work cause dolphin makes it absolute (with "/home/user...") and the HTPC can't find this files. Even if they are relative, what do you do if you change a typo in the original file?

And in my environment there are not only the "next"-folder, i also have a Top10Movies-folder, a e.g. QuentinTarentino-folder and so on. So i must use some sort of fully functional links because some movies appears in multiple folders, and i don't like soft-links due to the renaming problem.

And there are other positive side effects with an HTPC. If you see a movie in the "next"-folder you can delete it over your RC without loose it (it's like an "seen"-flag). In addition i have an extra "backup"-folder with all my media in it, this one i have write protected for the HTPC, so no one can accidently kill my movies and songs.

For the "backup" i have made a script, but the special-folder thing is handwork, and this is boring and slow on the CLI. So i definitely think this is a must have feature!! And I'm think that in the future I'm not the only enthusiast with an NAS and an HTPC:)! If this feature comes (i wonder why it isn't already there), i hope it is part of KDE, not only Dolphin, so that it is also usable within Konqueror, witch i used 90% of the time.
devent
Registered Member
Posts
4
Karma
0
I would like to see this feature in Delphin, too.

It would be great if you want to manage your photos. I manage my photos with a directory Place-Date, like Germany-2011-01-01/. Now there are all my pictures that I took at that place and at that date.

Now I could have a new directory, name Germany-Girlfriend. There I could have all pictures of my girfriend that we took in Germany.

Right now in Dolphin I have two options: a) copy the pictures from the various directories to Germany-Girlfriend. This have of course the disadvantage that I have the files now double. If I edit one (like red-eyes removal), I have to copy the file again or make the same changes. Plus, it doubles the needed space.

b) Link them from the various directories to Germany-Girlfriend. Now I don't waste space and the changes I make are for all linked files. But if I rename or remove the original file, I loose the link. So soft-links are fragile.

With hard-links I would not have the disadvantage from a) or b). A hard-link is like a soft-link, except if I rename or remove the original file, the linked file is still there.

I think hard-links are underused. If you want you could make all the tags to files as hard-links. Make a directory for each tag and hard-link the files in the tag-directories.

The hard-links are transparent on the file system level, they are real files for the applications. There are a core component of any Linux system and should be exposed in Dolphin (of course only if dragging the file in the same file system).
User avatar Kver
Registered Member
Posts
326
Karma
2
OS
To me, 90% of the issue I have with it, is hard-link abuse, availability, and labeling. I also think there are just better ways to manage linking.

Abuse:

When I say abuse, I mean this: Users don't RTFM (Read The F-ing Manual). When they come across hard links, they'll make what they believe is a shortcut "that never fails", and see what looks like a copied file come out. Between "flaky" shortcuts and "never-fail" hard-links, I firmly believe some users will just go with one or the other without thinking, and I think many of those users might begin hard-linking -all- their files because it's less prone to being broken.

One problem might be a user trying to clear up hard-drive space, and failing to do so because they preferred hard links over soft links. Imagine the mess trying to delete a large set of files with dozens of hard-linked locations? Suddenly that mass of hard-linked files scattered across your computer is an easter egg hunt.

Imagine someone who believes they have two copies of files; Maybe they forgot they hard-linked the files, maybe someone else did it - but because of hard-linking they don't know the files are connected. They may blindly edit all those files, crop the family album for facebook. Suddenly they have damaged all their hard-linked files. And there would be no way whatsoever to know what they did wrong, or that they even did something wrong. Those files will look like separate files.

Also, search utilities like Nepomuk may have a field-day with hard-linked files. To Nepomuk, it's not a link, it's a file. A hard-link happy user creating potentially thousands of hard-links would kick Nepomuk into overdrive. Nepomuk would quickly be blamed for this and get the label of being "bloated". Nepomuk might have to make workarounds, but that would take a long time, and probably lead to more issues.


Availability:

Hard links are more technically complex and have more requirements than standard links.

You can't hard-link directories (from what I read), so if people include directories in their attempt to create a link, that hard-link option would disappear. Also, when they link from one partition to another, the option would disappear. This could be very confusing to users, because you have an option that only shows up half the time. Uninformed users would think it's broken. Hard links don't work with external content outside the drive. "Why is the 'reliable' option gone?"



Labeling:

This is nitpicky, but if I didn't know about link types I'd be confused when it asks me if I want a soft or a hard link. Casual users won't understand. And when they don't understand they either give up, see what works and stick with that, or call their geekiest family member. It's #2 I'm afraid of, if users choose to hard-link everything. I'm also not fond of #3...



Anyway, I think there are just better methods:

I honestly believe 90% of the cases made for hard-linking can be solved with marginally better organization.

I have a huge multimedia collection, and I access it from many devices. My home theatre (XBMC) tracks what shows have been watched, and I can also mark them as watched. It does it all for me. Having a folder structure that requires the creation and deletion of files with backups of those folder to protect against the deletion of folders is just overcomplicated. I don't use shortcuts, I don't use links, I let the software handle it. If you need 3-4 links to a file, with backup links, there's something wrong with that layout. The more "Creative" you need to get with a solution, the more you're probably steering away from the simple solution what works better.

@Pietro Pizzi, what home theater software are you using that you need to manually manage all of your files like that? If it uses EXT file systems, it should understand softlinks. I would check with your software, if it can't handle softlinks consider dumping it, many media center programs not only allow for softlinks, but should track what you've watched and where you've left off.



Anyway, in short;

I firmly believe that just because you have something doesn't mean you have to use it; there's a time and place for everything - and hard links are better suited to the realm of the OS itself and programs that know how to best use them. Otherwise hard-links would become abused by uninformed users or as a horrible kludge to poorly thought-out folder configurations.

I'm just -very- wary of hard links. It has technical advantages in very rare closet-case scenarios for an average user, but in 99.99% of all cases soft links are just better for general use because they don't have these repercussions.

If we did something like this, I would make it an option, and I would turn it off by default.

One thing I would add though is a new emblem to dolphin representing a file with hard links (if dolphin doesn't have one already), and a tab in the properties dialog listing those links. I may make this a separate idea tomorrow.


Reformed lurker.
Flitcraft
Registered Member
Posts
4
Karma
0
Any news on this? I would really like to have that option.

But 'Clone' - as the OP suggested - would be a really bad name. Call it what it is and put a big friendly warning beside it, like "Do not use if you don't know what it means".
kadik
Registered Member
Posts
4
Karma
0
I hoped for years to have a hard link option added to the copy/move/softlink menu when dropping file in a file manager.

Here are two use case from my own experience.

First I use linux to DJ using mixxx and have a large hq music file collection, mostly flac and 320kbps mp3s, living on an dedicated hard drive. During preparation of a mix set I listen to tracks and when I find one that fits the set, I copy it to a set specific folder, when the set is done with its foledr is moved to an archive folder where they stay. As time passes it means more sets, more duplicated data and more waste of storage space. It also became close to impossible to keep all those files id tags in sync, so my music collection is getting inconsistent and I too often fin myself looking for the right copy of the file with the right tags then hunt all other copies and update them.
After fslint told me I was wasting over 400+GB on a 1TB drive I decided to switch to hard links. So now I have a go to master directory containing my sorted music collection from which I hard link files to the relevant mix set directories.
The lack of dolphin support for hard linking makes this process really tedious, first I browse the master and listen to tracks, then I copy it to the relevant directory, when the listening session is over, I go to the directory and manually search each file original location in the master directory, rename the copy to avoid name clash, make a hard link in the mix set directory and finally delete the copy.
The current alternative to this time wasting process is using fslint to scan the whole drive and mass hard links duplicate files, but I'm really wary of messing with a large sorted file collection built over the years, anyways scanning a large drive filled with many files takes time and resources.
Just having the option to hard link during the copy step would save me considerable time, even it has to be activated with an option buried in an advanced settings window.
The minute I'm offered a file manager supporting hard links I'll switch over, the way krusader offers the option since 2001 is not really helpful (in a sub menu of the contextual menu to create the link in place instead of to the other panel) and I'm now considering learning emacs to be able to use dired's option to make hard links.

Second usage case is managing a sorted media files collection, I sort my files in category folders such as "genre", "theme", "name", "series", and others, each one containing subcategories subfolders. Of course one file may fit in several of these categories, for example "Indie game the movie" I got in humble bundle 7 is a 3.8GB file in 1080p and it fits in the documentary genre subfolder, in the videogame theme subfolder and in the indie theme subfolder, and that's a waste of space. Soft links do not work because they get broken the very instant the original is moved around or renamed which happens on a regular basis and now not only I have to hunt for broken links but also identify where the original is living. To avoid broken soft link a simple move/rename operation becomes a find and redo all associated soft links every time, it also caused trouble during backup process and copy of parts of the file collection.

Until linux gets a file system level data deduplication, hard linking is the only solution I have found to work. (no zfs with its hundreds of GB or RAM requirement for deduplication will not do on my desktop computer).
airdrik
Registered Member
Posts
1854
Karma
5
OS
Why not use tags? It seems like tags are designed to fit what you are trying to do. (see http://userbase.kde.org/Nepomuk/kioslaves/tags)


airdrik, proud to be a member of KDE forums since 2008-Dec.

 
Reply to topic

Bookmarks



Who is online

Registered users: appateritisr, Baidu [Spider], Bing [Bot], blue_bullet, Daphazard, Google [Bot], Sogou [Bot], Yahoo [Bot]