İstediğini yapmanın birçok yolu var. En basit olanı bir ppe kullanmaktır:
tar zcvf - MyBackups | ssh user@server "cat > /path/to/backup/foo.tgz"
Burada sıkıştırma tarhangi çağrılar gzip( zbayrak) tarafından yapılır . Ayrıca compress( Z) ve bzip( j) kullanabilirsiniz. Bunun için 7z:
tar cf - MyBackups | 7za a -si -mx=9 -ms=on MyBackups.tar.7z |
ssh user@server "cat > /path/to/backup/foo.7z"
En iyi yolu, ancak, muhtemelen rsync.
Rsync is a fast and extraordinarily versatile file copying tool. It can copy
locally, to/from another host over any remote shell, or to/from a remote rsync dae‐
mon. It offers a large number of options that control every aspect of its behavior
and permit very flexible specification of the set of files to be copied. It is
famous for its delta-transfer algorithm, which reduces the amount of data sent over
the network by sending only the differences between the source files and the exist‐
ing files in the destination. Rsync is widely used for backups and mirroring and
as an improved copy command for everyday use.
rsyncsahiptir yolu çok fazla seçenek. Gerçekten onlar aracılığıyla okumaya değer ancak ilk bakışta korkutucu. Bu bağlamda umursadıklarınız:
-z, --compress compress file data during the transfer
--compress-level=NUM explicitly set compression level
-z, --compress
With this option, rsync compresses the file data as it is sent to the desti‐
nation machine, which reduces the amount of data being transmitted --
something that is useful over a slow connection.
Note that this option typically achieves better compression ratios than can
be achieved by using a compressing remote shell or a compressing transport
because it takes advantage of the implicit information in the matching data
blocks that are not explicitly sent over the connection.
Yani, sizin durumunuzda, böyle bir şey istersiniz:
rsync -z MyBackups user@server:/path/to/backup/
Dosyalar transit halindeyken sıkıştırılır ve hedefe dekompresyon yapılır.
Bazı daha fazla seçenek:
scp veriyi sıkıştırabilir
-C Compression enable. Passes the -C flag to ssh(1) to
enable compression.
$ scp -C source user@server:/path/to/backup
Güzelleşmenin rsyncve 7zagüzelce oynamanın bir yolu olabilir ama bunu yapmanın bir anlamı yok. Bunun yararı, rsyncyalnızca yerel ve uzak dosyalar arasında değişen bitleri kopyalayabilmesidir. Bununla birlikte, küçük bir yerel değişiklik çok farklı bir sıkıştırılmış dosyaya neden olabilir, bu yüzden bunun için hiçbir anlamı yoktur rsync. Sadece faydası olmayan işleri karmaşıklaştırıyor. Sadece sshyukarıda gösterildiği gibi doğrudan kullanın . Bunu gerçekten yapmak istiyorsan, bir alt kabuk argümanı olarak vererek deneyebilirsin rsync. Sistemimde bununla çalışamadım 7zaçünkü sıkıştırılmış veriyi bir terminale yazmanıza izin vermiyor. Belki de uygulamanız farklıdır. Gibi bir şey deneyin ( bu benim için işe yaramaz ):
rsync $(tar cf - MyBackups | 7za a -an -txz -si -so) \
user@server:/path/to/backup
Başka bir nokta, 7z Linux'taki yedeklemeler için kullanılmaması gerektiğidir . 7zMan sayfasında belirtildiği gibi :
7-zip biçimini Linux / Unix'te yedekleme amacıyla KULLANMAYIN, çünkü:
- 7-zip, dosyanın sahibini / grubunu saklamaz.
-zen az iki kat daha yavaş. Kullanılarak SSH üzerinde rsyncing, kurulum, bir rsync sunucusu ve rsync daha fazla hız için-Wbayrağı (kopya dosyaları (a / a), delta-havalesine algoritma o bütün.