Felhasználói eszközök

Eszközök a webhelyen


oktatas:linux:mentes:duplicity

< Mentés

Duplicity

Bevezetés

A duplicity titkosított növekményes mentést tesz lehetővé. A mentés tar formátumban történik. Távoli mentéshez a librsync könyvtárat használja. Titkosításhoz a GnuPG-t.

GnuPG

# apt install gnupg

Kulcspár létrehozása:

gpg --gen-key
$ gpg --gen-key
gpg (GnuPG) 2.1.18; Copyright (C) 2017 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: directory '/home/janos/.gnupg' created
gpg: keybox '/home/janos/.gnupg/pubring.kbx' created
Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: Nagy János
Email address: janos@zold.and
You are using the 'utf-8' character set.
You selected this USER-ID:
    "Nagy János <janos@zold.and>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.


gpg: /home/janos/.gnupg/trustdb.gpg: trustdb created
gpg: key F04496D7577354DE marked as ultimately trusted
gpg: directory '/home/janos/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/home/janos/.gnupg/openpgp-revocs.d/007DA0FF9EA80EF3B080D386F04496D7577354DE.rev'
public and secret key created and signed.

pub   rsa2048 2018-09-15 [SC] [expires: 2020-09-14]
      007DA0FF9EA80EF3B080D386F04496D7577354DE
      007DA0FF9EA80EF3B080D386F04496D7577354DE
uid                      Nagy János <janos@zold.and>
sub   rsa2048 2018-09-15 [E] [expires: 2020-09-14]

Telepítés

apt install duplicity

Használat

cd
duplicity --encrypt-key 'Nagy János <janos@zold.and>' doc file://docsbackup
$ duplicity --encrypt-key janos@zold.and doc file://docsbackupLocal and Remote metadata are synchronized, no sync needed.
Last full backup date: none
No signatures found, switching to full backup.
--------------[ Backup Statistics ]--------------
StartTime 1537006597.94 (Sat Sep 15 12:16:37 2018)
EndTime 1537006597.97 (Sat Sep 15 12:16:37 2018)
ElapsedTime 0.03 (0.03 seconds)
SourceFiles 2
SourceFileSize 4122 (4.03 KB)
NewFiles 2
NewFileSize 4122 (4.03 KB)
DeletedFiles 0
ChangedFiles 0
ChangedFileSize 0 (0 bytes)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 2
RawDeltaSize 26 (26 bytes)
TotalDestinationSizeChange 518 (518 bytes)
Errors 0
-------------------------------------------------

A mentés után kapunk egy docsbackup nevű könyvtárat. Nézzünk bele a könyvtárba:

ls docsbackup
$ ls docsbackup/
duplicity-full.20180915T101637Z.manifest.gpg
duplicity-full.20180915T101637Z.vol1.difftar.gpg
duplicity-full-signatures.20180915T101637Z.sigtar.gpg

Három állományt találunk:

  • manifest.gpg
  • vol1.difftar.gpg
  • sigtar.gpg

A vol1.difftar.gpg tartalmazza az adatokat. A másik két fájl az inkrementális mentéshez tartalmaz inforációkat.

Későbbi backup

$ duplicity --encrypt-key janos@zold.and doc file://docsbackup
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Sat Sep 15 12:16:37 2018
--------------[ Backup Statistics ]--------------
StartTime 1537006817.01 (Sat Sep 15 12:20:17 2018)
EndTime 1537006817.04 (Sat Sep 15 12:20:17 2018)
ElapsedTime 0.03 (0.03 seconds)
SourceFiles 2
SourceFileSize 4136 (4.04 KB)
NewFiles 1
NewFileSize 4096 (4.00 KB)
DeletedFiles 0
ChangedFiles 1
ChangedFileSize 40 (40 bytes)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 2
RawDeltaSize 47 (47 bytes)
TotalDestinationSizeChange 540 (540 bytes)
Errors 0
-------------------------------------------------

Mentés távolra

Mentés:

duplicity --encrypt-key janos@zold.and doc sftp://user@tavol.hu:docsbackup

Visszaállítás:

duplicity sftp://user@tavol.hu:docsbackup docsrestore

Visszaállás 5 nappal ezelőttre:

duplicity --time 5D \
--file-to-restore titkok/bar.txt \
sftp://user@tavol.hu:docsbackup docsrestore

Egy fájl adott időre visszaállítás:

duplicity --time 5D --file-to-restore titkok/bar.txt \
sftp://user@tavol.hu:docsbackup docsrestore

Mentés helyben

duplicity full /valahol/data file:///valahova/backup
oktatas/linux/mentes/duplicity.txt · Utolsó módosítás: 2021/02/07 21:30 szerkesztette: admin