Define owncloud.db path before installation

The default installation in data/files,it contains owncloud.db and uses files.

For some reason ,I need define owncloud.db or uses files(not together) to a specific folder before OC installation,like to an external hard.

I tried symbolic link ,but no use after oc restart

thanks

I’m not clear about your description regarding the owncloud.db but I think what you are looking for is a system mounted folder that is linked to an external location. What comes to mind is using bindfs in /etc/fstab to mount a folder where you need it, giving it the property permissions when mounting.

What this would achieve is having the actual files in the external location, but providing access to those files via another location. Whatever activity happens in the mounted folder, alters the files in the external location.

Thanks for reply
actually OC is installed on my nas(build with 128G ssd).so I try define the data files of OC to my extra 8t hard disk. but I found the owncloud.db and owncloud.log is always runing.it cause 8t hard driver can’t be stoped runing(normal hard disk will be stop running after 30m).the owncloud log can be disabled.

I tried use symbolic link to solve it.it works.but after the 8t hard disk wake up again (OC restart).the owncloud.db will restore from 128G ssd to origin location (8t location)

Do you have to use SQLite3 as database? If you use MySQL/MariaDB or PostgreSQL the database will not be stored in the datafolder.
The location of owncloud.log can be set to a path outside the datafolder as well: Logging Configuration :: ownCloud Documentation

2 Likes

Thanks for your advise,I’ll try it

I just tested.using MySQL will solve my problem.but the sessions folde ( /files/sessions)has same problem like owncloud.db.

I did’t find any option in config.php to solve this.

This is actually defined via the php.ini configuration file. session.save_handler and session.save_path are the parameters defining how users’ sessions should be handled.

Some info from our official documentation: Configuration Notes and Tips :: ownCloud Documentation

@pako81 thanks

I’m a new on owncloud,Could you tell where is the php.ini location?

Have a good day !

php -i | grep 'php.ini' should give you the path of the configuration file.

@pako81 ,yes I find the details with your commend line
but I forgot to metion that I my owncloud is docker version
so is this still working?

root@NAS128-1:~# php -i | grep ‘php.ini’
Configuration File (php.ini) Path => /etc/php/7.3/cli
Loaded Configuration File => /etc/php/7.3/cli/php.ini
root@NAS128-1:~#

@pako81

hello,I do find the php.ini file now.but I really don’t know how to setup it

my current session folder location :/srv/dev-disk-by-uuid-7098fae7-4668-41c0-b598-9d8e53e600cc/own/sessions

Now I want set sessions folder to my nas system,like /root/sessions.

Here is the php.ini on my nas.you can edit it anytime,please help me ,thank you
https://ow.ssgaff.cn:9888/s/fzB6sUfVm27S1Ka

You would need to set session.save_handler to files and session.save_path to the path on your NAS.

yes.to nas
not to mounted disk dev-disk-by-uuid-7098fae7-4668-41c0-b598-9d8e53e600cc
but I don’t know how to change it in php.ini

thanks

@pako81
hello,I tried set session.save_path to one of following ,but nothing change on “/srv/dev-disk-by-uuid-058c230e-6790-478b-8248-4134436d3dda/files/sessions”,still got sess* files on my external hard disk of nas (omv),

session.save_path = “/srv/dev-disk-by-uuid-058c230e-6790-478b-8248-4134436d3dda/files/sessions”
session.save_path = “/var/lib/docker/volumes/”

here is the my owncloud configration

version: "3"

volumes:
  files:
    driver: local
  mysql:
    driver: local
  redis:
    driver: local

services:
  owncloud:
    image: owncloud/server:latest
    container_name: owncloud_server
    restart: always
    ports:
      - 8082:8080
    depends_on:
      - mariadb
      - redis
    environment:
      - OWNCLOUD_DOMAIN=localhost
      - OWNCLOUD_TRUSTED_DOMAINS=xx.com
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=owncloud
      - OWNCLOUD_DB_USERNAME=owncloud
      - OWNCLOUD_DB_PASSWORD=owncloud
      - OWNCLOUD_DB_HOST=mariadb
      - OWNCLOUD_ADMIN_USERNAME=admin
      - OWNCLOUD_ADMIN_PASSWORD=admin
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=redis
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
                - /srv/dev-disk-by-uuid-058c230e-6790-478b-8248-4134436d3dda/files:/mnt/data

  mariadb:
    image: mariadb:10.6 # minimum required ownCloud version is 10.9
    container_name: owncloud_mariadb
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=owncloud
      - MYSQL_USER=owncloud
      - MYSQL_PASSWORD=owncloud
      - MYSQL_DATABASE=owncloud
    command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
               - mysql:/var/lib/mysql

  redis:
    image: redis:6
    container_name: owncloud_redis
    restart: always
    command: ["--databases", "1"]
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
                - redis:/data


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.