Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Move the ownCloud Data Directory on Ubuntu Safely

Move an existing ownCloud data directory on Ubuntu safely: stop Apache, copy with rsync, verify the mount and www-data access, update datadirectory, validate, and roll back if needed.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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/data and 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
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Enable ownCloud maintenance mode

Change to the ownCloud installation directory and run occ as the HTTP user. For the example installation:

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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-data owns 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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Users 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
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rollback if validation fails

  1. Enable maintenance mode with sudo -u www-data php occ maintenance:mode --on.
  2. Stop Apache with sudo service apache2 stop.
  3. Restore the previous datadirectory value in config/config.php.
  4. Make sure the original data directory is still intact and accessible to www-data.
  5. Start Apache, leave maintenance mode on, and test the original location.
  6. 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.
  • rsync completed without errors and the source tree remains available.
  • The destination is outside the webroot and reserved for ownCloud.
  • www-data can traverse, read and write the complete path.
  • The absolute datadirectory value 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.