Linking Files: Hard Link vs. Soft Link?
Amichai Rotman
amichai at iglu.org.il
Wed Apr 15 08:44:29 UTC 2009
Hello again,
Tim was the closest to an answer, but I think I got even more confused...
Here is what I have:
A 160 GB HDD with one primary partition formated as ext3. this partition
contains all of my media files in an alphabetized hierarchy - 8814 files in
904 directories.
Another hierarchy I'd like to link the actual files by categories:
/Data/Artwork/
|-- Audio
|-- Extras
|-- Movies
|-- Music Video Clips
|-- TV
|-- Video
|-- Visuals
`-- eTexts
Some directories contain a both video and audio, so I'd like to link some of
the files to the Audio and some to the Video categories.
I currently have only 11GB free, and I'd like to minimize the waste of
space, so here are my questions:
I understand hard links will not delete be a problem as long as I check the
link count with ls -l. They will also save space because soft links are
broken and stay there as a separate entity in the FS and just take up space.
I'd like to know what would be the best way to link the files from the
alphabetized hierarchy to the category hierarchy.
Is there a way to covert soft links to hard links? I I use Konqueror to drag
a bunch of files from directory to directory I can then choose to (soft)
link them....
I also need help with the Bash script. I don't know much on scripting....
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
------------------------------------------------------------------------------------------------------------
.:====================================================:.
George Carlin<http://www.brainyquote.com/quotes/authors/g/george_carlin.html>
- "Frisbeetarianism is the belief that when you die, your soul goes up
on
the roof and gets stu...
On Tue, Apr 14, 2009 at 21:53, Kyle Smith <kyle.smith at inforonics.com> wrote:
>
> Smoot Carl-Mitchell wrote:
>
> On Tue, 2009-04-14 at 19:45 +1200, Tim Frost wrote:
>
>
>
> Is it possible to create a hard link to a directory somehow?
>
>
> No. In general, a directory is a container, and as such it defines a
> place in the tree which holds files (and other directories). That
> container only makes sense in that one place in the tree.
>
>
> Hardlinks to directories are not allowed, except when creating a
> directory. A hard link is created to a new directory's parent directory
> with the name ".." and linked to itself with the name ".". This
> standard is the way the utilities walk up the filesystem hierarchy. The
> "/" directory has the ".." hardlink point to itself.
>
> This is the only case where hardlinks to directories appear in the
> filesystem hierarchy. Some Unices do allow userland programs to create
> directory hardlinks, but it is inadvisable to do this, since many of the
> standard utilities depend on this not being the case. You can see the
> hardlink count with the ls -la command. The -a lets you see the
> directory links and all the hidden files in a directory. The link count
> is the number after the permissions. A directory with lots of
> subdirectories will have a lot of hardlinks. Adding "-i" as an option
> will let you display the inode number which is the only unique
> identifier for each file.
>
>
> Apparently you all haven't had the pleasure of working with cPanel's WHM
> product. WHM uses something called virtfs to create chroot environments for
> users to SSH into, and for SuEXEC PHP scripts to run inside. What's
> fantastic about how they do it is that they hardlink the /home/username
> directory inside /home/virtfs/username/home/, and they hardlink the /lib
> directory in /home/virtfs/username/lib. What's especially great about this
> is that you do some cleanup of accounts and write yourself a little script
> to remove home directories not owned by current users, next thing you know
> rm -r hits /home/virtfs and you remove /lib/ldlinux.so.2.
>
> Wanna know a fun error message?
> bash: ls: ELF Interpreter not found: /lib/ldlinux.so.2
>
> That is why directories shouldn't be hardlinked. :)
>
> - Kyle
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090415/47e87cb9/attachment.html>
More information about the ubuntu-users
mailing list