June 03, 2019

Five differences between soft links and hard links.



Link: A word used to refer to a shortcut file in Linux.

링크: 리눅스에서 바로가기 파일을 호칭할 때 사용하는 단어.

There are two types of links.

링크는 크게 두 종류로 구분된다.

소프트 링크(Soft link) = 심볼릭 링크(Symbolic) - S
하드 링크(Hard link) - H


1. I-node

(S) It does not share the i-node of the original file(It use new i-node).

(S) 원본 파일과 I-node를 공유하지 않는다.

(H) It shares i-node of the original file

(H) 원본 파일과 I-node를 공유한다.

* I-node: The information(data structure) to distinguish each file and has a unique number.

* I-node(아이노드): 각 파일을 구분하는 기준이 되는 정보(자료구조)이며, 고유한 번호를 갖는다.


2. Create.  생성.

(S) It is possible to create a different file system

(S) 서로 다른 파일 시스템에 생성 가능.

(H) It is impossible to create a different file system.

(H) 서로 다른 파일 시스템에 생성 불가능.

* File system: How to manage data on disk.

* File system(파일 시스템): 디스크 내 데이터 관리 방식.


3. Work.  동작.

(S) It doesn't work if original file is deleted.

(S) 원본 파일 제거 시 동작 불가.

(H) It works even if original file is deleted.

(H) 원본 파일 제거 시에도 동작 가능.


4. The number of links.  링크 개수.

(S) It isn't reflected in the number of links that can be checked at "ls -al".

(S) "ls -al"로 확인 시 링크 개수에 반영되지 않음.

(H) It is reflected in the number of links that can be checked at "ls -al".

(H) "ls -al"로 확인 시 링크 개수에 반영됨.


5. File type.  파일 타입.

(S) It is recorded as the link file type that can be checked in "ls -al".

"ls -al"로 확인 시 파일 타입이 링크 타입으로 기록됨.

(H) It isn't recorded as the link file type that can be checked in "ls -al".

"ls -al"로 확인 시 파일 타입이 링크 타입으로 기록되지 않음(일반 파일).


It is important to consider whether each file is a separate file with different I-nodes.

각 파일이 서로 다른 I-node를 가진 별도의 파일인지 아닌지의 여부를 고려하는 것이 핵심.