AFAIK the following are the differences between symbolic links and
hard links
Is there any other point which I have missed ?
symbolic link
when you try to open a symbolic link which points to a file or change
to one that points to a directory,the command you run acts on the file
or directory that is the target of that link.the target has its own
permissions and ownership that you cannot see from the symbolic link.
The symbolic link can exist on a different disk partition than the
target.
Hard link
it can only be used on files(not directories) and is basically a way
of giving multiple names to the same physical file.
hard links that point to that single physical file must be on the same
partition as the orginal target file.
The files are hard links if they have the same inode number.
>Hi all,
>
>
>AFAIK the following are the differences between symbolic links and
>hard links
>Is there any other point which I have missed ?
>
>
>symbolic link
>
>when you try to open a symbolic link which points to a file or change
>to one that points to a directory,the command you run acts on the file
>or directory that is the target of that link.the target has its own
>permissions and ownership that you cannot see from the symbolic link.
>
> The symbolic link can exist on a different disk partition than the
>target.
Not always, consider NFS ;)
>
>
>Hard link
>
>it can only be used on files(not directories) and is basically a way
>of giving multiple names to the same physical file.
>
>hard links that point to that single physical file must be on the same
>partition as the orginal target file.
>
> The files are hard links if they have the same inode number.
When using hard linked file trees, some tools (patch) know how to break
hardlinks when required. Also means using an editor that is aware of
hardlinks and knows to break them when modifying a file. I use hard
links for linux-kernel source trees (cp -al kernel-a kernel-b), also
for backups via a cron job where only changed files are copied whilst
older files are simply hard-linked, takes much less space and is far
more convenient than incremental backup methods. Rsync is hardlink
aware.
Grant.
--
Cats, no less liquid than their shadows, offer no angles to the wind.
Fairly correct apart from one thing.
You CAN hardlink a directory.
in fact, you see those "." and ".." directories in your directory listing
when you ls -a?
Them's hard links them are.
Do an ls -ia on a directory and compare the inode number for ".." with the
inode of the parent directory. Then compare the inode number of the "." with
the inode of the directory you're in.
--
| |What to do if you find yourself stuck in a crack|
| spi...@freenet.co.uk |in the ground beneath a giant boulder, which you|
| |can't move, with no hope of rescue. |
| Andrew Halliwell BSc |Consider how lucky you are that life has been |
| in |good to you so far... |
| Computer Science | -The BOOK, Hitch-hiker's guide to the galaxy.|
> Fairly correct apart from one thing.
> You CAN hardlink a directory.
> in fact, you see those "." and ".." directories in your directory listing
> when you ls -a?
Well, the OS can do this. The user has no control.
Older versions of Unix allowed this, but when you ran fsck, the file system
would be corrupted, as I recall.
So mkdir became an atomic operation.....
Heh, true. I'd never tried hard linkin a directory.
Just assumed it was possible cos of the dot hardlinks.
:)
--
| spi...@freenet.co,uk | "Are you pondering what I'm pondering Pinky?" |
| Andrew Halliwell BSc | |
| in | "I think so brain, but this time, you control |
| Computer Science | the Encounter suit, and I'll do the voice..." |
And the OS does this only for the special directories "." and "..".
Allowing multiple hard links, other than "." and "..", for directories
would imply that directories could have multiple parent directories.
This would break the concept of ".." pointing to _the_ parent directory.
> Older versions of Unix allowed this, but when you ran fsck, the file system
> would be corrupted, as I recall.
>
> So mkdir became an atomic operation.....
Regards,
Kees.
--
Kees Theunissen.