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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

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 completeness, point config/config.php at the new absolute path, and test before reopening service. The procedure below is for a classic, native Apache installation; Docker and other container deployments use different paths and commands.

Use a destination such as /mnt/owncloud/data only when the filesystem is mounted reliably at boot, has enough headroom, and is reserved for ownCloud. Keep the data directory outside the webroot and accessible to Ubuntu’s Apache account, www-data.

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

Before you move anything

ownCloud stores user files, metadata and application data under its configured data directory. Changing that path is a storage migration, not just a folder rename: a missed file, an unavailable mount or incorrect permissions can make the instance appear empty or prevent uploads. ownCloud’s installation documentation therefore says, “It is best to configure your data directory location at installation, as it is difficult to move after installation.” If the server is already in production, plan the move as a controlled maintenance operation.

Confirm the deployment type

This guide assumes a native Ubuntu installation with Apache, PHP and an ownCloud tree such as /var/www/owncloud. The commands are run on the host and use the host’s www-data account. A Docker or other container installation has a different filesystem view: its occ command must run inside the container, storage must be mounted at the path expected by that container, and a current Classic 11 migration procedure may require file scans or database-path changes. Do not apply container SQL or container paths to a native installation.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Choose and prepare the destination

Evaluate the destination on more than capacity. Check growth room, latency, mount reliability during boot, backup and snapshot support, encryption requirements, ownership semantics and recovery time. A local disk generally has simpler permissions and lower latency than an NFS or NAS export; network storage can work, but its mount and identity behavior must be correct before Apache starts.

  • Use an absolute path, for example /mnt/owncloud/data.
  • Keep the directory outside the webroot so it cannot be served as ordinary web content.
  • Reserve the directory for ownCloud. Do not let unrelated services or users edit its files.
  • Ensure the filesystem is mounted before Apache and ownCloud start, including after a reboot.
  • Confirm available capacity and test that the mount remains present under the account and boot conditions used by the server.

For NFS, verify the export’s UID/GID mapping and mount options first. If the export is unavailable, a recursive ownership command issued against the mount point can affect the underlying local directory instead, or fail to correct ownership on the server. Treat NFS identity and boot ordering as part of the migration, not as an afterthought.

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

Make a rollback plan

Back up the ownCloud database and the configuration before changing the path. Preserve the original data directory until the new location has passed your checks and users have completed a test cycle. Record the current datadirectory value, the destination mount details and the commands you use, so reverting means restoring the old configuration and service state rather than guessing.

Native Ubuntu move: the complete procedure

Replace every example path with the paths on your server. The examples below assume the ownCloud installation is /var/www/owncloud, the old directory is /var/www/owncloud/data, and the new parent directory is /mnt/owncloud.

1. Stop web access

First stop Apache so browsers, WebDAV clients, cron-triggered requests and background activity cannot change files while they are being copied:

sudo service apache2 stop

On systems managed with systemctl, sudo systemctl stop apache2 performs the same service action. Confirm that the service is actually inactive before copying. If another reverse proxy or web server can reach PHP, stop or block that access as well.

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

2. Enable ownCloud maintenance mode

From the ownCloud installation directory, run occ as the HTTP account. Maintenance mode prevents new logins and locks existing sessions, while running the command as www-data keeps ownership of files created by the command consistent:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
cd /var/www/owncloud
sudo -u www-data php occ maintenance:mode --on

Although Apache is stopped, enabling maintenance mode protects the instance when you later start Apache for validation and provides a clear state if a client connects during the operation.

3. Copy the data with rsync

Use the documented rsync approach and preserve attributes:

sudo rsync -avz /var/www/owncloud/data /mnt/owncloud

With those exact source and destination arguments, rsync creates /mnt/owncloud/data. Check the source and destination carefully before pressing Enter: a missing directory component or an extra trailing slash changes what is created and where its contents land. For a large data set, allow the copy to finish without restarting Apache or changing files in the source.

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.

The -a option requests archive behavior, preserving the directory structure and file attributes that ownCloud relies on; -v shows activity; and -z enables compression during transfer. Compression is harmless for a local move but may add CPU work, so the key requirement is that the copy completes and attributes are retained.

4. Verify the copy before changing configuration

Do not switch the path immediately after rsync exits. Verify that the destination contains the expected ownCloud structure and representative user files, and compare the source and destination totals. You can run a second rsync in dry-run mode to expose differences without changing either side:

sudo rsync -avzn /var/www/owncloud/data/ /mnt/owncloud/data/

A dry run that reports no unexpected transfers is useful evidence, but it is not a substitute for checking the filesystem itself. Confirm that the destination is the intended mounted filesystem rather than an empty directory on the root disk, especially when the mount failed or was not enabled at boot.

5. Set ownership and access safely

The Ubuntu Apache account is www-data. The data directory and its contents must be readable and writable by that account, while unrelated accounts should not be able to modify them. Inspect ownership and permissions on the destination and on every parent directory in the path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
sudo ls -ld /mnt /mnt/owncloud /mnt/owncloud/data
sudo find /mnt/owncloud/data -maxdepth 1 -mindepth 1 -printf '%M %u:%g %pn' | head

For a local filesystem, an administrator may need to assign ownership to www-data with a recursive chown, but do this only after confirming that the mount is the intended local volume. NFS exports can map identities differently, and blindly running chown -R while an NFS mount is unavailable can operate on the wrong local directory or fail to change server-side ownership. Correct NFS ownership on the export and verify it through the mounted path.

Also check traversal permissions on parent directories: www-data needs execute permission on each directory component to reach the data directory. Avoid granting broad write access merely to make a test pass.

6. Change the datadirectory setting

Edit the ownCloud configuration file and set an absolute path:

sudo editor /var/www/owncloud/config/config.php

Change the existing entry to the new location, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
'datadirectory' => '/mnt/owncloud/data',

Keep the PHP syntax, commas and quoting intact, and do not create a second datadirectory key. An alternative is the supported system-configuration command from the ownCloud directory, run as www-data:

cd /var/www/owncloud
sudo -u www-data php occ config:system:set datadirectory --value=/mnt/owncloud/data

Use the command syntax supported by the ownCloud version installed on the server. Whichever method you use, preserve a copy of the old configuration for rollback and confirm that the resulting value is exactly the new absolute path, not a shell-relative path or a path inside the old directory.

7. Start Apache while maintenance mode remains on

Bring Apache back only after the copy, mount and configuration have been checked:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
sudo service apache2 start

Leave maintenance mode enabled during this validation phase. Open the ownCloud URL and confirm that the maintenance page appears without a configuration or storage error. Review the Apache and ownCloud logs for “directory not found,” permission-denied, database or PHP errors. If the page reports that the data directory is missing, stop Apache and correct the mount or path before proceeding.

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

8. Run a file scan when the installed version requires it

Some ownCloud versions and migration procedures require a file scan after storage changes, particularly when the move is part of a container migration. Follow the file-scan command and sequencing documented for your installed major version rather than copying a Docker-specific command into a native host installation. A scan should be run as www-data from the ownCloud directory so ownership and application state remain consistent.

9. Disable maintenance mode and test normal operation

When the validation page and logs are clean, disable maintenance mode:

cd /var/www/owncloud
sudo -u www-data php occ maintenance:mode --off

Restart or re-enable normal Apache access if your service procedure requires it, then sign in as an administrator and test real operations:

  • Open several existing files from different users.
  • Upload a new file and download it again.
  • Rename or delete a test file, if your policy permits.
  • Create or access a share and verify that its recipient can use it.
  • Check background jobs, previews and notifications relevant to your installation.
  • Watch the logs while these tests run.

Keep the original directory untouched until these checks succeed and you have a fresh backup. After the retention period in your rollback plan, remove the old copy only when you are certain it is no longer needed.

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.

Why each control matters

Maintenance mode and service quiescence

Copying a live data directory can produce a split state: a file changed after rsync passed it will exist only in the old location, while the database may refer to metadata that is not present in the new one. Stopping Apache removes ordinary web writes; maintenance mode blocks logins and existing sessions when the service is brought back for checks.

Absolute configuration paths

ownCloud resolves the datadirectory value as a server filesystem location. An absolute path such as /mnt/owncloud/data is unambiguous across service starts, cron jobs and command-line operations. Relative paths can resolve from different working directories and are not appropriate for this setting.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Exclusive ownership

Allowing another application to alter ownCloud’s files can cause inconsistent metadata, unexpected deletions or security exposure. The directory should be writable by the web-server account that runs ownCloud and otherwise tightly controlled.

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

Destination choices: local disk, NFS or NAS

Decision factor Local mounted disk NFS or NAS export
Capacity and growth Check the volume’s free space and expansion method. Check export quotas, network capacity and expansion on the storage server.
Latency Usually predictable and local to the Ubuntu host. Depends on network, server load and mount options; test the workload you expect.
Boot reliability Use a stable filesystem identifier and ensure it is mounted before Apache. Ensure network availability and mount ordering before Apache and ownCloud start.
Permissions Local UID/GID ownership can be managed on the host. UID/GID mapping, export policy and root-squash behavior must be correct on the NFS server and client.
Backups and snapshots Arrange backups or snapshots that include the volume. Confirm the storage system’s snapshots and that they can be restored with usable ownership and timestamps.
Recovery Document how to replace or remount the disk. Document network, export, credentials and mount recovery as well as the ownCloud configuration.

No particular disk, NAS or storage brand is required by the ownCloud procedure. The correct destination is the one that stays mounted, preserves the permissions ownCloud needs, is backed up and can be recovered within your operational requirements.

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

Common failure modes and recovery

ownCloud says the data directory is missing

  • Check for a failed or late mount with mount and inspect the path with findmnt /mnt/owncloud.
  • Confirm that /mnt/owncloud/data exists on the mounted filesystem, not merely on the root filesystem beneath an absent mount.
  • Check spelling, capitalization and the absolute value in config/config.php.
  • Stop Apache, restore the previous configuration value if necessary, and remount the destination before retrying.

Permission denied during login, upload or scan

Inspect ownership and mode bits on the data directory and each parent directory as www-data would see them. Correct local-volume ownership only after verifying the mount. For NFS, fix UID/GID mapping or export permissions instead of repeatedly applying local chown. Check logs to identify the exact file and operation that failed.

The destination appears empty

This commonly means the rsync destination was interpreted differently than intended or the mount was not present during the copy. Compare the source and destination paths, remember that rsync -avz /old/data /mnt/owncloud creates /mnt/owncloud/data, and inspect the mount before copying again. Do not delete the original until the expected files are visible on the mounted destination.

Users still see the maintenance page

Run occ maintenance:mode --off from the ownCloud directory as www-data, then verify the setting and reload the site. If the command fails, inspect PHP and ownCloud logs; a bad configuration path or unavailable mount can prevent normal operation even after maintenance mode is changed.

Files are present but shares or background jobs fail

Check that the move did not leave a partial copy, that the web account can read and write all required paths, and that the database backup and configuration still correspond to this instance. Run the version-appropriate file scan if the installed documentation calls for one, then repeat upload, download, sharing and background-job tests while watching logs.

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

Apache starts before the storage mount

Make the mount persistent and configure boot ordering so it is available before Apache and ownCloud start. A server reboot is a useful acceptance test: confirm the mount, inspect the data path, and only then allow normal web access. If the mount is absent, keep ownCloud unavailable rather than letting it create or use an empty directory on the root filesystem.

Native installation versus Docker migration

The native sequence changes a host path in config/config.php, runs host PHP’s occ as www-data, and manages Apache directly. In Docker, the host directory must be mounted into the container at the path ownCloud expects; occ runs through the container runtime; and a current Classic 11 migration guide adds container-specific copying, remounting, file-scan and possible database-path steps. Determine the deployment first with your service definitions and documentation. Never paste Docker SQL updates into a native Ubuntu installation without confirming the deployment and schema.

Post-move checklist

  1. Database and configuration backups are restorable.
  2. The destination filesystem is mounted persistently and has adequate capacity.
  3. Apache and any other web entry point were stopped during the copy.
  4. Maintenance mode was enabled with www-data.
  5. rsync completed and a verification pass found no unexpected differences.
  6. The destination is outside the webroot and exclusive to ownCloud.
  7. Ownership, parent-directory traversal and read/write permissions work for www-data.
  8. datadirectory contains the correct absolute path.
  9. Apache started cleanly while maintenance mode was still enabled.
  10. Logs showed no storage or permission errors.
  11. Maintenance mode was disabled only after validation.
  12. Administrator tests covered existing files, upload, download, sharing and background jobs.
  13. The old directory remains available until the rollback window and backup checks are complete.

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.