Restic: μ œμ™Έ 파일둜 $ RECYCLE.BIN μ œμ™Έκ°€ μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2020λ…„ 05μ›” 31일  Β·  4μ½”λ©˜νŠΈ  Β·  좜처: restic/restic

restic version

linux / amd64μ—μ„œ go1.10.4둜 컴파일 된 restic 0.9.6 (v0.9.6-0-gb723ca3d)

μ •ν™•νžˆ μ–΄λ–»κ²Œ νœ΄μ‹μ„ μ·¨ν–ˆμŠ΅λ‹ˆκΉŒ?

이쀑 λΆ€νŒ… Windows 10κ³Ό Ubuntu 18.04간에 κ³΅μœ λ˜λŠ” NTFS νŒŒν‹°μ…˜μ΄ μžˆλŠ”λ°, Ubuntuμ—μ„œ restic으둜 λ°±μ—…ν•©λ‹ˆλ‹€. μ•„μ‹œλ‹€μ‹œν”Ό Windows 10은 νŒŒν‹°μ…˜μ˜ 루트 디렉터리에 $RECYCLE.BIN 디렉터리λ₯Ό λ§Œλ“€μ–΄ νœ΄μ§€ν†΅μœΌλ‘œ 이동 ν•œ νŒŒμΌμ„ λ³΄κ΄€ν•©λ‹ˆλ‹€. 곡유 νŒŒν‹°μ…˜μ„ λ°±μ—…ν•˜κ³  μ‹Άμ§€λ§Œ $RECYCLE.BIN λ””λ ‰ν„°λ¦¬λŠ” λ°±μ—…ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

더 μ•„λž˜μ—μ„œ λ‚΄κ°€ κ΄€μ°°ν•˜λŠ” 것을 μž¬ν˜„ν•˜λŠ” 방법에 λŒ€ν•œ μžμ„Έν•œ μ„€λͺ…을 μ œκ³΅ν–ˆμŠ΅λ‹ˆλ‹€. κ°„λ‹¨νžˆ λ§ν•΄μ„œ : λ°±μ—… λͺ…λ Ήκ³Ό ν•¨κ»˜ --exclude="\$RECYCLE.BIN" μ‚¬μš©ν•˜λ©΄ "$ RECYCLE.BIN"(λ˜λŠ” λ‚΄κ°€ 생각할 μˆ˜μžˆλŠ” λ‹€λ₯Έ λ³€ν˜•, μ•„λž˜ μ°Έμ‘°)을 --exclude-file λ„£μ–΄ 디렉터리가 μ œμ™Έλ©λ‹ˆλ‹€. 디렉토리λ₯Ό μ œμ™Έν•˜μ§€ λ§ˆμ‹­μ‹œμ˜€.

μ €μž₯μ†Œλ₯Ό μ €μž₯ν•˜λŠ” 데 μ‚¬μš©ν•œ λ°±μ—”λ“œ / μ„œλ²„ / μ„œλΉ„μŠ€λŠ” λ¬΄μ—‡μž…λ‹ˆκΉŒ?

둜컬 μ €μž₯μ†Œ (Ubuntu 18.04 μ•„λž˜)와 SFTPλ₯Ό ν†΅ν•œ 원격 μ €μž₯μ†Œ (Ubuntu 18.04μ—μ„œλ„ λ°±μ—… μ‹€ν–‰)μ—μ„œ λ™μž‘μ„ κ΄€μ°°ν•©λ‹ˆλ‹€.

μ˜ˆμƒλ˜λŠ” 행동

$RECYCLE.BIN ν΄λ”λŠ” μ œμ™Έ νŒŒμΌμ— μΆ”κ°€ 될 λ•Œ λ°±μ—…μ—μ„œ μ œμ™Έλ©λ‹ˆλ‹€.

μ‹€μ œ 행동

$RECYCLE.BIN ν΄λ”λŠ” μ œμ™Έ νŒŒμΌμ— μΆ”κ°€λ˜μ—ˆμ§€λ§Œ 백업에 ν¬ν•¨λ©λ‹ˆλ‹€.

행동을 μž¬ν˜„ν•˜λŠ” 단계

μž„μ‹œ ν…ŒμŠ€νŠΈ 디렉토리 λ‚΄μ—μ„œ bashμ—μ„œ λ‹€μŒ λͺ…령을 μ‹€ν–‰ν•˜μ‹­μ‹œμ˜€.

# prepare the directory to be backed up
mkdir "data";
mkdir "data/\$RECYCLE.BIN";
touch "data/backup_this";
touch "data/\$RECYCLE.BIN"/ignore_this";

# init repo
mkdir "repo";
restic init --repo=repo/

# prepare exclude file
echo "\$RECYCLE.BIN" > exclude.file

이제 restic --repo=repo/ backup --verbose --verbose data/ λ°œν–‰ν•˜λ©΄ λ‹€μŒκ³Ό 같은 수읡이 λ°œμƒν•©λ‹ˆλ‹€.

open repository
enter password for repository: 
repository 837fc3f7 opened successfully, password is correct
lock repository
load index files
start scan on [data/]
start backup on [data/]
scan finished in 0.257s: 2 files, 0 B
new       /data/$RECYCLE.BIN/ignore_this, saved in 0.004s (0 B added)
new       /data/backup_this, saved in 0.000s (0 B added)

Files:           2 new,     0 changed,     0 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Data Blobs:      0 new
Tree Blobs:      1 new
Added to the repo: 372 B

processed 2 files, 0 B in 0:00
snapshot 27c00c6b saved

μ˜ˆμƒλŒ€λ‘œ.

restic --repo=repo/ backup --verbose --verbose --exclude="\$RECYCLE.BIN" data/ λ°œν–‰ 수읡λ₯ 

open repository
enter password for repository: 
repository 837fc3f7 opened successfully, password is correct
lock repository
load index files
using parent snapshot 27c00c6b
start scan on [data/]
start backup on [data/]
scan finished in 0.257s: 1 files, 0 B
unchanged /data/backup_this

Files:           0 new,     0 changed,     1 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Data Blobs:      0 new
Tree Blobs:      1 new
Added to the repo: 372 B

processed 1 files, 0 B in 0:00
snapshot 61c27a16 saved

그것은 λ˜ν•œ μ˜ˆμƒλ©λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜ restic --repo=repo/ backup --verbose --verbose --exclude-file=exclude.file data/ λ°œν–‰ν•˜λ©΄

 $ cat exclude.file 
$RECYCLE.BIN

κ²°κ³Ό

open repository
enter password for repository: 
repository 837fc3f7 opened successfully, password is correct
lock repository
load index files
using parent snapshot 61c27a16
start scan on [data/]
start backup on [data/]
scan finished in 0.211s: 2 files, 0 B
unchanged /data/backup_this
new       /data/$RECYCLE.BIN/ignore_this, saved in 0.003s (0 B added)

Files:           1 new,     0 changed,     1 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Data Blobs:      0 new
Tree Blobs:      0 new
Added to the repo: 0 B  

processed 2 files, 0 B in 0:00
snapshot 9a62470f saved

즉, 디렉토리가 μ œμ™Έ νŒŒμΌμ— μžˆμ–΄λ„ λ°±μ—…μ—μ„œ μ œμ™Έλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

λ˜ν•œ μ œμ™Έ 파일의 λ‹€λ₯Έ λ³€ν˜• (λ‹¬λŸ¬ 기호 μ΄μŠ€μΌ€μ΄ν”„, λ”°μ˜΄ν‘œ μΆ”κ°€, 파일 끝에 쀄 λ°”κΏˆ μΆ”κ°€)을 μ‹œλ„ν–ˆμ§€λ§Œ 디렉토리λ₯Ό μ œμ™Έν•˜κΈ° μœ„ν•΄ μ–΄λ–€ 것도 νœ΄μ‹μ„ μ·¨ν•˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

이 문제의 원인이 무엇인지 μ•Œκ³  μžˆμŠ΅λ‹ˆκΉŒ?

λΆˆμΎŒν•œ 문자 (예 : λ‹¬λŸ¬ 기호)κ°€ 포함 된 μ œμ™Έ 파일의 파일 이름을 처리 ν•  λ•Œ μ•½κ°„μ˜ 였λ₯˜κ°€ μžˆλ‹€κ³  κ°€μ •ν•©λ‹ˆλ‹€.

문제λ₯Ό ν•΄κ²°ν•˜λŠ” 방법을 μ•Œκ³  μžˆμŠ΅λ‹ˆκΉŒ?

λΆˆν–‰νžˆλ„ 이동에 λŒ€ν•œ λ‹¨μ„œκ°€ μ—†μ§€λ§Œ (μ €λŠ” C ++μ—λ§Œ λŠ₯ν†΅ν•©λ‹ˆλ‹€) μ΄μƒν•œ 문자λ₯Ό ν¬ν•¨ν•œ 파일 이름을 λ‹€λ£° λ•Œ OS 및 / λ˜λŠ” 파일 μ‹œμŠ€ν…œκ³Όμ˜ μƒν˜Έ μž‘μš©μ— λ¬Έμ œκ°€μžˆμ„ κ²ƒμž…λ‹ˆλ‹€.

였늘 Restic이 도움이 λ˜μ—ˆμŠ΅λ‹ˆκΉŒ? μ–΄λ–€ 식 μœΌλ‘œλ“  당신을 ν–‰λ³΅ν•˜κ²Œ λ§Œλ“€μ—ˆλ‚˜μš”?

둜컬 및 원격 λ°±μ—… λͺ¨λ‘μ— restic을 κ΄‘λ²”μœ„ν•˜κ²Œ μ‚¬μš©ν•©λ‹ˆλ‹€. 쒋은 일을 κ³„μ†ν•˜μ‹­μ‹œμ˜€!
이 문제λ₯Ό ν•΄κ²°ν•˜λŠ” 데 도움이 더 ν•„μš”ν•˜λ©΄ μ•Œλ €μ£Όμ„Έμš”.

backup need feedback questioproblem

λͺ¨λ“  4 λŒ“κΈ€

--exclude 에 λŒ€ν•΄ ν™•μ‹€ν•˜μ§€ μ•Šμ§€λ§Œ μ œμ™Έ νŒŒμΌμ—μ„œ restic은 ν™˜κ²½ λ³€μˆ˜λ₯Ό ν™•μž₯ν•©λ‹ˆλ‹€. 이λ₯Ό λ°©μ§€ν•˜λ €λ©΄ $$RECYCLE.BIN λ₯Ό μ‚¬μš©ν•˜μ‹­μ‹œμ˜€.

μ°Έμ‘° : https://restic.readthedocs.io/en/latest/040_backup.html#except -files

음, κ°μ‚¬ν•©λ‹ˆλ‹€. λ¬Έμ„œμ—μ„œμ΄ 단일 단락을 μ •ν™•νžˆ κ°„κ³Ό ν•œ 것 κ°™μŠ΅λ‹ˆλ‹€.

μž‘λ™ν•˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

 $ cat exclude.file 
$$RECYCLE.BIN

restic --repo=repo/ backup --verbose --verbose --exclude-file=exclude.file data/ λ‹€μ‹œ λ°œν–‰ν•˜λ©΄

open repository
enter password for repository: 
repository 837fc3f7 opened successfully, password is correct
lock repository
load index files
using parent snapshot 96bdd658
start scan on [data/]
start backup on [data/]
scan finished in 0.211s: 1 files, 0 B
unchanged /data/backup_this

Files:           0 new,     0 changed,     1 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Data Blobs:      0 new
Tree Blobs:      0 new
Added to the repo: 0 B  

processed 1 files, 0 B in 0:00
snapshot 5c475b96 saved

μ˜ˆμƒλŒ€λ‘œ.

κ·ΈλŸ¬λ‚˜ λ¦¬λˆ…μŠ€ κ²½ν—˜ μ§€κΈˆμ€ 10μ—¬ λ…„ λ™μ•ˆ λ‚˜λŠ” νƒˆμΆœ ν•  ν•„μš”κ°€ λ°œμƒν•˜μ§€ $ 둜 $$ λŒ€μ‹ μ— \$ ν•˜μ§€λ§Œ, λ¬Έμ„œ μƒνƒœλ‘œ,이 ν‘œμ€€μ΄ 될 κ²ƒμœΌλ‘œ 보인닀 os.ExpandEnv , 이것은 resticμ—λ§Œ κ΅­ν•œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜ restic --repo=repo/ backup --verbose --verbose --exclude="$$RECYCLE.BIN" data/

open repository
enter password for repository: 
repository 837fc3f7 opened successfully, password is correct
lock repository
load index files
using parent snapshot 5c475b96
start scan on [data/]
start backup on [data/]
scan finished in 0.204s: 2 files, 0 B
new       /data/$RECYCLE.BIN/ignore_this, saved in 0.002s (0 B added)
unchanged /data/backup_this

Files:           1 new,     0 changed,     1 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Data Blobs:      0 new
Tree Blobs:      0 new
Added to the repo: 0 B  

processed 2 files, 0 B in 0:00
snapshot ed44b219 saved

그것은 맀우 일관성이없고 반 직관적 인 κ²ƒμ²˜λŸΌ λ³΄μž…λ‹ˆλ‹€.

--exclude="$$RECYCLE.BIN" 의 큰 λ”°μ˜΄ν‘œλŠ” μ‰˜μ΄ $$ λ₯Ό ν˜„μž¬ PID둜 ν™•μž₯ 함을 μ˜λ―Έν•©λ‹ˆλ‹€. μž‘μ€ λ”°μ˜΄ν‘œλ‘œ μ‹œλ„ν•΄λ³΄μ„Έμš” : --exclude='$$RECYCLE.BIN'

(예 : echo "$$RECYCLE.BIN" vs echo '$$RECYCLE.BIN' )

@kontakm λ¬Έμ œκ°€ ν•΄κ²° 된 것 κ°™μŠ΅λ‹ˆλ‹€. 이 경우 λ‹«μœΌμ‹­μ‹œμ˜€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰