# How to move storage to another drive with Docker Windows

**URL:** <https://help.nextcloud.com/t/how-to-move-storage-to-another-drive-with-docker-windows/205029>\
**Category:** ℹ️ Support\
**Tags:** docker, ncp, aio\
**Created:** [September 27, 2024, 5:05am UTC](https://help.nextcloud.com/t/how-to-move-storage-to-another-drive-with-docker-windows/205029 "2024-09-27T05:05:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krowyn](https://help.nextcloud.com/letter_avatar/krowyn/32/6_22734026db12803ebb3e059622ac3534.png) [@Krowyn](https://help.nextcloud.com/u/Krowyn)\
**Post date:** [September 27, 2024, 5:05am UTC](https://help.nextcloud.com/t/how-to-move-storage-to-another-drive-with-docker-windows/205029/1 "2024-09-27T05:05:31Z")

</div>

Sorry if there is an answer to this but all support, I found on this form is geared towards a Linux, I am running NextCloud AIO on Docker within Windows. I am new to this, so I wanted to use an OS I am familiar with

Right now, I have everything running on an SSD but I want to move all the files I am storing on a hard drive. How should I change it so NextCloud would point to the new HDD to store my files? I already have over 100GB of files, and I would prefer not to start this from scratch again.

I found some articles (linked below) but they give commands and examples which appear to be in Linux, but I’m using windows so I have no idea what the equivalent step would be

[Question about changing data DIR? · nextcloud/all-in-one · Discussion #890 · GitHub](https://github.com/nextcloud/all-in-one/discussions/890)

[Change data directory with Docker - ℹ Support / 📦 Appliances (Docker, Snappy, VM, NCP, AIO) - Nextcloud community](https://help.nextcloud.com/t/change-data-directory-with-docker/46408)

[Change Nextcloud data folder location - Support - NethServer Community](https://community.nethserver.org/t/change-nextcloud-data-folder-location/10879)

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [September 27, 2024, 8:35am UTC](https://help.nextcloud.com/t/how-to-move-storage-to-another-drive-with-docker-windows/205029/2 "2024-09-27T08:35:20Z")

</div>

Hi, this hint also applies to windows: [Question about changing data DIR? · nextcloud/all-in-one · Discussion #890 · GitHub](https://github.com/nextcloud/all-in-one/discussions/890#discussioncomment-3089903)

In general this should work:

> Another solution would be stopping all containers from the aio interface, creating a backup, removing and recreating the mastercontainer with `-e NEXTCLOUD_DATADIR="/run/desktop/mnt/host/c/ncdata"` then restore the most recent backup and afterwards starting the containers again from the aio interface. In that case you should then delete the content of /var/lib/docker/volumes/nextcloud\_aio\_nextcloud\_data/\_data/ manually since the data would be duplicated otherwise.

However of course you also need to adjust `NEXTCLOUD_DATADIR="/run/desktop/mnt/host/c/ncdata"` to the value that you want to use. See [https://github.com/nextcloud/all-in-one?tab=readme-ov-file#how-to-change-the-default-location-of-nextclouds-datadir](https://github.com/nextcloud/all-in-one?tab=readme-ov-file#how-to-change-the-default-location-of-nextclouds-datadir)

---

<div class="post-metadata">

**Author:** ![Krowyn](https://help.nextcloud.com/letter_avatar/krowyn/32/6_22734026db12803ebb3e059622ac3534.png) [@Krowyn](https://help.nextcloud.com/u/Krowyn)\
**Post date:** [September 28, 2024, 7:55pm UTC](https://help.nextcloud.com/t/how-to-move-storage-to-another-drive-with-docker-windows/205029/3 "2024-09-28T19:55:00Z")

</div>

Sorry I am new to this so I may need a step-by-step guide, where would I run the “-e NEXTCLOUD\_DATADIR=”/run/desktop/mnt/host/c/ncdata" " command? When i put it in cmd, I get an error saying “‘-e’ is not recognized as an internal or external command, operable program or batch file”

What I have done so far is copy the ncdata folder from my c drive to my new g drive so the new path I would imagine be " “NEXTCLOUD\_DATADIR=/run/desktop/mnt/host/g/ncdata”.

I would imagine I would need to remove the master container and create it again but update the path to the f drive from the c drive, but how would I update the path and rebuild the master container? also how would i back up the master container before removing it? Would removing and rebuilding the master container make me lose all my settings?

\*edit I forgot I had to download ubuntu LTS on windows to set this up, so I tried that as well and got a similar error, saying “-e: command not found”

 ![image](https://help.nextcloud.com/uploads/default/original/3X/0/7/077466441a4c09b6b7773f35774f904ca6a40d83.png)

 ![image](https://help.nextcloud.com/uploads/default/original/3X/4/5/452f26e56732b4b4bf2b4e302a67c8e8e408cd01.png)

\*edit 2: I think I finally figured out what I was supposed to do. Took way too long to realize. I made a backup, deleted master container and then ran this command in cmd (don’t forget to add the “^” at the end of your line for the new path. I spent too long trying to figure that out)

\*\*  
docker run ^  
–init ^  
–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/f/ncdata” ^  
nextcloud/all-in-one:latest  
\*\*

making sure to add the line you mentioned in the install run command to recreate the master container. It looks like its booting up now I hope this works

\*edit 3: everything looks great, thank you for the help.

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [December 27, 2024, 7:55pm UTC](https://help.nextcloud.com/t/how-to-move-storage-to-another-drive-with-docker-windows/205029/4 "2024-12-27T19:55:01Z")

</div>

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