자동적이고 안정적인 데이터 백업

자동적이고 안정적인 데이터 백업

내 컴퓨터에는 무손실 음악이 많이 있습니다. 불행하게도 때때로 (지금은 거의) 손상되어 외장 하드 드라이브의 백업으로 교체해야 합니다.

백업은 수동으로 수행되므로 확실히 지루합니다. 내 음악 컬렉션이 계속해서 늘어나면서 보관되지 않은 앨범을 수동으로 찾는 것이 점점 더 어려워지고 있습니다.

이 상황에 대한 최선의 해결책은 무엇입니까? 단순히 cp-ing? 약간의 rsync사용법? 기존 파일을 업데이트하고 싶지 않습니다. 파일은 거의 변경되지 않으며 파일을 손상시키는 좋은 파일을 삭제하고 싶지 않습니다.

답변1

진심으로 추천합니다 rsync. 소스와 비교하여 대상에서 누락된 파일을 자동으로 감지하고 해당 파일만 복사할 수 있습니다. IIUC는 귀하의 사용 사례에 가장 적합한 솔루션입니다. 귀하의 경우에는 항상 모든 파일 을 cp복사하고 rsync.rsync

rsync나중에 네트워크를 통해 사용하기로 결정한 경우 원본 컴퓨터와 대상 컴퓨터 모두에 설치해야 합니다. 이것이 내가 아는 유일한 단점이다 rsync.

편집하다:

rsync사용법은 매우 간단합니다. 일반적으로 다음 명령으로 요약됩니다.

$ rsync -avz <SOURCE> <DESTINATION>

-a아카이브 모드를 의미 - 디렉토리를 반복적으로 복사하고 심볼릭 링크를 다시 생성하고, 권한 저장, 수정 시간, 그룹 소유자hsip, 소유자, -v장황함을 의미, -z압축을 의미

다운로드 시 임시 파일 이름 앞에는 ..DESTINATIONDESTINATIONSOURCE

rsync사용하기 쉽습니다 ssh:

$ rsync -avz -e ssh hosting:/home1/rkumvbrh/mail/drabczyk.org/arkadiusz .

-e sshssh가 기본값이므로 생략할 수 있습니다.

$ rsync -avz hosting:/home1/rkumvbrh/mail/drabczyk.org/arkadiusz .

네트워크를 통해 사용하는 경우 rsync양쪽 끝에 설치해야 합니다.

$ rsync -avz -e "ssh" router:<FILE> .
ash: rsync: not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(226) [Receiver=3.1.0]

편집하다:

글쎄, 처음에는 로컬 디스크의 손상된 파일을 모두 외부 디스크의 파일로 교체하고 외부 디스크의 새 파일을 복사하고 싶다고 생각했습니다. 하지만 내부 디스크의 새 파일만 외부 디스크로 복사하려는 경우 --ignore-existing새 파일은 외부 디스크로 복사되지만 손상된 파일은 복사되지 않도록 옵션을 추가해야 합니다 .

$ rsync -avz --ignore-existing <PATH/TO/INTERNAL_HDD> <PATH/TO/EXTARNAL_HDD>

에서 man rsync:

--ignore-existing 이는 rsync에게 대상에 이미 존재하는 파일 업데이트를 건너뛰도록 지시합니다(기존 디렉터리를 무시하지 않으며, 그렇지 않으면 아무 작업도 수행되지 않습니다). --기존도 참조하세요.

   This option is a transfer rule, not an exclude, so it
   doesn't affect the data that goes into the file-lists, and
   thus it doesn't affect deletions. It just limits the files
   that the receiver requests to be transferred.

   This option can be useful for those doing backups using the
   --link-dest option when they need to continue a backup run that
   got interrupted. Since a --link-dest run is copied into a new
   directory hierarchy (when it is used properly), using --ignore
   existing will ensure that the already-handled files don't
   get tweaked (which avoids a change in permissions on the
   hard-linked files). This does mean that this option is only
   looking at the existing files in the destination hierarchy
   itself.

답변2

rsync 명령에 -c를 추가하면 모든 파일이 양쪽에서 동일하게 됩니다.

관련 정보