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μ κ΄λ²μνκ² μ¬μ©ν©λλ€. μ’μ μΌμ κ³μνμμμ€!
μ΄ λ¬Έμ λ₯Ό ν΄κ²°νλ λ° λμμ΄ λ νμνλ©΄ μλ €μ£ΌμΈμ.
--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 λ¬Έμ κ° ν΄κ²° λ κ² κ°μ΅λλ€. μ΄ κ²½μ° λ«μΌμμμ€.