Linking Files: Hard Link vs. Soft Link?
Joe Burgess
joemburgess at gmail.com
Tue Apr 14 06:41:31 UTC 2009
On Tue, Apr 14, 2009 at 09:24:49AM +0300, Amichai Rotman wrote:
> Hello,
>
> I have an alphabetized file hierarchy I'd like to organize into
> categories. These are all my media files - documents, video, audio etc.
>
> I created another hierarchy containing the categories I want and linked
> the files from the main hierarchy to the relevant category, using a soft
> link (ln -s).
>
> I realized it's a waste of space (two inodes for each file), so I thought
> re-creating the links as hard links.
>
> My dilemmas:
>
> Is it really better? - I understand that if I hard link a file, it is
> actually the same file, and if I delete the so called link I actually
> delete the real file - might be dangerous... I know I am stating the
> obvious, but I'd like your input on this (pros and cons).
>
> Is there a way to create hard links with a GUI? - I am using KDE 3.5.10.
> Till now I've created half a dozen hard links using the ln command in CLI,
> but it will take me forever to create all those I need....
>
> Is it possible to create a hard link to a directory somehow? - when I use
> the ln command to link a directory, I get an error saying it is not
> possible. If that's true, the whole thing is pointless: I'd like to create
> a directory under the category hierarchy and then hard link the files
> under it. It will still mean less inodes, but it seems to me there has to
> be a way....
>
> Thanks!
>
> .:====================================================:.
>
> Amichai Rotman
>
> UIN#: 6401746
> Registered Linux User#: 201192 [http://counter.li.org/]
> Registered Ubuntu User #12851 [http://ubuntucounter.geekosophical.net]
>
> ------------------------------------------------------------------------------------------------------------
>
> PLEASE READ: http://www.gnu.org/philosophy/no-word-attachments.html
>
> ------------------------------------------------------------------------------------------------------------
>
> .:====================================================:.
> Henny Youngman A - "I told the doctor I broke my leg in two places. He
> told me to quit going to those places."
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
So I have always been scared of hard links just like you. As far as hard
linking directories, according to the ln man pages there is a -d flag
but it looks like it is very possible that it won't work. So you can try
that out, or you can create the directory and then write a small bash
script to go through the directory and hard link each file. It would be
wonderful if ln had a recursive flag but it doesn't. :(.
as far as hard linking vs. soft linking, I am generally a fan of soft
linking simply so that I don't delete something and it goes away in two
places, but that is just me.
Good Luck!
--
--Joe Burgess
CMU Information Systems '12
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090414/c867a92f/attachment.sig>
More information about the ubuntu-users
mailing list