--- last_review: "2025-01-01" last_reviewer: "-" documented_code: [ ] --- ```{tags} how-to, administrator ``` # Manage the SQL database manually ## How to export the SQL database folder manually (e.g. for backup) # If it should ever be necessary to export the SQL database folder manually (for example for low-level backup, development or debugging), use these hints. The idea is: Mount the Docker volume with the database into a temporary container, then export it from there. ``` docker run --rm --mount "src=$(pwd),dst=/sql_export,type=bind" \ --mount "src=compose_caosdb-sqldata,dst=/sql,type=volume,ro" debian bash \ -c "tar -czf /sql_export/sql_data.tar.gz /sql/" ``` The data will be now inside `sql_data.tar.gz`. ## How to migrate the SQL database from a bind mount directory to a Docker volume # **Attention:** Be aware that you can delete Docker volumes with the Docker client (e.g. `docker volume prune` or `docker system prune --volumes`). Thus, be careful not to lose data when you use these commands. In order to migrate an SQL database from a directory that was mounted via bind mounts to a Docker volume, you simply need to populate the right volume with the existing data. In the following let us assume that the default project name is used (otherwise replace `compose` with the project name). - Note that if a volume named `compose_caosdb-sqldata` existed before, you should remove it first (`docker volume rm compose_caosdb-sqldata`). - Go to the parent folder of the sql data directory (typically `somepath/profile/paths`) and start a container which mounts the old sql data folder and a new volume with the correct name: ``` docker run --rm --mount "src=$(pwd)/sql_data,dst=/sql_data,type=bind,ro" \ --mount "src=compose_caosdb-sqldata,dst=/new,type=volume" debian bash \ -c "cp -a /sql_data/* /new" ``` You can now start LinkAhead using Docker volumes. Check that the migration from a plain directory to a Docker volume succeeded, then you can remove the old directory.