To move an existing ownCloud data directory on Ubuntu, stop web access, put ownCloud in maintenance mode, copy the directory with rsync, verify ownership and the mounted destination, change the absolute datadirectory path in config/config.php, and test before allowing users back in. The procedure below is for a native Apache installation, not a Docker deployment.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What changes when you move ownCloud storage
ownCloud stores user files, application data and metadata beneath its data directory. Changing the path does not move the database or the ownCloud program files; it tells the existing installation to use a different filesystem location. The copy and the configuration change must therefore agree exactly.
As an Amazon Associate I earn from qualifying purchases.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
ownCloud’s installation documentation states: “It is best to configure your data directory location at installation, as it is difficult to move after installation.” Moving it is still possible, but treat the operation as a maintenance window. A failed copy, an unavailable mount or an incorrect owner can make every file appear missing even though the data still exists.
This guide assumes:
- Ubuntu with a classic, non-container ownCloud installation.
- Apache serving ownCloud and the Ubuntu HTTP account
www-data. - An old directory such as
/var/www/owncloud/dataand a new mounted location such as/mnt/owncloud/data.
Replace those examples with the paths on your server. Do not apply native Apache commands to an ownCloud container. Classic 11 Docker migrations have additional container, mount, scan and sometimes database steps.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Plan the move before stopping the server
Back up the parts you must be able to restore
Make a current backup of the ownCloud database and the ownCloud configuration, especially config/config.php. Keep the original data directory untouched until the new location has passed your tests. A copy is not a backup unless you can identify how to restore it.
Confirm capacity and the filesystem
Check that the destination has enough free space for the complete source tree and room for future growth. The copy must finish on the filesystem that will be mounted when Ubuntu boots; copying to an empty directory underneath a mount point while the disk is disconnected creates a deceptively successful but unusable migration.
For a local disk, verify that the filesystem is listed in the system’s boot-time mounts. For NFS or another network export, confirm that the network mount is available before Apache and ownCloud start. Mount reliability is part of ownCloud availability.
Choose storage for more than capacity
| Consideration | Local disk | NFS or NAS export |
|---|---|---|
| Latency | Usually predictable and low on the Ubuntu host. | Depends on the network, server load and export configuration; metadata-heavy operations can be slower. |
| Boot reliability | Available when the host and disk start correctly. | Requires networking, name resolution and a functioning export before Apache starts. |
| Ownership semantics | Linux ownership and permissions can normally be managed on the host. | UID/GID mapping and export policy control access; blindly running ownership changes while the export is unavailable can affect the wrong underlying directory. |
| Backups and snapshots | Use the host’s disk backup or snapshot method. | Coordinate snapshots and backups with the NAS or storage administrator. |
| Recovery | Depends on the host and disk recovery process. | Depends on both the Ubuntu host and the network storage service. |
Whatever you select, keep the data directory outside the webroot, reserve it for ownCloud, and ensure the web-server account can read and write it.
Native Ubuntu procedure
1. Stop requests that could change files
From a shell with administrative privileges, stop Apache:
sudo service apache2 stop
Stopping the web service prevents uploads, background web requests and other writes while the tree is copied. If another service, cron job or worker accesses the same ownCloud instance, stop or disable that access for the maintenance window as well.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →2. Enable ownCloud maintenance mode
Change to the ownCloud installation directory and run occ as the HTTP user. For the example installation:
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
cd /var/www/owncloud
sudo -u www-data php occ maintenance:mode --on
Maintenance mode prevents new logins and locks existing sessions. Running occ as www-data, rather than as root, keeps files generated by the command owned correctly. The command must be executed from the directory containing the installation’s occ file, or by using the equivalent path for your installation.
3. Copy the data directory with rsync
Copy the source directory into the destination’s parent directory:
sudo rsync -avz /var/www/owncloud/data /mnt/owncloud
With these example paths, rsync creates /mnt/owncloud/data. The trailing path components matter: copying to /mnt/owncloud/data instead would produce a different nesting if the source is specified incorrectly. Check the command before pressing Enter.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →The -a option preserves the directory tree and file attributes needed by ownCloud; -v displays the files being processed; and -z enables compression during transfer. Compression is harmless for a local copy but may add CPU work. Do not delete the original after this first pass.
4. Verify the copy before changing configuration
Inspect the destination and compare it with the source. At minimum, confirm that:
- The expected user directories and ownCloud-generated files are present.
- The destination is the mounted filesystem, not an ordinary directory on the root disk hidden by a missing mount.
www-dataowns the data or has the required read and write access.- Directory traversal and file permissions permit ownCloud to operate throughout the tree.
- No unrelated user, service or application can modify the data directory.
Do not apply a recursive ownership change to an NFS path without understanding its UID/GID mapping and export policy. If the mount is absent, a command aimed at the mount point can change the local directory underneath it instead.
5. Point ownCloud at the new absolute path
Edit the installation’s config/config.php and change the datadirectory entry to the complete destination path:
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
'datadirectory' => '/mnt/owncloud/data',
Use the real path on your server, including capitalization. Do not use a relative path, a shell variable or a path that exists only while a user’s session is active. Preserve the rest of the configuration file and its PHP syntax.
If your installed ownCloud version supports changing system settings through occ config:system, you may use that supported command instead of editing the file. Run it as www-data from the ownCloud directory and follow the syntax documented for that installed version; do not assume a command from a different major release.
6. Start Apache while maintenance mode remains on
Start Apache again:
sudo service apache2 start
Leave maintenance mode enabled while you validate the new path. Open ownCloud in a browser and confirm that the maintenance page appears rather than a PHP error, missing-data warning or permission failure. Inspect the web-server and ownCloud logs for path, ownership and database errors.
For a large migration, run the file scan required by the documentation for your installed ownCloud version after the move. A scan may be needed when the version’s migration procedure says that file-cache information must be rebuilt; do not substitute a scan command from a different deployment or release.
7. Disable maintenance mode and test normal use
When the destination is confirmed, disable maintenance mode as the web user:
sudo -u www-data php occ maintenance:mode --off
Log in as an administrator and test representative operations:
- Open files from several user accounts.
- Upload a new file and download it again.
- Rename and delete a test file.
- Create or access a share, if sharing is part of your installation.
- Check that scheduled background jobs run and do not report filesystem errors.
Keep the old directory until these checks, your next backup and your chosen rollback period are complete.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Mount and permission requirements
The mount must exist before ownCloud starts
A mounted disk or NFS export can be used as the data location, but Ubuntu must mount it before Apache and ownCloud access the path. Otherwise, ownCloud may see an empty local directory and report missing files, or a startup process may create new files on the wrong filesystem. Test a reboot or otherwise verify the boot ordering in a maintenance window before declaring the move complete.
Free tools Windows power users keep installed
One-click scans. No signup required.
www-data is the account that needs access
On Ubuntu’s Apache installation, www-data is the HTTP account used to execute occ and access the data directory. Every parent directory in the path must allow that account to traverse it, and the data tree must allow the reads and writes ownCloud performs.
Do not make the directory broadly writable as a shortcut. The data directory should be exclusive to ownCloud and outside the webroot, reducing the chance that another application or a web request can alter or expose user files.
NFS needs deliberate identity mapping
NFS access is governed by the export and by UID/GID behavior between the Ubuntu host and the NFS server. A directory that appears owned by www-data on one system may map differently on the other. If the export is unavailable, ownership commands can operate on the underlying local mount-point directory instead of the remote data. Confirm the export is mounted, verify the mapped identity, and coordinate permission changes with the storage administrator.
How to recognize and fix common failures
ownCloud says the data directory is missing
Check the exact datadirectory value in config/config.php, including spelling and capitalization. Then verify that the destination is mounted and that the directory actually contains the copied user data. If the mount is absent, stop Apache, mount the intended filesystem, and recheck before allowing access.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsUsers see permission or read-only errors
Inspect ownership and access on the data directory and every parent directory. The effective account is www-data, not the administrator account used to run the copy. On NFS, verify UID/GID mapping and export permissions rather than repeatedly running chown.
The destination contains an extra data directory
Review the source and destination arguments used with rsync. The documented example copies /var/www/owncloud/data to /mnt/owncloud, resulting in /mnt/owncloud/data. If you instead copied into a path already named data, inspect the resulting tree and set datadirectory to the directory that directly contains the user folders and ownCloud data files.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
The maintenance page does not appear
Confirm that Apache was restarted after the configuration change and that the command enabling maintenance mode ran against the same installation whose web files Apache serves. Check the Apache and ownCloud logs for PHP syntax errors, an incorrect installation directory or an unavailable mount.
Files are present on disk but not listed
First verify that the path and permissions are correct. If your ownCloud major version’s migration instructions require a file scan, run that version-appropriate scan while following its documented command context. Do not modify database tables or paste Docker-specific SQL into a native Ubuntu installation without confirming the deployment and schema.
Recommended Free Tools
Rollback if validation fails
- Enable maintenance mode with
sudo -u www-data php occ maintenance:mode --on. - Stop Apache with
sudo service apache2 stop. - Restore the previous
datadirectoryvalue inconfig/config.php. - Make sure the original data directory is still intact and accessible to
www-data. - Start Apache, leave maintenance mode on, and test the original location.
- Disable maintenance mode only after the original path works.
Because the original tree was retained, this rollback changes the pointer rather than attempting a second risky copy. If the database or configuration was damaged, use the backups made before the migration.
Native installation versus Docker
The Apache, service apache2, host-path and www-data sequence above applies to a classic installation. In a Docker deployment, the container has its own expected path and its own command context. The current ownCloud Classic 11 migration guidance adds container occ commands, remounting or copying data into the path visible inside the container, file scans and, in some scenarios, database path updates.
Identify the deployment before running anything. A Docker command copied into a native Ubuntu installation can target a nonexistent path or alter the wrong schema; a host command can appear successful while the container cannot see the host directory.
Operational checklist
- Database and configuration backups are restorable.
- The destination has sufficient capacity and is the intended mounted filesystem.
- Apache and other writers are stopped.
- Maintenance mode is enabled through the correct installation’s
occ. rsynccompleted without errors and the source tree remains available.- The destination is outside the webroot and reserved for ownCloud.
www-datacan traverse, read and write the complete path.- The absolute
datadirectoryvalue points to the copied directory. - Apache starts cleanly while maintenance mode is still enabled.
- Uploads, downloads, sharing and background jobs work after maintenance mode is disabled.
- The mount will be present before Apache and ownCloud after a reboot.
Frequently Asked Questions
Can I move /var/www/owncloud/data directly to /mnt/owncloud/data?
Yes, for a native installation, copy the directory with the services quiesced, verify access for www-data, and set datadirectory to the absolute destination. The example rsync command copies the source into /mnt/owncloud, creating /mnt/owncloud/data.
Should the old ownCloud data directory be deleted immediately?
No. Keep it until the new location has passed functional tests and your backup or rollback window has ended.
Does moving the data directory move the ownCloud database?
No. This procedure changes the filesystem location configured by datadirectory; it does not move the database or the ownCloud application files.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




