Linux는 마운트 지점의 기존 파일과 어떤 관계가 있습니까? 마운트하려고하면 Linux에서 오류 메시지가

이미 파일이 들어있는 폴더를 마운트하려고하면 Linux에서 오류 메시지가 표시되거나 마운트 된 파일 시스템과 폴더에 이미있는 파일을 모두 표시합니까?



답변

폴더가 마운트되고 폴더가 마운트 해제되면 파일이 사라지고 파일이 사라집니다.


답변

디렉토리에 파일 시스템을 마운트하면 /mount-point더 이상 /mount-point직접 파일에 액세스 할 수 없습니다 . 그것들은 여전히 ​​존재하지만 /mount-point이제는 마운트 지점으로 사용 된 디렉토리가 아니라 마운트 된 파일 시스템의 루트를 참조하므로 최소한이 방법으로이 디렉토리의 내용에 액세스 할 수 없습니다. 예를 들면 다음과 같습니다.

# touch /mount-point/somefile
# ls /mount-point/somefile
/mount-point/somefile
# mount /dev/something /mount-point
# ls /mount-point/somefile
ls: cannot access /mount-point/somefile: No such file or directory

마운트 된 파일 시스템과 이미 존재하는 데이터의 병합 된보기를 얻는 방법이 있지만 공용 파일 시스템 이라는 추가 계층이 필요합니다 .

Linux에서는 숨겨진 파일을 볼 수있는 방법이 있습니다. mount --bind마운트 지점이있는 파일 시스템의 다른보기를 얻는 데 사용할 수 있습니다 . 예를 들어

mount --bind / /other-root-view

루트 파일 시스템의 모든 파일은 아래에 /other-root-view있습니다.

# cat /other-root-view/etc/hostname
darkstar

특히, /mount-point이제 액세스 할 수 /other-root-view/mount-point및 이후 /other-root-view/mount-point마운트 지점이 아닌, 당신은 그 내용이 볼 수 있습니다 :

# ls /mount-point/somefile
ls: cannot access /mount-point/somefile: No such file or directory
# ls /other-root-view/mount-point/somefile
/other-root-view/mount-point/somefile