Datenmigration mit rclone – einfach machen!
Datenmigration leicht gemacht. Der IONOS S3 Object Storage bietet praktisch unbegrenzt kostengünstigen Speicherplatz. Dieser ist ideal geeignet, um zum Beispiel Daten zu archivieren oder Backups zur Datensicherung abzulegen.
In diesem Artikel möchte ich ein Tool vorstellen, mit dem Daten sehr einfach in den Object Storage von IONOS migriert werden können – rclone.
Rclone ist ein freies Tool, das für etliche Linux/Unix-Plattformen, Windows und macOS als Binary bereitgestellt wird. Die Installation besteht im einfachsten Fall im Entpacken eines ZIP-Archivs. rclone unterstützt als Ziel und als Quelle der Daten lokalen Speicher, Object Storages der verschiedensten Anbieter, FTP und HTTP und weitere.
Installation
Zur Installation wird zunächst das für das Betriebssystem passende ZIP-Archiv von der Download-Seite heruntergeladen.
Zum Beispiel für Windows 64bit:
Die jeweils aktuelle Version kann auch über die URL
https://downloads.rclone.org/rclone-current-<platform-type>.zip
heruntergeladen werden. Zum Beispiel für Linux:
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
Das Archiv wird ausgepackt und stellt alle benötigten Dateien im Verzeichnis
rclone-<version>-<platform-type>/
bereit:
root@debian:~# ls -la rclone-v1.38-linux-amd64
total 17432
drwxrwxr-x 2 root root 4096 Sep 30 14:23 .
drwx------ 8 root root 4096 Dec 20 21:26 ..
-rwxrwxr-x 1 root root 16958816 Sep 30 14:23 rclone
-rw-rw-r-- 1 root root 296086 Sep 30 14:21 rclone.1
-rw-rw-r-- 1 root root 315539 Sep 30 14:21 README.html
-rw-rw-r-- 1 root root 261497 Sep 30 14:21 README.txt
Unter Windows heißt die ausführbare Datei
rclone.exe
In diesem Beispiel arbeite ich als User root. Der große Vorteil dieser einfachen Installation aus dem Archiv ist aber, dass dies jeder Benutzer ohne Administrator-Berechtigung in seinem eigenen Bereich durchführen kann.
Als User root kann ich rclone allgemein verfügbar machen und auch die man-Page einrichten:
cd rclone-v1.38-linux-amd64/
cp rclone /usr/bin/
chmod 0755 /usr/bin/rclone
mkdir -p /usr/local/share/man/man1
cp rclone.1 /usr/local/share/man/man1/
mandb
Konfiguration
rclone unterscheidet zwischen lokalem Speicher, z.B. Verzeichnis /tmp und sogenannten remotes. Die remotes sind Verbindungen zu einem Object Storage, FTP-Server etc.
Die remotes können über das Kommando rclone config interaktiv eingerichtet werden.
Object Storage von IONOS ist zwar nicht in der Liste der unterstützten Storages aufgeführt, lässt sich aber problemlos als remote einrichten (verkürzt wiedergegeben):
root@debian:~# rclone config
Current remotes:
Name Type
==== ====
e) Edit existing remote
n) New remote
d) Delete remote
[.. cut ..]
e/n/d/r/c/s/q> n
name> PB-S3
Type of storage to configure.
Choose a number from below, or type in your own value
1 / Amazon Drive
\ "amazon cloud drive"
2 / Amazon S3 (also Dreamhost, Ceph, Minio)
\ "s3"
[.. cut ..]
Storage> 2
Get AWS credentials from runtime (environment variables or EC2 meta data if no env vars). Only applies if access_key_id and secret_access_key is blank.
Choose a number from below, or type in your own value
1 / Enter AWS credentials in the next step
\ "false"
[.. cut ..]
env_auth> 1
AWS Access Key ID - leave blank for anonymous access or runtime credentials.
access_key_id> *****
AWS Secret Access Key (password) - leave blank for anonymous access or runtime credentials.
secret_access_key> *****
Region to connect to.
Choose a number from below, or type in your own value
/ The default endpoint - a good choice if you are unsure.
1 | US Region, Northern Virginia or Pacific Northwest.
| Leave location constraint empty.
\ "us-east-1"
[.. cut ..]
region> 1
Endpoint for S3 API.
Leave blank if using AWS to use the default endpoint for the region.
Specify if using an S3 clone such as Ceph.
endpoint> https://s3-de-central.profitbricks.com
Location constraint - must be set to match the Region. Used when creating buckets only.
Choose a number from below, or type in your own value
1 / Empty for US Region, Northern Virginia or Pacific Northwest.
\ ""
[.. cut ..]
location_constraint> 1
Canned ACL used when creating buckets and/or storing objects in S3.
For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
Choose a number from below, or type in your own value
1 / Owner gets FULL_CONTROL. No one else has access rights (default).
\ "private"
[.. cut ..]
acl> 1
The server-side encryption algorithm used when storing this object in S3.
Choose a number from below, or type in your own value
1 / None
\ ""
[.. cut ..]
server_side_encryption> 1
The storage class to use when storing objects in S3.
Choose a number from below, or type in your own value
1 / Default
\ ""
[.. cut ..]
storage_class> 1
Remote config
--------------------
[PB-S3]
env_auth = false
access_key_id = *****
secret_access_key = *****
region = us-east-1
endpoint = https://s3-de-central.profitbricks.com:443
location_constraint =
acl = private
server_side_encryption =
storage_class =
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
PB-S3 s3
[.. cut ..]
q) Quit config
e/n/d/r/c/s/q> q
Die Konfigurationsdaten werden im Home-Verzeichnis des Users in
./config/rclone/rclone.conf
gespeichert. Diese kann auch mit einem Texteditor bearbeitet werden, um remotes zu ändern oder hinzuzufügen.
Achtung: Die Zugangsdaten werden darin standardmäßig im Klartext hinterlegt. Die Konfigurationsdatei kann aber bei Bedarf auch über rclone config verschlüsselt werden – auch zur Datenmigration unbedingt anzuraten.
Lokaler Speicher muss nicht konfiguriert werden, kann aber genauso wie remotes genutzt werden.
Erste Schritte der Datenmigration
rclone bietet verschiedene Kommandos zum Auflisten:
root@debian:~# rclone lsd /tmp
-1 2018-01-17 12:25:23 -1 .ICE-unix
-1 2018-01-17 12:25:23 -1 .Test-unix
-1 2018-01-17 12:25:23 -1 .X11-unix
-1 2018-01-17 12:25:23 -1 .XIM-unix
-1 2018-01-17 12:25:23 -1 .font-unix
Listet nur die Verzeichnisse im lokalen Verzeichnis
/tmp (-1
steht hier für nicht angegebene Daten wie die Größe).
root@debian:~# rclone lsl /tmp
0 2018-03-27 08:51:53.360000000 touch-me
Listet nur die Dateien im lokalen Verzeichnis /tmp (hier mit modification time).
Zu beachten: Das Kommando lsl wird standardmäßig rekursiv ausgeführt. Dies kann über die Option
--max-depth
angepasst werden.
Das gleiche kann ich auch für meinen Object Storage, das remote PB-S3, durchführen:
root@debian:~# rclone lsd PB-S3:
-1 2017-12-14 23:58:07 -1 air-clown-01
-1 2017-12-08 10:15:02 -1 arno-rulez
-1 2017-12-15 13:14:22 -1 arnologs
Listet nur die Buckets im remote PB-S3 (-1 steht hier für nicht angegebene Daten wie die Größe).
Zu beachten: Nach dem remote-Namen muss ein Doppelpunkt (:) stehen.
PB-S3 verweist auf meinen Object Storage. In diesem sind keine Objekte direkt abgelegt. Daher muss zum Auflisten von Objekten auch ein Bucket angegeben werden.
root@debian:~# rclone lsl PB-S3:air-clown-01
39728 2017-12-19 09:48:51.000000000 agetty
[.. cut ..]
87728 2017-12-19 09:48:52.000000000 xtables-multi
Ich kann nun einfach ein neues Bucket anlegen:
root@debian:~# rclone mkdir PB-S3:rclone
root@debian:~# rclone lsd PB-S3:
-1 2017-12-14 23:58:07 -1 air-clown-01
-1 2017-12-08 10:15:02 -1 arno-rulez
-1 2017-12-15 13:14:22 -1 arnologs
-1 2018-03-27 10:21:51 -1 rclone
Das Kopieren von Dateien bzw. Objekten ist ebenso einfach:
root@debian:~# rclone copy /tmp/touch-me PB-S3:rclone
root@debian:~# rclone lsl PB-S3:rclone
0 2018-03-27 10:29:40.000000000 touch-me
Kopiert die lokale Datei
touch-me
in das Bucket
rclone
Und in die andere Richtung:
root@debian:~# rclone copy PB-S3:rclone/touch-me ./
root@debian:~# ls -la
total 5660
drwx------ 8 root root 4096 Mar 27 10:37 .
drwxr-xr-x 22 root root 4096 Dec 1 02:31 ..
-rw------- 1 root root 8764 Mar 26 17:11 .bash_history
-rw-r--r-- 1 root root 570 Jan 31 2010 .bashrc
drwx------ 2 root root 4096 Jan 16 09:30 .ssh
-rw-r--r-- 1 root root 0 Mar 27 10:29 touch-me
-rw------- 1 root root 104 Dec 20 21:25 .Xauthority
Zu beachten: Wenn ein Verzeichnis als Quelle angegeben ist, kopiert rclone den Inhalt des Verzeichnisses, aber nicht das Verzeichnis selbst.
Logging
Über die Option -v kann man die Ausführung von rclone detaillierter protokollieren (INFO). Mehrfache Angabe der Option erhöht den Ausgabe-Umfang (DEBUG).
Erneutes Kopieren der Datei touch-me:
root@debian:~# rclone copy /tmp/touch-me PB-S3:rclone -vv
2018/03/27 11:04:27 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2018/03/27 11:04:27 DEBUG : rclone: Version "v1.38" starting with parameters ["rclone" "copy" "/tmp/touch-me" "PB-S3:rclone" "-vv"]
2018/03/27 11:04:27 INFO : S3 bucket rclone: Modify window is 1ns
2018/03/27 11:04:27 DEBUG : .ICE-unix: Excluded from sync (and deletion)
2018/03/27 11:04:27 DEBUG : .font-unix: Excluded from sync (and deletion)
2018/03/27 11:04:27 DEBUG : .XIM-unix: Excluded from sync (and deletion)
2018/03/27 11:04:27 DEBUG : .Test-unix: Excluded from sync (and deletion)
2018/03/27 11:04:27 DEBUG : .X11-unix: Excluded from sync (and deletion)
2018/03/27 11:04:28 INFO : S3 bucket rclone: Waiting for checks to finish
2018/03/27 11:04:28 DEBUG : touch-me: Modification times differ by 1h37m46.64s: 2018-03-27 08:51:53.36 +0000 UTC, 2018-03-27 10:29:40 +0000 UTC
2018/03/27 11:04:28 INFO : touch-me: Updated modification time in destination
2018/03/27 11:04:28 DEBUG : touch-me: Unchanged skipping
2018/03/27 11:04:28 INFO : S3 bucket rclone: Waiting for transfers to finish
2018/03/27 11:04:28 INFO :
Transferred: 0 Bytes (0 Bytes/s)
Errors: 0
Checks: 1
Transferred: 0
Elapsed time: 300ms
2018/03/27 11:04:28 DEBUG : Go routines at exit 2
2018/03/27 11:04:28 DEBUG : rclone: Version "v1.38" finishing with parameters ["rclone" "copy" "/tmp/touch-me" "PB-S3:rclone" "-vv"]
In den hervorgehobenen Zeilen ist zu erkennen, dass zwar die modification time des Objektes geändert wurde, die Datei selbst aber nicht mehr kopiert wurde.
Nun ändere ich die Datei und kopiere erneut:
root@debian:~# echo huhu > /tmp/touch-me
root@debian:~# rclone copy /tmp/touch-me PB-S3:rclone -vv
2018/03/27 11:06:14 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2018/03/27 11:06:14 DEBUG : rclone: Version "v1.38" starting with parameters ["rclone" "copy" "/tmp/touch-me" "PB-S3:rclone" "-vv"]
2018/03/27 11:06:14 INFO : S3 bucket rclone: Modify window is 1ns
2018/03/27 11:06:14 DEBUG : .ICE-unix: Excluded from sync (and deletion)
2018/03/27 11:06:14 DEBUG : .font-unix: Excluded from sync (and deletion)
2018/03/27 11:06:14 DEBUG : .XIM-unix: Excluded from sync (and deletion)
2018/03/27 11:06:14 DEBUG : .Test-unix: Excluded from sync (and deletion)
2018/03/27 11:06:14 DEBUG : .X11-unix: Excluded from sync (and deletion)
2018/03/27 11:06:14 DEBUG : touch-me: Sizes differ (src 5 vs dst 0)
2018/03/27 11:06:14 INFO : S3 bucket rclone: Waiting for checks to finish
2018/03/27 11:06:14 INFO : S3 bucket rclone: Waiting for transfers to finish
2018/03/27 11:06:15 INFO : touch-me: Copied (replaced existing)
2018/03/27 11:06:15 INFO :
Transferred: 5 Bytes (4 Bytes/s)
Errors: 0
Checks: 1
Transferred: 1
Elapsed time: 1.2s
2018/03/27 11:06:15 DEBUG : Go routines at exit 4
2018/03/27 11:06:15 DEBUG : rclone: Version "v1.38" finishing with parameters ["rclone" "copy" "/tmp/touch-me" "PB-S3:rclone" "-vv"]
Jetzt wurde die geänderte Datei auch in das Bucket kopiert.
Über die Option
--log-file
kann die Ausgabe auch in eine Datei geschrieben werden.
Synchronisierung
Das vielleicht wichtigste Kommando von rclone im Zuge der Datenmigration ist sync. Hiermit wird das Ziel (Bucket oder lokaler Storage) mit der Quelle abgeglichen. Dateien werden kopiert, geändert oder auch gelöscht.
Bei der Synchronisierung werden standardmäßig Größe und modification time der Objekte verglichen. Sind diese identisch, findet kein Transfer des Objektes statt.
Synchronisierung eines lokalen Verzeichnisses zum Object Storage von IONOS:
root@debian:~# rclone sync upload/ PB-S3:rclone/syncdir -vv --log-file sync-log_2018-03-27.log
root@debian:~# less sync-log_2018-03-27.log
2018/03/27 15:48:22 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2018/03/27 15:48:22 DEBUG : rclone: Version "v1.38" starting with parameters ["rclone" "sync" "upload/" "PB-S3:rclone/syncdir" "-vv" "--log-file" "sync-log_2018-03-27.log"]
2018/03/27 15:48:22 INFO : S3 bucket rclone path syncdir/: Modify window is 1ns
2018/03/27 15:48:23 INFO : agetty: Copied (new)
2018/03/27 15:48:23 INFO : blkid: Copied (new)
[.. cut ..]
2018/03/27 15:48:55 INFO : usr.tar: Copied (new)
2018/03/27 15:48:55 INFO : Waiting for deletions to finish
2018/03/27 15:48:55 INFO :
Transferred: 668.810 MBytes (20.308 MBytes/s)
Errors: 0
Checks: 0
Transferred: 120
Elapsed time: 32.9s
Wenn wir nun einige Dateien im lokalen Verzeichnis löschen oder ändern, werden diese beim nächsten
sync
auf unserem Ziel, dem Object Storage, aktualisiert.
Da dies auch zum Löschen von Objekten führen kann, empfiehlt sich mit der Option
--dry-run
zunächst einen Testlauf zu starten.
root@debian:~# rclone sync upload/ PB-S3:rclone/syncdir --dry-run
2018/03/27 16:05:15 NOTICE: agetty: Not copying as --dry-run
2018/03/27 16:05:15 NOTICE: cfdisk: Not updating modification time as --dry-run
[.. cut ..]
2018/03/27 16:05:15 NOTICE: usr.tar: Not deleting as --dry-run
2018/03/27 16:05:15 NOTICE: var.tar: Not deleting as --dry-run
Nach Kontrolle der geplanten Änderungen, wird die Synchonisierung durchgeführt:
root@debian:~# rclone sync upload/ PB-S3:rclone/syncdir -vv --log-file sync-log_2018-03-27.log
2018/03/27 16:09:42 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2018/03/27 16:09:42 DEBUG : rclone: Version "v1.38" starting with parameters ["rclone" "sync" "upload/" "PB-S3:rclone/syncdir" "-vv" "--log-file" "sync-log_2018-03-27.log"]
2018/03/27 16:09:42 INFO : S3 bucket rclone path syncdir/: Modify window is 1ns
2018/03/27 16:09:42 DEBUG : agetty: Sizes differ (src 27144 vs dst 39728)
2018/03/27 16:09:42 DEBUG : chcpu: Modification times differ by 2447h0m55.052s: 2017-12-15 16:42:29.948 +0000 UTC, 2018-03-27 15:43:25 +0000 UTC
2018/03/27 16:09:42 INFO : chcpu: Updated modification time in destination
2018/03/27 16:09:42 DEBUG : chcpu: Unchanged skipping
[.. cut ..]
2018/03/27 16:09:43 DEBUG : xtables-multi: Sizes differ (src 39728 vs dst 87728)
2018/03/27 16:09:43 INFO : xtables-multi: Copied (replaced existing)
2018/03/27 16:09:43 INFO : Waiting for deletions to finish
2018/03/27 16:09:43 INFO : lib.tar: Deleted
2018/03/27 16:09:43 INFO : usr.tar: Deleted
2018/03/27 16:09:43 INFO : var.tar: Deleted
2018/03/27 16:09:43 INFO :
Transferred: 65.305 kBytes (71.052 kBytes/s)
Errors: 0
Checks: 120
Transferred: 2
Elapsed time: 900ms
Zu beachten: Aus Sicht des Object Storage ist bei der Datenmigration die modification time der Zeitpunkt des Erstellens des Objektes. Daher wird bei einer Synchronisierung vom Object Storage zurück zum lokalen Storage auch dort die modification time neu gesetzt.
Migration von Amazon zu IONOS
Die Möglichkeiten von rclone beschränken sich nicht auf das Kopieren von und zu lokalem Storage. Ebenso einfach können Daten auch zwischen zwei remotes verschoben werden.
Im folgenden Beispiel werde ich meine Daten aus einem Amazon S3 Storage zu S3 Storage von IONOS migrieren.
Hierzu wird das remote von Amazon S3 konfiguriert:
root@debian:~# rclone config
[.. cut ..]
n) New remote
[.. cut ..]
e/n/d/r/c/s/q> n
name> AWS-S3
[.. cut ..]
2 / Amazon S3 (also Dreamhost, Ceph, Minio)
\ "s3"
[.. cut ..]
Storage> 2
[.. cut ..]
1 / Enter AWS credentials in the next step
\ "false"
[.. cut ..]
env_auth> 1
AWS Access Key ID - leave blank for anonymous access or runtime credentials.
access_key_id> *****
AWS Secret Access Key (password) - leave blank for anonymous access or runtime credentials.
secret_access_key> *****
Region to connect to.
[.. cut ..]
/ EU (Frankfurt) Region
8 | Needs location constraint eu-central-1.
\ "eu-central-1"
[.. cut ..]
region> 8
Endpoint for S3 API.
[.. cut ..]
endpoint>
[.. cut ..]
1 / Empty for US Region, Northern Virginia or Pacific Northwest.
\ ""
[.. cut ..]
location_constraint> 1
Canned ACL used when creating buckets and/or storing objects in S3.
[.. cut ..]
/ Both the object owner and the bucket owner get FULL_CONTROL over the object.
6 | If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
\ "bucket-owner-full-control"
acl> 6
The server-side encryption algorithm used when storing this object in S3.
[.. cut ..]
1 / None
\ ""
[.. cut ..]
server_side_encryption> 1
The storage class to use when storing objects in S3.
[.. cut ..]
1 / Default
\ ""
[.. cut ..]
storage_class> 1
Remote config
--------------------
[AWS-S3]
env_auth = false
access_key_id = *****
secret_access_key = *****
region = eu-central-1
endpoint =
location_constraint =
acl = bucket-owner-full-control
server_side_encryption =
storage_class =
--------------------
Test:
root@debian:~# rclone lsd AWS-S3:
-1 2018-03-29 12:29:09 -1 monty-on-the-run
Bei Amazon liegen meine Daten im Bucket monty-on-the-run. Dieses habe ich auch im S3 von IONOS neu angelegt und das Logging aktiviert.
Nun werden alle Daten im Rahmen der Datenmigration dorthin verschoben:
root@debian:~# rclone move AWS-S3:monty-on-the-run PB-S3:rclone/monty-on-the-run -vv --log-file aws-upload_2018-02-29.log
2018/03/29 18:50:49 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2018/03/29 18:50:49 DEBUG : rclone: Version "v1.38" starting with parameters ["rclone" "move" "AWS-S3:monty-on-the-run" "PB-S3:rclone/monty-on-the-run" "-vv" "--log-file" "aws-upload_2018-02-29.log"]
2018/03/29 18:50:49 INFO : S3 bucket rclone path monty-on-the-run/: Modify window is 1ns
2018/03/29 18:50:50 INFO : agetty: Copied (new)
2018/03/29 18:50:50 INFO : blkid: Copied (new)
2018/03/29 18:50:50 INFO : agetty: Deleted
2018/03/29 18:50:50 INFO : blkid: Deleted
[.. cut ..]
2018/03/29 18:51:29 INFO : clearos-community-6.7.0-x86_64-DVD.iso: Copied (new)
2018/03/29 18:51:29 INFO : clearos-community-6.7.0-x86_64-DVD.iso: Deleted
2018/03/29 18:51:29 INFO :
Transferred: 1.335 GBytes (34.163 MBytes/s)
Errors: 0
Checks: 122
Transferred: 122
Elapsed time: 40s
2018/03/29 18:51:29 DEBUG : Go routines at exit 21
2018/03/29 18:51:29 DEBUG : rclone: Version "v1.38" finishing with parameters ["rclone" "move" "AWS-S3:monty-on-the-run" "PB-S3:rclone/monty-on-the-run" "-vv" "--log-file" "aws-upload_2018-02-29.log"]
Das Verschieben ist hier mit einem einzigen Aufruf von rclone erfolgt. Bei den beiden unterschiedlichen remotes kann zwar kein direktes Server-seitiges Kopieren (‘server side copy’) durchgeführt werden, aber die Daten wurden für den Transfer nur temporär über meinen Server geleitet ohne sie dauerhaft zu speichern. Zu sehen ist auch, dass die Daten erst kopiert und dann auf Amazon gelöscht wurden.
Wenn man sich auf S3 von IONOS die Logfiles für PB-S3 anschaut, sieht man wie rclone große Dateien als Multipart-Upload transferiert und dass mehrere Transfers parallel durchgeführt werden. Datenmigration in Anwendung.
Eine kurze Statistik der Migration:
~ 120 Dateien, 1,335 GB in 40 Sekunden transferiert (~ 34,16 MB/s)
AWS: 1,335 GB outgoing Traffic, ~ 120 DELETE requests, ~ 245 HEAD/GET Requests
PB: 1,335 GB incoming Traffic , ~ 400 PUT requests, ~125 HEAD/GET Requests
Da geht noch mehr
Neben dem Transfer zu lokalem oder Object Storage kann man rclone noch für weitere Anwendungsfälle der Datenmigration einsetzen.
HTTP
Beispielhaft Download eines ISO-images (ClearOS von einem Mirror).
An welcher Stelle man die Grenze zwischen Remote und Verzeichnissen zieht, hängt vom Einzelfall und dem eigenen Präferenzen ab.
Neues remote:
[ClearOS-mirror]
type = http
url = http://mirror1-frankfurt.clearos.com/clearos
Test:
root@debian:~# rclone lsl ClearOS-mirror:community/6/iso/x86_64/
731906048 2016-04-29 19:18:52.000000000 clearos-community-6.7.0-x86_64-DVD.iso
73 2016-04-29 19:19:19.000000000 clearos-community-6.7.0-x86_64-DVD.iso.md5sum
81 2016-04-29 19:19:34.000000000 clearos-community-6.7.0-x86_64-DVD.iso.sha1sum
731906048 2016-04-29 19:18:52.000000000 clearos-community-x86_64-DVD.iso
Download:
root@debian:~# rclone copy ClearOS-mirror:community/6/iso/x86_64/clearos-community-6.7.0-x86_64-DVD.iso http2sftp/
root@debian:~# echo $?
0
root@debian:~# ls -l http2sftp/
total 714760
-rw-r--r-- 1 root root 731906048 Apr 29 2016 clearos-community-6.7.0-x86_64-DVD.iso
Direkte (Server-seitige) Transfers zu einem anderen Ziel sind dabei nicht möglich.
FTP
Beispiel Upload eines ISO-images zum PB-FTP.
Remote hinzufügen:
root@debian:~# rclone config
n) New remote
name> PB-FTP-fra
Type of storage to configure.
[.. cut ..]
7 / FTP Connection
\ "ftp"
[.. cut ..]
Storage> 7
host> ftp-fra.profitbricks.com
user> ***@profitbricks.com
FTP port, leave blank to use default (21)
port>
FTP password
y) Yes type in my own password
g) Generate random password
y/g> y
Enter the password:
password:*****
[PB-FTP-fra]
type = ftp
host = ftp-fra.profitbricks.com
user = juergen.buchhammer@profitbricks.com
port =
pass = *****
Das Passwort wird verschlüsselt gespeichert.
ISO-Image hochladen:
root@debian:~# rclone copy http2sftp/clearos-community-6.7.0-x86_64-DVD.iso PB-FTP-fra:iso-images/
Upload-Verzeichnis listen:
root@debian:~# rclone lsl PB-FTP-fra:iso-images/
0 2017-12-17 04:00:11.000000000 ClearOS7.3-DVD-x86_64.iso
731906048 2017-12-20 21:47:53.000000000 clearos-community-6.7.0-x86_64-DVD.iso
Ich hätte das ganze natürlich auch kürzer umsetzen können, indem ich direkt den Download (remote HTTP) mit dem Upload (remote FTP) in einem einzigen copy-Befehl ausführe.
SSH/SFTP
Kopieren zwischen zwei VMs mit SSH/SFTP.
Zu beachten: Nicht mit FTP über SSH oder Simple FTP verwechseln (s. voriges Beispiel).
Source-VM: rclone-ffm (81.***)
Destination-VM: rclone-fkb (78.***)
Remote mit Authentifizierung über SSH-Key-File anlegen:
root@debian:~# rclone config
[.. cut ..]
n) New remote
[.. cut ..]
name> VM-rclone-fkb
Type of storage to configure.
[.. cut ..]
16 / SSH/SFTP Connection
\ "sftp"
[.. cut ..]
Storage> 16
SSH host to connect to
[.. cut ..]
host> 78.***
SSH username, leave blank for current username, root
user>
SSH port, leave blank to use default (22)
port>
SSH password, leave blank to use ssh-agent.
[.. cut ..]
n) No leave this optional password blank
y/g/n> n
Path to unencrypted PEM-encoded private key file, leave blank to use ssh-agent.
key_file> /root/.ssh/id_rsa
Remote config
--------------------
[VM-rclone-fkb]
host = 78.***
user =
port =
pass =
key_file = /root/.ssh/id_rsa
Test listing:
root@debian:~# rclone lsd VM-rclone-fkb:
-1 2017-12-15 17:38:25 -1 .config
-1 2018-01-16 09:30:05 -1 .ssh
-1 2017-12-15 17:48:11 -1 download
-1 2017-09-30 14:23:08 -1 rclone-v1.38-linux-amd64
-1 2017-12-15 17:53:06 -1 upload
Dateien kopieren:
root@debian:~# rclone -vv copy http2sftp VM-rclone-fkb:http2sftp
2018/01/16 10:50:19 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2018/01/16 10:50:19 DEBUG : rclone: Version "v1.38" starting with parameters ["rclone" "-vv" "copy" "http2sftp" "VM-rclone-fkb:http2sftp"]
2018/01/16 10:50:20 INFO : sftp://root@78.***:22/http2sftp: Modify window is 1s
2018/01/16 10:50:20 INFO : sftp://root@78.***:22/http2sftp: Waiting for checks to finish
2018/01/16 10:50:20 INFO : sftp://root@78.***:22/http2sftp: Waiting for transfers to finish
2018/01/16 10:50:20 INFO : readme-ssh: Copied (new)
2018/01/16 10:50:37 INFO : clearos-community-6.7.0-x86_64-DVD.iso: Copied (new)
2018/01/16 10:50:37 INFO :
Transferred: 698 MBytes (39.978 MBytes/s)
Errors: 0
Checks: 0
Transferred: 2
Elapsed time: 17.4s
2018/01/16 10:50:37 DEBUG : Go routines at exit 24
2018/01/16 10:50:37 DEBUG : rclone: Version "v1.38" finishing with parameters ["rclone" "-vv" "copy" "http2sftp" "VM-rclone-fkb:http2sftp"]
root@debian:~# rclone lsl VM-rclone-fkb:http2sftp
731906048 2016-04-29 19:18:52.000000000 clearos-community-6.7.0-x86_64-DVD.iso
0 2018-01-16 10:22:36.000000000 readme-ssh
Und zum Abschluss möchte ich noch einmal betonen: Unter Windows funktioniert die Datenmigration mit rclone ebenso einfach.