
Ich suche nach einer Möglichkeit, meinen Debian-Server zu sichern. Für die Datenpartition habe ich eine Lösung mit rsync, das Backup geht auf ein verschlüsseltes NTFS-Laufwerk. NTFS, weil ich das Laufwerk oft mitnehme, um auf meinem Windows-Laptop Filme usw. anzuschauen.
Das Sichern des Systems mit rsync funktioniert nicht, da die Berechtigungen bei NTFS nicht erhalten bleiben. Ich dachte an ein tar
Archiv, aber das --update
Flag fügt nur neue Dateien hinzu und löscht keine Dateien, die nicht mehr vorhanden sind.
Gibt es eine Möglichkeit, ein gutes, containerinternes Backup zu erhalten, bei dem die Berechtigungen erhalten bleiben und das wie ein Rsync-Update aktualisierbar ist?
Antwort1
Eine Möglichkeit, Ihren Speicherbedarf zu decken, wäre die Erstellung einesLoopback-Dateisysteminnerhalb Ihrer NTFS-Partition, aber der Haken dabei ist, dass die Leistung eines solchen Loop-Geräts schlechter wäre, weil die Eingabe/Ausgabe (E/A) in einem Dateisystem innerhalb eines Dateisystems erfolgen würde.
Es ist ziemlich einfach, ein Loopback-Dateisystem einzurichten. Vorausgesetzt, /demo
Sie haben Ihr NTFS-Gerät dort gemountet:
Erstellen Sie eine leere, nicht spärliche Datei
Die Größe ist frei wählbar. Mein Beispiel ist 1GiB groß:
root@node51 [/demo]# dd if=/dev/zero of=loopback.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 1.88537 s, 570 MB/s
Formatieren Sie die Datei mit einem Dateisystem, das über alle erforderlichen Berechtigungen verfügt
In diesem Beispiel verwende ich ext4:
root@node51 [/demo]# mkfs.ext4 loopback.img
mke2fs 1.42.9 (4-Feb-2014)
loopback.img is not a block special device.
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
Sie haben gerade ein Dateisystem innerhalb einer Datei erstellt.
Mounten Sie das neue Dateisystem
root@node51 [/demo]# mount -o loop loopback.img /mnt
Legen Sie Daten in Ihr neues Dateisystem ab
root@node51 [/demo]# echo "Data data data" > /mnt/file.txt
root@node51 [/demo]# ll /mnt/
total 28
drwxr-xr-x 3 root root 4096 May 25 09:31 ./
drwxr-xr-x 24 root root 4096 May 25 09:29 ../
-rw-r--r-- 1 root root 15 May 25 09:31 file.txt
drwx------ 2 root root 16384 May 25 09:30 lost+found/
Praktischerweise können Sie die Größe des Ext4-Dateisystems recht flexibel ändern.
Beispiel vergrößern
root@node51 [/demo]# ll -h
total 33M
drwxr-xr-x 2 root root 4.0K May 25 09:30 ./
drwxr-xr-x 24 root root 4.0K May 25 09:29 ../
-rw-r--r-- 1 root root 1.0G May 25 09:31 loopback.img
root@node51 [/demo]# umount loopback.img
root@node51 [/demo]# e2fsck -f loopback.img
e2fsck 1.42.9 (4-Feb-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
loopback.img: 12/65536 files (0.0% non-contiguous), 12636/262144 blocks
root@node51 [/demo]# resize2fs loopback.img 4G
resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on loopback.img to 1048576 (4k) blocks.
The filesystem on loopback.img is now 1048576 blocks long.
root@node51 [/demo]# ll -h
total 33M
drwxr-xr-x 2 root root 4.0K May 25 09:30 ./
drwxr-xr-x 24 root root 4.0K May 25 09:29 ../
-rw-r--r-- 1 root root 4.0G May 25 09:32 loopback.img
Beispiel zum Verkleinern
root@node51 [/demo]# ll -h
total 33M
drwxr-xr-x 2 root root 4.0K May 25 09:30 ./
drwxr-xr-x 24 root root 4.0K May 25 09:29 ../
-rw-r--r-- 1 root root 4.0G May 25 09:32 loopback.img
root@node51 [/demo]# e2fsck -f loopback.img
e2fsck 1.42.9 (4-Feb-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
loopback.img: 12/262144 files (0.0% non-contiguous), 25167/1048576 blocks
root@node51 [/demo]# resize2fs loopback.img 128M
resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on loopback.img to 32768 (4k) blocks.
The filesystem on loopback.img is now 32768 blocks long.
root@node51 [/demo]# ll -h
total 33M
drwxr-xr-x 2 root root 4.0K May 25 09:30 ./
drwxr-xr-x 24 root root 4.0K May 25 09:29 ../
-rw-r--r-- 1 root root 128M May 25 09:44 loopback.img
Antwort2
Sie können dar ( versuchen.http://dar.linux.free.fr/), da es über inkrementelle Backup-Funktionen verfügt. Ich habe es noch nicht für die Notfallwiederherstellung versucht, aber normale Backups scheinen problemlos zu funktionieren.