You might want to copy files between two seafile servers / accounts or maybe from some other server to seafile. You could do it manually via seafile client / Web interface but I honestly prefer the command line for this. So here are the steps you need, assuming you are copying between to Seafile accounts or servers.
- Download library from first account
- Download library from second account
- rsync data
- Check consistency
Download library from first account
mkdir ~/seafile-upload/<:folder> seaf-cli sync -l <:library_id> -s https://... -d ~/seafile-upload/<:folder> -u email@example.com
<:folder> with correct data.
When syncing locally just for the sake of moving data from one SF server to a second one, don’t use crazy directory name like
Some Fancy FolderNäme (Foo Data) just name the directory however you like
Download library from second account
mkdir ~/seafile-upload/<:other_folder> seaf-cli sync -l <:other_library_id> -s https://... -d ~/seafile-upload/<:other_folder> -u firstname.lastname@example.org
Again, replace the placeholders.
Check if data is synced with
cristian@backup:~/seafile-upload/$ seaf-cli status # Name Status New_Library synchronized Old_Library synchronized
Run rsync in dry mode just to be sure everything is ok
$ cd ~/seafile-upload/New_Library $ rsync -avxp -n "~/seafile-upload/Old_Library" .
You also don’t have to sync the full library, it’s fine to just sync a file / folder. If everything looks fine, rerun the command without the dry mode (remove the
Check the progress with
seaf-cli status # Name Status Progress New_LIbrary uploading 1.0%, 1464.7KB/s
Once it shows the status is
synchronized you can continue
desync the library
It’s very important that you first desync the library before deleting anything otherwise it could sync the deletion of the files which means you are deleting files from your seafile server.
seaf-cli desync -d ~/seafile-upload/New_Library/ seaf-cli desync -d ~/seafile-upload/Old_Library/
NO data will be deleted on the desync. It just does not sync with seafile anymore which means it’s safe to remove the local copy, but continue reading before removing the data.
seaf-cli status it should return a blank list.
The rsync command just ensures that the files where synced locally, even if
seaf-cli status says everything was uploaded, it doesn’t hurt to double check.
Remove the New Library
remove the new library from local disk, but only the new library, not the old one just yet. After that sync the library again.
$ rm -rf ~/seafile-upload/New_Library/ $ mkdir ~/seafile-upload/New_Library $ seaf-cli sync -l <:other_library_id> -s https://... -d ~/seafile-upload/New_Library -u email@example.com
seaf-cli status that everything is synced again.
Compare data with rsync –checksum
$ cd ~/seafile-upload/New_Library $ rsync -avxp -n --checksum "~/seafile-upload/Old_Library" .
and check the output, it should contain only directories, but no files.
Now you can desync everything again and remove the local copy.