Help! i can't backup one of all my directories

a few days ago, one of my directories suddenly stop when the backup is in process, the others one in the server it fine, but this every time when i try to run the backup stop with this error.

[root@tboxplanet developer]# restic -r gs:repo:/repo1/ --verbose backup /dir/dir/
fatal error: runtime: out of memorytal 885072 files 73.232 GiB, 0 errors
runtime.throw(0x7f18248796ea, 0x16)
/usr/lib/golang/src/runtime/panic.go:608 +0x74
runtime.sysMap(0xc058000000, 0xc000000, 0x7f18254ee658)
/usr/lib/golang/src/runtime/mem_linux.go:156 +0xc9
runtime.(*mheap).sysAlloc(0x7f18254d4840, 0xc000000, 0x7f181e1c54c0, 0xc00033be58)
/usr/lib/golang/src/runtime/malloc.go:619 +0x1c9
runtime.(*mheap).grow(0x7f18254d4840, 0x4456, 0x0)
/usr/lib/golang/src/runtime/mheap.go:920 +0x44
runtime.(*mheap).allocSpanLocked(0x7f18254d4840, 0x4456, 0x7f18254ee668, 0x20300400000000)
/usr/lib/golang/src/runtime/mheap.go:848 +0x339
runtime.(*mheap).alloc_m(0x7f18254d4840, 0x4456, 0x7f18240d0101, 0x7f1820bd5600)
/usr/lib/golang/src/runtime/mheap.go:692 +0x11d
runtime.(*mheap).alloc.func1()
/usr/lib/golang/src/runtime/mheap.go:759 +0x4e
runtime.(*mheap).alloc(0x7f18254d4840, 0x4456, 0xc000010101, 0x7f18240d1c59)
/usr/lib/golang/src/runtime/mheap.go:758 +0x8c
runtime.largeAlloc(0x88aada8, 0x7f1824100101, 0x7f1823bdb000)
/usr/lib/golang/src/runtime/malloc.go:1019 +0x99
runtime.mallocgc.func1()
/usr/lib/golang/src/runtime/malloc.go:914 +0x48
runtime.systemstack(0x0)
/usr/lib/golang/src/runtime/asm_amd64.s:351 +0x63
runtime.mstart()
/usr/lib/golang/src/runtime/proc.go:1229

goroutine 76 [running]:
runtime.systemstack_switch()
/usr/lib/golang/src/runtime/asm_amd64.s:311 fp=0xc000335290 sp=0xc000335288 pc=0x7f1824112220
runtime.mallocgc(0x88aada8, 0x7f1824d2d6a0, 0xc000335301, 0xc000335368)
/usr/lib/golang/src/runtime/malloc.go:913 +0x8a8 fp=0xc000335330 sp=0xc000335290 pc=0x7f18240c79e8
runtime.makeslice(0x7f1824d2d6a0, 0x88aada8, 0x88aada8, 0x8, 0xc03e462710, 0x40)
/usr/lib/golang/src/runtime/slice.go:70 +0x79 fp=0xc000335360 sp=0xc000335330 pc=0x7f18240fd059
bytes.makeSlice(0x88aada8, 0x0, 0x0, 0x0)
/usr/lib/golang/src/bytes/buffer.go:231 +0x6f fp=0xc0003353a0 sp=0xc000335360 pc=0x7f1824128b9f
bytes.(*Buffer).grow(0xc047f3a160, 0x192, 0x22)
/usr/lib/golang/src/bytes/buffer.go:144 +0x16e fp=0xc0003353f0 sp=0xc0003353a0 pc=0x7f18241284ee
bytes.(*Buffer).Write(0xc047f3a160, 0xc0131a9520, 0x192, 0x1a0, 0x0, 0x0, 0x0)
/usr/lib/golang/src/bytes/buffer.go:174 +0xe7 fp=0xc000335420 sp=0xc0003353f0 pc=0x7f18241287e7
encoding/json.compact(0xc047f3a160, 0xc0131a9520, 0x192, 0x1a0, 0x1, 0x0, 0x0)
/usr/lib/golang/src/encoding/json/indent.go:55 +0x4aa fp=0xc000335490 sp=0xc000335420 pc=0x7f18243c20ca
encoding/json.marshalerEncoder(0xc047f3a160, 0x7f1824e90220, 0xc04921c168, 0x196, 0x7f1824e90100)
/usr/lib/golang/src/encoding/json/encode.go:456 +0x1c1 fp=0xc000335510 sp=0xc000335490 pc=0x7f18243bb3a1
encoding/json.(*arrayEncoder).encode(0xc00000c590, 0xc047f3a160, 0x7f1824d13da0, 0xc042e0bf20, 0x197, 0x100)
/usr/lib/golang/src/encoding/json/encode.go:769 +0xde fp=0xc000335568 sp=0xc000335510 pc=0x7f18243be47e
encoding/json.(*arrayEncoder).encode-fm(0xc047f3a160, 0x7f1824d13da0, 0xc042e0bf20, 0x197, 0x7f18243b0100)
/usr/lib/golang/src/encoding/json/encode.go:776 +0x66 fp=0xc0003355a8 sp=0xc000335568 pc=0x7f18243c7866
encoding/json.(*sliceEncoder).encode(0xc00000c598, 0xc047f3a160, 0x7f1824d13da0, 0xc042e0bf20, 0x197, 0x100)
/usr/lib/golang/src/encoding/json/encode.go:743 +0x93 fp=0xc0003355f0 sp=0xc0003355a8 pc=0x7f18243be0c3
encoding/json.(*sliceEncoder).encode-fm(0xc047f3a160, 0x7f1824d13da0, 0xc042e0bf20, 0x197, 0x100)
/usr/lib/golang/src/encoding/json/encode.go:755 +0x66 fp=0xc000335630 sp=0xc0003355f0 pc=0x7f18243c77e6
encoding/json.(*structEncoder).encode(0xc02586ccc0, 0xc047f3a160, 0x7f1824db06a0, 0xc042e0bf20, 0x199, 0x7f18243b0100)
/usr/lib/golang/src/encoding/json/encode.go:647 +0x282 fp=0xc000335790 sp=0xc000335630 pc=0x7f18243bd052
encoding/json.(*structEncoder).encode-fm(0xc047f3a160, 0x7f1824db06a0, 0xc042e0bf20, 0x199, 0xc042e00100)
/usr/lib/golang/src/encoding/json/encode.go:661 +0x66 fp=0xc0003357d0 sp=0xc000335790 pc=0x7f18243c76e6
encoding/json.(*ptrEncoder).encode(0xc00000c5a0, 0xc047f3a160, 0x7f1824e10800, 0xc042e0bf20, 0x16, 0x7f1824e10100)
/usr/lib/golang/src/encoding/json/encode.go:788 +0xb5 fp=0xc000335818 sp=0xc0003357d0 pc=0x7f18243be695
encoding/json.(*ptrEncoder).encode-fm(0xc047f3a160, 0x7f1824e10800, 0xc042e0bf20, 0x16, 0xc02edd0100)
/usr/lib/golang/src/encoding/json/encode.go:793 +0x66 fp=0xc000335858 sp=0xc000335818 pc=0x7f18243c78e6
encoding/json.(*encodeState).reflectValue(0xc047f3a160, 0x7f1824e10800, 0xc042e0bf20, 0x16, 0x7f18254c0100)
/usr/lib/golang/src/encoding/json/encode.go:333 +0x84 fp=0xc000335890 sp=0xc000335858 pc=0x7f18243ba974
encoding/json.(*encodeState).marshal(0xc047f3a160, 0x7f1824e10800, 0xc042e0bf20, 0x100, 0x0, 0x0)
/usr/lib/golang/src/encoding/json/encode.go:305 +0xf6 fp=0xc0003358d8 sp=0xc000335890 pc=0x7f18243ba426
encoding/json.Marshal(0x7f1824e10800, 0xc042e0bf20, 0x7f181d829900, 0x0, 0x203012, 0x203012, 0x26)
/usr/lib/golang/src/encoding/json/encode.go:160 +0x54 fp=0xc000335950 sp=0xc0003358d8 pc=0x7f18243b9cf4
github .com/restic/restic/internal/archiver.(*Archiver).saveTree(0xc000116870, 0x7f1824ec01a0, 0xc02535c080, 0xc042e0bf20, 0x0, 0x0, 0x0, 0x0, 0xc000349c00, 0xc02edd6ae0, …)
internal/archiver/archiver.go:164 +0x61 fp=0xc000335a30 sp=0xc000335950 pc=0x7f182444fbf1
github .com/restic/restic/internal/archiver.(*Archiver).saveTree-fm(0x7f1824ec01a0, 0xc02535c080, 0xc042e0bf20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f18240e2a50, …)
internal/archiver/archiver.go:751 +0x78 fp=0xc000335af0 sp=0xc000335a30 pc=0x7f182445d6e8
github .com/restic/restic/internal/archiver.(*TreeSaver).save(0xc025a7ebc0, 0x7f1824ec01a0, 0xc02535c080, 0xc019b3d860, 0x45, 0xc02c657e00, 0xc043fdc000, 0x2c796, 0x2c796, 0xc03e4392c0, …)
internal/archiver/tree_saver.go:139 +0x244 fp=0xc000335db8 sp=0xc000335af0 pc=0x7f182445c5b4
github. com/restic/restic/internal/archiver.(*TreeSaver).worker(0xc025a7ebc0, 0x7f1824ec01a0, 0xc02535c080, 0xc02586a1e0, 0xc02535c080, 0x190)
internal/archiver/tree_saver.go:158 +0x278 fp=0xc000335f48 sp=0xc000335db8 pc=0x7f182445cb58
github .com/restic/restic/internal/archiver.NewTreeSaver.func1(0x2, 0x186ecb)
internal/archiver/tree_saver.go:63 +0x80 fp=0xc000335f98 sp=0xc000335f48 pc=0x7f182445d3c0
gopkg.in/tomb%2ev2.(*Tomb).run(0xc0004a0b40, 0xc02586c330)
vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d fp=0xc000335fd0 sp=0xc000335f98 pc=0x7f18243b0b5d
runtime.goexit()
/usr/lib/golang/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000335fd8 sp=0xc000335fd0 pc=0x7f18241141c1
created by gopkg.in/tomb%2ev2.(*Tomb).Go
vendor/gopkg.in/tomb.v2/tomb.go:159 +0xbc

goroutine 1 [running]:
goroutine running on other thread; stack unavailable

goroutine 18 [syscall, 26 minutes]:
os/signal.signal_recv(0x0)
/usr/lib/golang/src/runtime/sigqueue.go:139 +0x9e
os/signal.loop()
/usr/lib/golang/src/os/signal/signal_unix.go:23 +0x24
created by os/signal.init.0
/usr/lib/golang/src/os/signal/signal_unix.go:29 +0x43

goroutine 19 [chan receive, 26 minutes]:
github . com/restic/restic/internal/restic.init.0.func1.1()
internal/restic/lock.go:257 +0xb5
created by github .com/restic/restic/internal/restic.init.0.func1
internal/restic/lock.go:254 +0x37

goroutine 21 [chan receive, 26 minutes]:
github.com/restic/restic/internal/restic.init.2.func1(0xc00007c180)
internal/restic/progress_unix.go:17 +0x65
created by github. com/restic/restic/internal/restic.init.2
internal/restic/progress_unix.go:16 +0xad

goroutine 23 [select]:
go.opencensus. io/stats/view.(*worker).start(0xc000098fc0)
vendor/go. opencensus .io/stats/view/worker.go:147 +0xdf
created by go.opencensus. io/stats/view.init.0
vendor/go.opencensus.io/stats/view/worker.go:29 +0x59

goroutine 25 [chan receive, 26 minutes]:
main.CleanupHandler(0xc00007c8a0)
cmd/restic/cleanup.go:62 +0x5f
created by main.init.0
cmd/restic/cleanup.go:24 +0x69

pd: i can’t paste all message error, because i new in this forum

restic is in the version : restic 0.9.5 compiled with go1.11.5 on linux/amd64

This is the issue. Restic requires a bit of memory to cache the indexes. Your system simply seems to not have enough memory to run restic against your repository.

You may need to attach the repository disk to another system with more memory, remove some snapshots and prune, and then move the disk back.

Or, just put more RAM in the system.

Thanks, i will try upgrade he ram

Or instead of making a backup of a very large directory you can make multiple backups of with multiple folders inside there. If this is possible in your scenario. This would reduce the needed RAM for restic.

You can try setting GOGC=20 as environment variable and see if it helps. But this is likely just a short-term solution.