This tutorial is licensed under CC-BY-SA - feel free to share and modify it (but keep information free)!
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
EXAMPLE:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
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
/mnt/YourMountingnameForExternalVolume
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:
/mnt/YourMountingnameForExternalVolume/seafile-data
Start the seafile server:
cd /path/to/seafile/directory/seafile-server-latest/
./seafile.sh start
./seahub.sh start-fastcgi
Please:
- report any bugs in this thread
- report if it works and if some sentences/comments are confusing (and why).
- ask all questions in this thread and not via PM (there are no stupid questions for me)