
명령을 통해 두 파일 시스템 간에 파일을 이동하는 것이 mv
원자적 작업입니까?
답변1
EXDEV 오류(man 2 이름 바꾸기)를 참조하세요.
EXDEV oldpath and newpath are not on the same mounted filesystem. (Linux permits a filesystem to be mounted at multiple points, but rename() does not work across different mount points, even if the same filesystem is mounted on both.)
시스템 호출을 통해 파일 시스템 간에 이동할 수 없으므로 mv가 수행하는 작업은 사용자 공간 복사 및 삭제이며, 이는 결코 원자적이지 않습니다.
답변2
"원자"가 무엇을 의미하는지에 따라 다릅니다.
시스템 호출과 달리 rename()
두 파일 시스템 간의 파일 복사는 일반적으로 원자적이지 않습니다. 의 복사 루틴이 mv
호출되지 않았기 때문에 fsync(2)
감지되지 않은 늦은 파일 시스템 오류가 있을 수 있습니다.