Guide: Change Data Storage Location for Nextcloud Docker Installation
This guide will help you change the data storage location for your Nextcloud Docker installation to different disk mounted as /mnt/tank/
Step 1: Stop the Nextcloud Container
- Use right click stop in Umbrel WebUI
Step 2: Create new partition and new data directory
- Install
xfsprogs
sudo apt update
sudo apt install xfsprogs
- Format and mount the partition as XFS:
sudo mkfs.xfs /dev/sdb1
sudo mount /dev/sdb1 /mnt/tank
- Create the new directory for Nextcloud data:
sudo mkdir -p /mnt/tank/nextcloud
- Set the correct permissions:
sudo chown -R www-data:www-data /mnt/tank/nextcloud
Step 3: Identify the Current Data Directory (start, run inspect, and stop again nextcloud)
- Inspect the Nextcloud container to find the current data directory:
docker inspect nextcloud_web_1
- Look for the Mounts section in the output. It will show the current source (host) and destination (container) paths for the data volume. For example:
"Mounts": [
{
"Type": "bind",
"Source": "/home/umbrel/umbrel/app-data/nextcloud/data/nextcloud",
"Destination": "/var/www/html",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
}
]
-
Source is the current data directory on the host (e.g.,
/home/umbrel/umbrel/app-data/nextcloud/data/nextcloud
). -
Destination is the mount point inside the container (e.g.,
/var/www/html
).
Step 4: Copy Existing Data to the New Location (This might take a while)
- Copy the existing Nextcloud data to the new location using rsync:
sudo rsync -av /home/umbrel/umbrel/app-data/nextcloud/data/nextcloud/ /mnt/tank/nextcloud/`
- Verify the data has been copied:
ls -la /mnt/tank/nextcloud
Step 5: Update the Docker Configuration
- Open the docker-compose.yml file:
sudo nano /home/umbrel/umbrel/app-data/nextcloud/docker-compose.yml
- Locate the volumes section for the web service and update it:
volumes:
- /mnt/tank/nextcloud:/var/www/html
- Save and exit the file.
Step 6: Restart the Nextcloud Container
- Use right click restart in Umbrel WebUI
Step 7: Verify the Changes
-
Log in to the Nextcloud web interface.
-
Verify that all files, folders, and apps are accessible.
-
Upload a new file and confirm it appears in
/mnt/tank/nextcloud/data/umbrel/files
.
Step 8: Clean Up the Old Data Directory (Optional)
- Delete the old data directory to free up space:
sudo rm -rf /home/umbrel/umbrel/app-data/nextcloud/data/nextcloud
Step 9: Ensure Persistent Mount After Reboot
- Find the UUID of /dev/sdb1:
sudo blkid /dev/sdb1
- Edit the /etc/fstab file:
sudo nano /etc/fstab
-
Add the following line to the end of the file:
UUID=<YOUR DISK UUID> /mnt/tank xfs defaults 0 2
example:UUID=1190bd87-aa96-4993-8413-1c1da928fc77 /mnt/tank xfs defaults 0 2
-
Save and exit the file.
Step 10: Final Verification
-
Reboot the system
-
After reboot, verify that
/dev/sdb1
is mounted to/mnt/tank
:
df -h /mnt/tank
- Check that Nextcloud is functioning correctly.
Troubleshooting
-
If the container fails to start, check the logs:
docker logs nextcloud_web_1
-
If the mount fails after reboot, verify the /etc/fstab entry and check for errors in the system logs:
journalctl -xe
-
If you update you need to do this again