ZFS 스냅 샷 활성화 없다는 것을 알았습니다. 스냅

실수로 내 zfs 풀에서 일부 파일을 삭제하고 최신 스냅 샷을 마운트하려고했지만 스냅 샷이 없다는 것을 알았습니다. 스냅 샷을 활성화하고 구성하는 방법은 무엇입니까?

Ubuntu 12.04.1 서버와 zfs 0.6.1을 사용하고 있으며 풀 버전은 28입니다.



답변

스냅 샷을 작성하지 않은 경우 데이터가 손실됩니다.

스냅 샷을 만들려면 zfs snapshotcommand를 사용하십시오.

http://docs.oracle.com/cd/E19253-01/819-5461/gbcya/index.html


답변

Ubuntu 17.04부터 다음과 같이 zfs-auto-snapshot을 설치할 수 있습니다.

sudo apt install zfs-auto-snapshot

17.04 이전의 Ubuntu 버전의 경우 저장소에서 자동 스냅 을 사용하도록 zfs-auto-snapshot 을 설정할 수 있습니다

sudo add-apt-repository ppa:zfs-native/stable; sudo apt-get install zfs-auto-snapshot

또는 github에서 직접

curl -L https://github.com/zfsonlinux/zfs-auto-snapshot/archive/master.tar.gz | tar xz -C /tmp/
pushd /tmp/zfs-auto-snapshot-master && sudo make install && popd && rm -rf /tmp/zfs-auto-snapshot-master

기본적으로 15 분마다 각 데이터 세트에 대한 스냅 샷을 작성하고 최대 1 년까지 스냅 샷을 저장합니다. 그러나 com.sun:auto-snapshotdataset 속성을 false 로 설정하여 특정 데이터 세트에 대한 스냅 샷을 비활성화 할 수 있습니다

sudo zfs set com.sun:auto-snapshot=false tank/tmp

com.sun:auto-snapshot:...속성을 사용 하여 자동 스냅 샷 동작을 조정할 수도 있습니다 . 예를 들어 탱크 / 백업 데이터 세트에 대해 31 일 동안 매일 스냅 샷을 저장합니다.

sudo zfs set com.sun:auto-snapshot=true tank/backup
sudo zfs set com.sun:auto-snapshot:monthly=false tank/backup
sudo zfs set com.sun:auto-snapshot:weekly=false tank/backup
sudo zfs set com.sun:auto-snapshot:daily=true tank/backup
sudo zfs set com.sun:auto-snapshot:hourly=false tank/backup
sudo zfs set com.sun:auto-snapshot:frequent=false tank/backup

기본적으로 스크립트는 다음을 저장합니다.

  • 15 분마다 잦은 스냅 샷, 4 개의 스냅 샷 유지
  • 24 시간마다 스냅 샷을 유지하면서 1 시간마다 시간별 스냅 샷
  • 31 개의 스냅 샷을 유지하면서 매일 스냅 샷을 매일
  • 매주 주별 스냅 샷, 7 개의 스냅 샷 유지
  • 매월 12 개의 스냅 샷을 유지하면서 매월 스냅 샷