Tutorial for relocating seafile-data directory (optionally on an encrypted volume)

This tutorial is licensed under CC-BY-SA - feel free to share and modify it (but keep information free)!

:triangular_flag_on_post: This tutorial was originally written for the first Seafile forum of Seafile GmbH. Since the announcement to fork Seafile by Seafile GmbH I’ve decided to move my tutorials to the new Seafile forum of the original developers of Seafile (so this one).
This tutorial version is the maintained one.

Tutorial for relocating seafile-data directory (optionally on an encrypted volume)

(This tutorial is an add-on for Tutorial for Seafile CE + Nginx + dynamic DNS (on ARM / Cubietruck / RaspberryPi))

For the case you want to relocate the seafile-data directory on another
volume your have to do the following steps after you attached your
additional volume physically.

Optional: encrypt external disk

To encrypt the volume I used the program “gnome-disks” (apt-get install gnome-disk-utility)` on my client system (not the server):

Install rsync

Switch to root, install rsync and find your external volume:

sudo -s
apt-get update && apt-get install rsync


# lsblk
sda           8:0    0  2.7T  0 disk  
└─sda1        8:1    0  2.7T  0 part  
mmcblk0     179:0    0  3.7G  0 disk  
└─mmcblk0p1 179:1    0  3.7G  0 part  /

For the case you want to mount an encrypted volume within the partition
“sda1” we have to open the encrypted volume at first (this you have to
do after every server restart),
if you don’t want to use an encrypted volume go on with “Add the ext. volume to fstab”:

apt-get update && apt-get install cryptsetup
cryptsetup luksOpen /dev/sda1 YourMountingnameForExternalVolume

Add the ext. volume to fstab

In /etc/fstab add the line:

/dev/mapper/YourMountingnameForExternalVolume /mnt/YourMountingnameForExternalVolume ext4 defaults,users,noauto 0 0

Go on with:

mkdir /mnt/YourMountingnameForExternalVolume
mount /dev/mapper/YourMountingnameForExternalVolume

(you have to use mount /dev/mapper/YourMountingnameForExternalVolume to mount your volume after every server restart)

Now create a group setup so that seafile user and your standard user can access the external volume:

addgroup NameForUserGroupWhichWillHaveAccessToExternalVolume
adduser YourStandardSystemUser NameForUserGroupWhichWillHaveAccessToExternalVolume
adduser AllOtherUserYouWant NameForUserGroupWhichWillHaveAccessToExternalVolume

Accidently added users can be removed with deluser USERNAME GROUPNAME.
To confirm membership the command getent group GROUPNAME will list all users of the group “GROUPNAME”.

chown YourSeafileSystemUser:NameForUserGroupWhichWillHaveAccessToExternalVolume
chmod 770 /mnt/YourMountingnameForExternalVolume

Restart your server to activate new group memberships:

shutdown -r now

Set the new seafile-data directoy in Seafile

su - YourSeafileSystemUser -s /bin/bash
cd /path/to/seafile/directory/seafile-server-latest/
./seafile.sh stop
./seahub.sh stop
cd ..
rsync -avH seafile-data /mnt/YourMountingnameForExternalVolume/
mv seafile-data seafile-data_bkp
ln -s /path/to/new/seafile-data seafile-data
chown -R YourSeafileSystemUser:YourSeafileSystemUser /path/to/new/seafile-data

(not for me: to chown a symlink: chown -h username:groupname symlinkname)

In /path/to/seafile/directory/ccnet/seafile.ini change the seafile-data directory to:


Start the seafile server:

cd /path/to/seafile/directory/seafile-server-latest/
./seafile.sh start
./seahub.sh start-fastcgi


  1. report any bugs in this thread :bangbang:
  2. report if it works and if some sentences/comments are confusing (and why). :bangbang:
  3. ask all questions in this thread and not via PM (there are no stupid questions for me) :bangbang:
1 Like

This does not work:

->cp seafile-data /tmp/
cp: omitting directory ‘seafile-data’

You need to add the -r (== --recursive) parameter. I prefer to use:

mkdir /mnt/YourMountingnameForExternalVolume/seafile-data
rsync -av --progress seafile-data/ /mnt/YourMountingnameForExternalVolume/seafile-data/

1 Like

Thanks alot @germeier


But related to Seafile Community Forum shouldn’t it be rsync -avH?

Good point! I didn’t think about that. This is another reason not to use cp (and use rsync with -H !) as cp does not support hard links.

1 Like

Oh really?
I did the initial relocate of my seafile-data with cp. Any idea why this works in the end anyway?

Yes! :slight_smile:

Hard links are used for data deduplication (read: to safe disc space). If your program to copy the data does not support hard links you just duplicate the data thus use more disc space. My guess is that this does not trouble the seafile server in any way.

->find seafile-data/ | wc -l
->find seafile-data/ -links +1 | wc -l
->find seafile-data/ -links +1 -ls | awk ‘BEGIN {n=0} {n+=$7} END {printf “%d\n”, n}’

So in my case I would add around 760MB of data without preserving the hard links.


I see that ccnet/seafile.ini has been deprecated, is the tutorial still effective even if I do not write anywhere that the seafile-data directory has been replaced by a symlink?


I wrote the tutorial 6 years ago so I think it is okay to consider it as outdated. :wink:

Using a symlink and not adjusting paths in configs is totally okay as well (and maybe the more elegant way I was not aware of writing this tutorial).