Clearing File History in Seafile

A series of articles on setting up file storage Seafile

  • Installing Seafile 7.1.0 + Nginx + Percona on Centos 7
  • Installing Seafile file storage on Centos 7
  • Transferring Seafile file storage with all data to another server
  • Clearing File History in Seafile

The Seafile service began to take up a lot of space on the server, after analysis it became clear that the settings included the option to store file history. Disable this option through the administrator account,

Управление системой - Настройки - Library

It is necessary to uncheck the box “library history – Allow user to keep library history”

Cleaning procedure

Checking how much space the user directories take

[[email protected]]# du -sh /home/seafile/seafile-data/storage/blocks/*
223M /home/seafile/seafile-data/storage/blocks/478f96e8-b9b6-4b81-a920-eb191b53c82a
93G /home/seafile/seafile-data/storage/blocks/64ed8e7e-ca6d-4f60-bddf-7f6a8ab6205f
1,8G /home/seafile/seafile-data/storage/blocks/6e23ee5a-da44-4633-8893-0d2ec6ac5f04
8,0K /home/seafile/seafile-data/storage/blocks/70892c64-1330-42f9-adae-c80c39d5da93
8,0K /home/seafile/seafile-data/storage/blocks/7ead4d2f-5548-4e74-aa63-fd6eb9dc3e51
168K /home/seafile/seafile-data/storage/blocks/99485677-daf2-4766-aa28-27353c5ab133
9,4G /home/seafile/seafile-data/storage/blocks/a84ee2db-1a1c-4811-acc1-35f771ff55dd
3,6G /home/seafile/seafile-data/storage/blocks/afb8315d-dcc9-415e-bbae-42ab13a06684
285M /home/seafile/seafile-data/storage/blocks/b26f305b-23cb-4753-90c3-fc45c946688a
877M /home/seafile/seafile-data/storage/blocks/b339f48e-7945-4ef0-b630-2e0ee2eb06eb
332M /home/seafile/seafile-data/storage/blocks/c605ae9f-8b27-4fd1-9f7c-f4f9363e6de0
302M /home/seafile/seafile-data/storage/blocks/c992c3a9-40b0-49e3-af0e-467ad39b717d
8,0K /home/seafile/seafile-data/storage/blocks/dd168831-208f-4d8e-beb0-39375f2287c8
124M /home/seafile/seafile-data/storage/blocks/e264d4ad-875f-4b0f-aa7d-63f853e862a7
39G /home/seafile/seafile-data/storage/blocks/f977530a-0975-46c8-825f-27461384271e
93G /home/seafile/seafile-data/storage/blocks/ff147da3-452b-493f-a0ca-167c52693fd3

where ff147da3-452b-493f-a0ca-167c52693fd3 – user id

As you can see, some users have 90 Gb each, although no more than 2 Gb is stored in the account itself

Log in as a user, go to “my library”, find the icon of the trash can and empty the trash. This procedure is performed with each user whose directory takes up a lot of space.

We stop the service, see what can be deleted from the user, clear

[[email protected]]# service seafile stop

[[email protected]]# cd /home/seafile/seafile-server-latest
[[email protected]]# ./seaf-gc.sh --dry-run a84ee2db-1a1c-4811-acc1-35f771ff55dd

[[email protected]]# ./seaf-gc.sh a84ee2db-1a1c-4811-acc1-35f771ff55dd

We repeat this procedure for each user.

Checking

[[email protected]]# du -sh /home/seafile/seafile-data/storage/blocks/*
223M /home/seafile/seafile-data/storage/blocks/478f96e8-b9b6-4b81-a920-eb191b53c82a
6,2G /home/seafile/seafile-data/storage/blocks/64ed8e7e-ca6d-4f60-bddf-7f6a8ab6205f
1,8G /home/seafile/seafile-data/storage/blocks/6e23ee5a-da44-4633-8893-0d2ec6ac5f04
8,0K /home/seafile/seafile-data/storage/blocks/70892c64-1330-42f9-adae-c80c39d5da93
8,0K /home/seafile/seafile-data/storage/blocks/7ead4d2f-5548-4e74-aa63-fd6eb9dc3e51
168K /home/seafile/seafile-data/storage/blocks/99485677-daf2-4766-aa28-27353c5ab133
518M /home/seafile/seafile-data/storage/blocks/a84ee2db-1a1c-4811-acc1-35f771ff55dd
3,6G /home/seafile/seafile-data/storage/blocks/afb8315d-dcc9-415e-bbae-42ab13a06684
285M /home/seafile/seafile-data/storage/blocks/b26f305b-23cb-4753-90c3-fc45c946688a
877M /home/seafile/seafile-data/storage/blocks/b339f48e-7945-4ef0-b630-2e0ee2eb06eb
332M /home/seafile/seafile-data/storage/blocks/c605ae9f-8b27-4fd1-9f7c-f4f9363e6de0
302M /home/seafile/seafile-data/storage/blocks/c992c3a9-40b0-49e3-af0e-467ad39b717d
8,0K /home/seafile/seafile-data/storage/blocks/dd168831-208f-4d8e-beb0-39375f2287c8
124M /home/seafile/seafile-data/storage/blocks/e264d4ad-875f-4b0f-aa7d-63f853e862a7
7,6G /home/seafile/seafile-data/storage/blocks/f977530a-0975-46c8-825f-27461384271e
1,8G /home/seafile/seafile-data/storage/blocks/ff147da3-452b-493f-a0ca-167c52693fd3

Apparently, we managed to free up a lot of space

Before Seafile cleaning

[[email protected]]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 438G 338G 79G 82% /

After cleaning Seafile

[[email protected]]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 438G 125G 292G 30% /

And don’t forget to start the service back

[[email protected]]# service seafile start
Sidebar