ownCloud Data Directory

I initially stored my ownCloud data on an external NTFS hard disk. (Yes, this was not a good idea at all.) After some time now I wanted to move the files to a bigger ext4 drive on the same machine. Unluckily there are many posts and articles that are really irritating on the Internet, such as: 1, 2, 3, 4. At least I found some promising hints at the official GitHub forums (this and that) and gave it a try:

At many points, someone noted that it is not officially supported to move the data directory after installation. :( However, the just linked GitHub pages are talking about a method. I tried to copy (cp) all of my files, but ran into some hard disk errors due to broken USB connections on my server. After I tried it again (cp -u), I finally used rsync to copy all of my files, incl. the hidden files that were not copied with cp. These were my steps:

Copy

I first enabled the maintenance mode:

and began to copy my data files (500 GB) from one mount to another. (NOTE: You should skip these steps and use rsync directly, such as explained in a few seconds):

But since I ran into some hard disk errors, I used cp again with the -u option to “update” all files:

After that I set the correct file ownership to www-data:

While I was still confused whether all files were copied, I noticed that at least the hidden files such as .htaccess were NOT present at the new file location. A colleague gave me the hint to use rsync, which I tried thereafter. (Refer to here and there.) I first ran the demo mode from rsync. Additionally I set the -P option for progress information and the –stats for final statistics. Also note the critical slashes at both paths. While the first one ends with a slash, the second doesn’t:

(Since I copied from an NTFS hard disk, I also used the –size-only option to compare only the sizes of the files and not the ownership.)

Finally, I ran the following command to copy all broken files which were not copied correctly during my cp runs:

Yep, it worked. Great so far.

And ownCloud Changes

Now I changed the “datadirectory” path within the config.php file:

to point to the new mounted drive:

And I ran the repair command that was mentioned in the GitHub post:

This looked like the following (and executed quite fast!):

Yeah, after some breathing space I disabled the maintenance mode:

And I was REALLY HAPPY that everything worked again. YEAH! (Though I am still a bit nervous because of this post which talks about some absolute paths within logrotate. I have never used this or heard about it concerning ownCloud. Hopefully, this won’t break my data after a few weeks…)

Featured image “IMG_4696” by Holly Marquardt is licensed under CC BY-NC-ND 2.0.

2 thoughts on “ownCloud Data Directory

  1. Danke für den Post! Kann man sicher mal gebrauchen.

    Andere Frage, wenn wir schon beim Thema OwnCloud sind: Würdest du aktuell noch ein OwnCloud aufsetzen oder doch eher auf NextCloud gehen? Ich habe OwnCloud-Instanz angelegt einige Tage bevor NextCloud aufgetaucht ist. Viel eingerichtet ist noch nicht, wäre kaum Aufwand, auf NextCloud zu gehen. Was sagt dein Gefühl?

    1. Tja, ich habe keine Ahnung. Vom Gefühl her würde ich erst mal vorsichtig abwarten. ownCloud läuft ja gut und vernünftig. Das muss Nextcloud erst mal beweisen.
      Wenn sich längerfristig zeigen sollte, dass ownCloud stirbt und Nextcloud alles besser macht (was so einfach sicherlich nicht zu entscheiden sein wird), dann können wir über einen Umstieg nachdenken…

Leave a Reply

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