At the moment, mkdwarfs faithfully reflects the hardlink relation between files from the source file-system (i.e. if file /a and /b are hardlinks to one-another, so they appear in the image.dwarfs when mounted with FUSE). (And this is great.)
However, there are use-cases when one wants to break (or tweak) this relationship in the resulting image, namely:
- (A) either having all files appear with exactly 1 hardlink, although underneath in the resulting image they share exactly the same content;
- (B) either having all duplicate files (based on the hash) in the source file-system appear as hard-links in the resulting image;
Why would case (A) (i.e. hardlinks are dissolved) be useful? The hardlinks in the source file-system might be an implementation detail / optimization, and the user wouldn't want that fact shown in the resulting image.
For example there are techniques of using rsync to create snapshots back-ups that use hardlinks. However, the user might want to create a final image, and would like to hide this fact away.
Why would case (B) (i.e. all duplicate files to become hard-links to each-other), some other times, it's beneficial to have deduplicated files share the same hard-links, as this would allow more advanced tools to take benefit of this information in how they operate. (Again, rsync might be one such tool.)
As a side-note to point (B), how does DwarFS handle files that have more than 65536 hard-links?
(Where would one encounter such a case: MAME supporting files, namely cheats which are XML files, and for some reason, the developers of MAME decided to copy the same hash-duplicate file ~120K times in the same folder...)
At the moment,
mkdwarfsfaithfully reflects the hardlink relation between files from the source file-system (i.e. if file/aand/bare hardlinks to one-another, so they appear in theimage.dwarfswhen mounted with FUSE). (And this is great.)However, there are use-cases when one wants to break (or tweak) this relationship in the resulting image, namely:
Why would case (A) (i.e. hardlinks are dissolved) be useful? The hardlinks in the source file-system might be an implementation detail / optimization, and the user wouldn't want that fact shown in the resulting image.
For example there are techniques of using
rsyncto create snapshots back-ups that use hardlinks. However, the user might want to create a final image, and would like to hide this fact away.Why would case (B) (i.e. all duplicate files to become hard-links to each-other), some other times, it's beneficial to have deduplicated files share the same hard-links, as this would allow more advanced tools to take benefit of this information in how they operate. (Again,
rsyncmight be one such tool.)As a side-note to point (B), how does DwarFS handle files that have more than 65536 hard-links?
(Where would one encounter such a case: MAME supporting files, namely cheats which are XML files, and for some reason, the developers of MAME decided to copy the same hash-duplicate file ~120K times in the same folder...)