Migrating "nc-data" folder from C: to E:

Any help would be appreciated, first post! :slightly_frowning_face:

Hi everyone,

I’m having trouble migrating my Nextcloud data folder from my C drive to my external HDD, which has more space and is dedicated to backups. I’ve found plenty of tutorials for Linux, but being a “noobie” on Windows 11, I couldn’t figure out how to do it.

My current folder is C:\ncdata, and the new one should be on the external drive E:\NextCloud , but I’m not sure how to proceed. Any guidance would be appreciated!

Hello,

I’ve not yet worked with NC on windows, don’t know a lot about your install (AIO, containers, etc.) but…

Option 1:

You’ll want to stop the nextcloud services.

Check out your NCData settings in the config.php (located in the nextcloud-aio-container, etc.)and look for the NCData path and the datadirectory settings.

To move the NCData location you’ll want to use something that will fully copy (move) all of the data, permissions, etc. from C: to D:. RoboCopy is a good example.

robocopy C:\NCDATA D:\NCDATA /E /COPYALL /MOVE

You’ll want to update the config.php with the new path information.

Make sure all of the permission settings are the same.

You may need to check the database path settings -
SELECT * FROM oc_storages;
UPDATE oc_storages SET id=‘local::D:/NCData’ WHERE id=‘local::C:/NCData’;

Restart the system and check for errors.

Option 2 (Docker, AIO):

If you installed using AIO you can run through the process of re-running the installer script. Say your install is on Docker Desktop…

Stop nextcloud containers, relocate the NCDATA folder and all subfolders and files (robocopy), make sure the D:\NCDATA directory is accessible/shared to docker desktop, re-run the docker script (example below) then start nextcloud and look for errors.

After you copy the data from C: to D: always a good idea to at least rename the directory on the C and use it as a temp backup and then delete it once your changes are stable and you have a new backup process running.

docker run -it --rm -p 8080:8080 -p 8443:8443
-v nextcloud_aio_mastercontainer:/mnt/docker-aio-config -v //d/NCDATA:/mnt/ncdata
nextcloud/all-in-one:latest `
–data-dir /mnt/ncdata

1 Like

Hi @Atrealastra see https://github.com/nextcloud/all-in-one?tab=readme-ov-file#how-to-change-the-default-location-of-nextclouds-datadir

1 Like

Thank you guys, i ended up deleting all the Instances and re-installing using a new location.

Make sure to adjust /run/desktop/mnt/host/c/ncdata to your needings. This path is equivalent to C:\ncdata on your Windows host so you need to translate the path accordingly. Hint: the path that you enter needs to start with /run/desktop/mnt/host/ . Append to that the exact location on your windows host, e.g. c/ncdata which is equivalent to C:\ncdata .

I will share the code to uninstall AIO and re-installing it again in a batch file.

echo #Removing NC-DATA Folder

rmdir /s /q C:\ncdata

echo #Removing Containers

docker stop nextcloud-aio-apache
docker stop nextcloud-aio-notify-push
docker stop nextcloud-aio-nextcloud
docker stop nextcloud-aio-redis
docker stop nextcloud-aio-database
docker stop nextcloud-aio-domaincheck
docker stop nextcloud-aio-mastercontainer


docker rm nextcloud-aio-apache
docker rm nextcloud-aio-notify-push
docker rm nextcloud-aio-nextcloud
docker rm nextcloud-aio-redis
docker rm nextcloud-aio-database
docker rm nextcloud-aio-domaincheck
docker rm nextcloud-aio-mastercontainer


echo #Removing Volumes

docker volume rm nextcloud_aio_apache
docker volume rm nextcloud_aio_database
docker volume rm nextcloud_aio_database_dump
docker volume rm nextcloud_aio_mastercontainer
docker volume rm nextcloud_aio_nextcloud
docker volume rm nextcloud_aio_redis


echo #Removing Images

docker rmi nextcloud/aio-nextcloud 
docker rmi nextcloud/all-in-one 
docker rmi nextcloud/aio-postgresql
docker rmi nextcloud/aio-domaincheck  
docker rmi nextcloud/aio-redis 
docker rmi nextcloud/aio-apache
docker rmi nextcloud/aio-notify-push
echo #Installing NextCloud

docker run ^
--sig-proxy=false ^
--name nextcloud-aio-mastercontainer ^
--restart always ^
--publish 80:80 ^
--publish 8080:8080 ^
--publish 8443:8443 ^
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config ^
--volume //var/run/docker.sock:/var/run/docker.sock:ro ^
-e NEXTCLOUD_DATADIR="/run/desktop/mnt/host/e/ncdata" ^
nextcloud/all-in-one:latest

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