Dowiązania w linuxie, różnice

0

Potrzebuję nauczyć się jakie są główne różnice między dowiązaniem twardym, a symbolicznym w linuxie, a także potrafić podać przykłady.
W google są tylko definicje z których nie potrafię wyciągnąć różnic, a o przykładach nic nie udało mi się znaleźć.
Potrafi ktoś wytłumaczyć ?

1

A hardlink isn't a pointer to a file, it's a directory entry (a file) pointing to the same inode. Even if you change the name of the other file, a hardlink still points to the file. If you replace the other file with a new version (by copying it), a hardlink will not point to the new file. You can only have hardlinks within the same filesystem. With hardlinks you don't have concept of the original files and links, all are equal (think of it as a reference to an object). It's a very low level concept.

On the other hand, a symlink is actually pointing to another path (a file name); it resolves the name of the file each time you access it through the symlink. If you move the file, the symlink will not follow. If you replace the file with another one, keeping the name, the symlink will point to the new file. Symlinks can span filesystems. With symlinks you have very clear distinction between the actual file and symlink, which stores no info beside the path about the file it points to.

Myślę rownież, że ten post dobrze to wyjaśnia:

Both are pointers to files; the difference is the kind of pointer. A symbolic link points to another file by name. It has a special mode bit that identifies it as a symbolic link, and its contents are the name of the real file. Because it just contains a name, that name does not actually have to exist, or may exist on a different filesystem. If you replace the named file, then the link still contains the same name, and so now it points to the new file. You can easily identify a symbolic link and see the name of the file it points to.

A hard link points to the file by inode number. As such, hard links are no different than the first name of a file. There is no "real" name vs. hard link name; all hard links are equally valid names for the file. Because of this, the file you link to must actually exist and be in the same filesystem where you are trying to create the link. If you delete the original name, then the hard link still points to the same file. Because all hard links are equally valid name(s) for the file, you can not look at one and see the other names for the file; to find this, you have to go looking at every file and compare their inode number to find the other name(s) that have the same inode number.

You can tell how many names a file has from the output of ls -l. The first number after the file mode is the link count. A file with more than 1 link has other name(s) somewhere, and conversely, a file with a link count of only 1 has no (other) hard links.

http://askubuntu.com/questions/108771/what-is-the-difference-between-a-hard-link-and-a-symbolic-link

Jeżeli nie szukałeś na stronach anglojęzycznych, to postaram się dla Ciebie przełożyć głowne różnice.

1

Dowiązanie symboliczne wskazuje na plik dowolny plik lub katalog (który może nawet nie istnieć w danej chwili). Jest bardziej elastyczne niż dowiązanie twarde. Nie jest ograniczone do jednej partycji. Odpowiednikiem są skróty w Windows.

Dowiązanie twarde - również wskazuje na plik lub katalog w tym samym systemie plików. Dla systemu takie dowiązanie jest dodatkową nazwą dla elementu - plik mający n dowiązań ma też n nazw. Aby go całkowicie usunąć trzeba pozbyć się wszystkich dowiązań twardych.

2

Odpowiednikiem są skróty w Windows.

Skrót w Windows jest kompletnie innym tworem (to zwykły plik odpowiednio interpretowany przez powłokę). Odpowiednikiem linuksowego dowiązania symbolicznego w Windows są.. dowiązania symboliczne (np. utworzone za pomocą programu mklink).

1 użytkowników online, w tym zalogowanych: 0, gości: 1