Move some libraries to another server

I decided to split existing Seafile server to two ones, so I want to move some libraries with all history to another server. How this can be done? Manually editing SQLite database does not matter.

seafile-data/storage/{blocks,commits,fs} contains the actual data. In each of the three is a folder with your library data. These need to be copied to the same location on the target server.

In the database is one table containing the head commits for each library. Those that should be moved need to be inserted in the target servers DB and removed from old DB.

And then there needs to be something to connect libraries and users, don’t have that in my head.

Thank you, I will try and report here.

Ok, I am moving library now. I have checked seafile.db and I suggest that records should be inserted to the following tables:

Branch
Repo
RepoFileCount
RepoHead
RepoOwner
RepoSize

@shoeper, could you confirm filling these tables is sufficient? Can I skip some of them?

I have moved the library successfully, now I am syncing it and checking. I am still interested data from what tables is necessary for moving library.

@galvanopus Did you ever get this working? Do you have some more detailed steps? What exactly did you do to get the repo moved?

Yep, the library has been moved successfully. I have not recorded the exact steps. Do you still need help?

Hi,

i would be interested in having such explanations

Regards

@galvanopus Coud you explain how do you move the library successfully by detailed steps? Thank you!

I have moved seafile-data/storage/{blocks,commits,fs} to a new server, then I inserted records about the new libraries, Here is the sample batch file I was using:

copy /B "S:\seafile-server\seafile-data\seafile.db" "S:\seafile-server\seafile-data\seafile-copy.db"

sqlite3.exe -echo "S:\seafile-server\seafile-data\seafile-copy.db" "insert into Branch values('master', '90f60a66-0cb3-4dbd-a750-5bc25990a2a7', '78a45a53cccd6e811bf3c32f8e9ed83d1aee950a')"
sqlite3.exe -echo "S:\seafile-server\seafile-data\seafile-copy.db" "insert into Repo          values('90f60a66-0cb3-4dbd-a750-5bc25990a2a7')"
sqlite3.exe -echo "S:\seafile-server\seafile-data\seafile-copy.db" "insert into RepoFileCount values('90f60a66-0cb3-4dbd-a750-5bc25990a2a7', 11116)"
sqlite3.exe -echo "S:\seafile-server\seafile-data\seafile-copy.db" "insert into RepoHead      values('90f60a66-0cb3-4dbd-a750-5bc25990a2a7', 'master')"
sqlite3.exe -echo "S:\seafile-server\seafile-data\seafile-copy.db" "insert into RepoOwner     values('90f60a66-0cb3-4dbd-a750-5bc25990a2a7', 'sfadmin@example.com')"
sqlite3.exe -echo "S:\seafile-server\seafile-data\seafile-copy.db" "insert into RepoSize      values('90f60a66-0cb3-4dbd-a750-5bc25990a2a7', 1062080984591, '78a45a53cccd6e811bf3c32f8e9ed83d1aee950a')"

move "S:\seafile-server\seafile-data\seafile.db"      "S:\seafile-server\seafile-data\seafile.db.bak"
move "S:\seafile-server\seafile-data\seafile-copy.db" "S:\seafile-server\seafile-data\seafile.db"

NB! This has been done for Seafile 6.0.7 on Windows and might not be applicable to the latest version.

If you post your questions I’ll try to help as I am going to perform the move again in the future.

1 Like