Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are hard links possible within a zip archive?

I am creating a zip archive containing two identical files at different paths. Does the zip archive format support something akin to the Unix concept of hard links? By this I mean the ability to store the file only once (saving space), but to index that data blob to two different paths within the zip archive.

If the file format does support this, how could I go about creating such an archive using free tools in Ubuntu?

like image 691
Grampoulos Avatar asked Jan 14 '12 02:01

Grampoulos


People also ask

What are the limitations of hard links?

Hard limits While useful, there are some limitations to what hard links can do. For starters, they can only be created for regular files (not directories or special files). Also, a hard link cannot span multiple filesystems. They only work when the new hard link exists on the same filesystem as the original.

Can hard links be created across file systems?

Because inodes are unique to a filesystem, and hard links are mappings of name:inode, you cannot create links across filesystems.

Why hard link is not allowed in directory?

The reason hard-linking directories is not allowed is a little technical. Essentially, they break the file-system structure. You should generally not use hard links anyway. Symbolic links allow most of the same functionality without causing problems (e.g ln -s target link ).

Which file systems support hard links?

Hard links only work on Microsoft Windows operating systems that support NTFS partitions (Windows NT 4.0 or later) while FAT and ReFS file systems do not work with hard links. An example of using hard links is when a user needs to have a file stored in two different folders.


1 Answers

No, the Zip file format does not support this. This is because the Local File Header contains information about the file, including its name, followed immediately by the compressed data for the file. It is not possible for two different Local File Headers to point to the same compressed data.

like image 150
Greg Hewgill Avatar answered Sep 20 '22 09:09

Greg Hewgill