Subject: Re: hard links in mounted cd9660 file system
To: Cliff Wright <cliff@snipe444.org>
From: Wolfgang Solfrank <ws@tools.de>
List: tech-kern
Date: 03/03/2005 14:27:25
> After mounting a cd9660 type file system, files that were hard linked
> when creating the iso (using default of -cache-inodes to mkisofs) have
> the correct reference count, take up space for only 1 file, but show
> different inode numbers. This means that when I do a copy the hard link
> is not preserved, and a duplicate copy is made. I have tried various
> copy methods cp -Rp, back to back tars, and even rsync from knoppix. Is
> their a mount flag for cd9660, or some other way of preserving hard
> links in an iso after the mount?

Hmm, the problem is that there is no good way to know that two files are
hardlinks on a 9660 filesystem.  9660 doesn't have a concept of inodes as
is common in standard unix filesystems.  Instead, the information about
the file is stored in the directory entry.  This means that the two
directory entries pointing to the same data blocks may in fact describe
two different files (e.g. the may have different owner or permission,
or they may even differ in size!).

Currently, the inode number shown by 9660 is just the offset of the
directory entry of the file relative to the disk/partition, with the
special case for directories, where we use the start of the directory
itself, i.e. the offset of the '.' entry.  This way, it's quite easy to
determine the file attributes given the inode number.  Unfortunately,
it results in the behaviour you are seeing.

Ciao,
Wolfgang
-- 
ws@TooLs.DE                            Wolfgang Solfrank, TooLs GmbH