Hi im trying to hard link a folder and i get this
# ln /var/spool /home/recordings ln: `/var/spool': hard link not allowed for directory
how do i hard link a directory?
You can't. Ken Thompson decided that this complicates things too much so this was disabled back in the 70ies. You can however do a mount --bind /var/spool /home/recordings this has a quite similar effect.
Regards, Andreas Rogge
Am Freitag, den 12.01.2007, 05:50 +0800 schrieb Mark Quitoriano:
Hi im trying to hard link a folder and i get this
# ln /var/spool /home/recordings ln: `/var/spool': hard link not allowed for directory
how do i hard link a directory? _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
I just usually add the '-s' flag to my ln's, and it seems to work.
Sometimes I add '-snf' just because it's more fun to type.
Peter Andreas Rogge wrote:
You can't. Ken Thompson decided that this complicates things too much so this was disabled back in the 70ies. You can however do a mount --bind /var/spool /home/recordings this has a quite similar effect.
Regards, Andreas Rogge
Am Freitag, den 12.01.2007, 05:50 +0800 schrieb Mark Quitoriano:
Hi im trying to hard link a folder and i get this
# ln /var/spool /home/recordings ln: `/var/spool': hard link not allowed for directory
how do i hard link a directory? _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
That's a symbolic link and it is perfectly fine to symlink directories.
Symbolic links contain the path to the inode, hard links contain the inode reference itself. Think of hard links like copying the file, but having the copy point to the same data, if you delete any one of the hard links the data remains, but if you symlink it and delete the destination file then you loose the data and the symlink points to nothing unless you put another file there with the same name. Hard links cannot be made between files in different file systems, as the inode referenced in file system 1 will not be the same on file system 2, but since a symlink is a path to an inode that path can point to a file/directory on a different filesystem.
-Ross
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Peter Serwe Sent: Thursday, January 11, 2007 9:13 PM To: CentOS mailing list Subject: Re: [CentOS] hard link a directory
I just usually add the '-s' flag to my ln's, and it seems to work.
Sometimes I add '-snf' just because it's more fun to type.
Peter Andreas Rogge wrote:
You can't. Ken Thompson decided that this complicates things too much
so this was
disabled back in the 70ies. You can however do a mount --bind /var/spool /home/recordings this has a quite similar effect.
Regards, Andreas Rogge
Am Freitag, den 12.01.2007, 05:50 +0800 schrieb Mark Quitoriano:
Hi im trying to hard link a folder and i get this
# ln /var/spool /home/recordings ln: `/var/spool': hard link not allowed for directory
how do i hard link a directory? _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
-- Peter Serwe <peter at infostreet dot com> http://www.infostreet.com
"The only true sports are bullfighting, mountain climbing and auto racing." -Earnest Hemingway
"Because everything else requires only one ball." -Unknown
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
On Thu, 2007-01-11 at 23:08 +0100, Andreas Rogge wrote:
You can't. Ken Thompson decided that this complicates things too much so this was disabled back in the 70ies. You can however do a mount --bind /var/spool /home/recordings this has a quite similar effect.
Not quite! See below.
Regards, Andreas Rogge
Am Freitag, den 12.01.2007, 05:50 +0800 schrieb Mark Quitoriano:
Hi im trying to hard link a folder and i get this
# ln /var/spool /home/recordings ln: `/var/spool': hard link not allowed for directory
how do i hard link a directory?
What you really need to do is make a new directory and hardlink all the files from the original in the new directory.
This increments the link count for each file in the original directory (and so also, the new directory) so that an rm of one directory's file (s) just decrements the link count, removes the file entry in the appropriate directory and leaves the other directory's file entry alone (except for the reduced link count, which is not associated with the directory anyway) and leaves the underlying file contents in place.
This is not at all like a mount --bind.
One further "gotcha": when you replace the file in one directory by "mv" or "rm ; cp" etc., the other copy is left unaltered and it is easy to forget that the two "copies" are no longer the same.
Before the mv/rm/cp, etc. alterations to the file from either directory appeared in the other. This no longer occurs.
<snip sig stuff>
Forgive any errors, it's been decades.
HTH -- Bill
On Sat, 2007-01-13 at 08:46 -0500, William L. Maltby wrote:
On Thu, 2007-01-11 at 23:08 +0100, Andreas Rogge wrote:
You can't. Ken Thompson decided that this complicates things too much so this was disabled back in the 70ies. You can however do a mount --bind /var/spool /home/recordings this has a quite similar effect.
Not quite! See below.
Regards, Andreas Rogge
Am Freitag, den 12.01.2007, 05:50 +0800 schrieb Mark Quitoriano:
Hi im trying to hard link a folder and i get this
# ln /var/spool /home/recordings ln: `/var/spool': hard link not allowed for directory
how do i hard link a directory?
What you really need to do is make a new directory and hardlink all the files from the original in the new directory.
This increments the link count for each file in the original directory (and so also, the new directory) so that an rm of one directory's file (s) just decrements the link count, removes the file entry in the appropriate directory and leaves the other directory's file entry alone (except for the reduced link count, which is not associated with the directory anyway) and leaves the underlying file contents in place.
This is not at all like a mount --bind.
One further "gotcha": when you replace the file in one directory by "mv" or "rm ; cp" etc., the other copy is left unaltered and it is easy to forget that the two "copies" are no longer the same.
Before the mv/rm/cp, etc. alterations to the file from either directory appeared in the other. This no longer occurs.
<snip sig stuff>
Forgive any errors, it's been decades.
Also ... just for the record ... hardlinking is built into the copy command:
cp -al dir1 dir2
(that will create a hard linked directory of files in dir2 that are from dir1.