Tar and hard links.

akonstam at trinity.edu akonstam at trinity.edu
Mon May 3 14:48:24 UTC 2004


On Mon, May 03, 2004 at 09:29:13AM -0400, Joe(theWordy)Philbrook wrote:
> 
> Pardon my intrusion Sean, But you sound knowledgeable on hard links and I
> did something silly while trying to get dvd::rip working...
> I wanted to use a dev reference I could remember better than the way FC1
> decided my ide cd-rw is /dev/cdrom1 (a softlink to /dev/scd0) so I wanted
> to do an 
> # ln -s /dev/scd0 /dev/cd-rw
> But I had two typos, 
> A) left out the -s making a hard link 
> B) fatfingered the cd-rw into cd-0rw 
> # ln /dev/scd0 /dev/cd-0rw
> But when I went to fix the typo by deleting the link
> # rm /dev/cd-0rw 
> I get "rm: remove block special file `cd-0rw'?" Now normally I'd be
> confident that as long as cd-0rw wasn't the *last* hard link... I should
> be able to safely delete it. But with block special files that I don't
> know how to recreate properely... Well lets just say I wasn't sure
> enough...

You can recreate devices using MAKEDEV but removing all but the last
link should not remove the file.
> 
> Can you confirm that as long as it's not the *last* hard link then that
> warning message doesn't matter???
> 
> By the way about your answer to the OP... If tar can't tell the
> difference between two hard links to the same file, and treats both of
> them as regular files, would that mean that in the case of an actual
> "tape" archive  that included both links, there would two complete
> copies of the file??? 
When you have a hard link between two files you just have two file
descriptor inodes pointing to the same contents. So you will not get
two copies of the file just the two inode pointers with different
names.
-- 
-------------------------------------------
Aaron Konstam
Computer Science
Trinity University
One Trinity Place.
San Antonio, TX 78212-7200

telephone: (210)-999-7484
email:akonstam at trinity.edu





More information about the fedora-list mailing list