Skip to content

Detect legacy storage + datadir change #10897

Closed

Description

@PVince81

Context is here: #7539

Whenever a setup has the following:

  1. legacy storages in the format "local::$datadir/$user/"
  2. the admin decides to move the data dir

Something will clearly go wrong.

Some repair routine is provided in OC 8 here #7539 but that one can only work if the admin has NOT moved the data dir.

I suggest to add some code to detect whether the datadir has been changed before the update, and then show a warning or block the update.

This can be achieved as follows:

  1. Save the datadir value in oc_appconfig or alternatively in a separate entry in config.php
  2. Whenever an update is run, and the datadir doesn't match the entry in the database, then check whether legacy storages exist. If yes, show a warning.

The purpose is mostly to avoid breakage.

What do you think ? @karlitschek @icewind1991

Activity

  1. MTRichards commented on Sep 5, 2014

    @MTRichards
    Contributor

    Is this just on update?
    Seems to me that any time an admin could decide to move a data directory, and it could potentially break ownCloud because the filecache keeps the path.
    @bboule I seem to remember this happening to you before.

  2. added this to the milestone on Sep 5, 2014
  3. karlitschek commented on Sep 6, 2014

    @karlitschek
    Contributor

    @MTRichards The hardcoded path should be gone in newer ownCloud versions. So this repair routine is to fix old installations only.

  4. MTRichards commented on Sep 6, 2014

    @MTRichards
    Contributor

    When was it introduced? In oc 6?

  5. karlitschek commented on Sep 6, 2014

    @karlitschek
    Contributor

    5 or earlier

  6. MTRichards commented on Sep 6, 2014

    @MTRichards
    Contributor

    Cool, thanks.
    Next question: If you upgraded from back then, is the old path kept?
    Is it possible that a current setup could still have the hard coded path because it was upgraded from a hard coded path oC version?

  7. PVince81 commented on Sep 8, 2014

    @PVince81
    ContributorAuthor

    You are right, an admin could move the directory any time. Maybe we need that check in checkServer to prevent this (or show a warning) at any time.

    It was introduced in 5.0.12 to be exact when the new home::$user storage was introduced, but no upgrade path was provided.

    A current setup can unfortunately still have the hard-coded path, it happened many times already (see #6493 and linked tickets) .

    As long as the admin doesn't move the datadir until OC 8, they should be fine (the repair routine is in OC 8).
    BUT if they moved the datadir, then the following will happen when user "user1" logs in:

    1. The old local::$olddatadir/user1/ entry is not recognized any more, so the code decides to create a new entry home::user1.
    2. The new entry home::user1 gets a new matching file cache.
    3. Older share entries are still linked with the old storage (by file id) and are lost.
    4. Ghost shares might appear in the UI (folders that cannot be entered), at least in OC 6 (OC 7 changed the approach so the ghost shares might not appear any more)
    5. "user1" continues to use their storage, creates new shares, etc

    If we let people continue using ownCloud in that "broken" state, there is no chance for our repair step from OC8 to repair it because it cannot decide whether the real/wanted files are in the old storage entry or the new storage entry, depending on how long the "broken" version has been used.

  8. PVince81 commented on Sep 8, 2014

    @PVince81
    ContributorAuthor

    To clarify @karlitschek 's comment, if your setup upgraded from a version < 5.0.12 then you are likely to have legacy home storages.

    If your first OC install was from > 5.0.12 then you won't have this issue.

  9. MTRichards commented on Sep 8, 2014

    @MTRichards
    Contributor

    Got it. Ok. We need to note this problem in release notes.

  10. MTRichards commented on Sep 8, 2014

    @MTRichards
    Contributor

    @felixboehm you need to know this right now, so that in your coming upgrade you are aware of this situation.

  11. felixboehm commented on Sep 10, 2014

    @felixboehm
    Contributor

    is there a possibility to check, if the data dir was moved?

  12. PVince81 commented on Sep 10, 2014

    @PVince81
    ContributorAuthor

    There is no accurate way.
    We'd need to store the datadir in the database or in a separate config to be able to check against it.

  13. removed this from the milestone on Jan 9, 2015
  14. modified the milestone: backlog on Mar 21, 2015
  15. PVince81 commented on Oct 13, 2015

    @PVince81
    ContributorAuthor

    Since OC 7 is EOL'd soon and only accepts security fixes, this can be closed.

    As soon as people update to 8.0 their database will (hopefully) be fixed and this case cannot happen any more. Closing.

  16. c-holtermann commented on Nov 22, 2015

    @c-holtermann

    I just wanted to update and stumbled into this open knife. I went the update path from <5 and moved my data. Shares don't work correctly. Now I'm tying to clean my database with phpAdmin. Please don't leave open holes like that. I never really got a warning message about duplicate storages.

  17. c-holtermann commented on Nov 23, 2015

    @c-holtermann

    It was not possible for me to update to 8.x before moving the data. I had to change to another server because there was no adequate php version for updating. Finally after the sixth or so attempt to move and upgrade I manually changed the rows in oc_storage from local::/x/y/z to home::z. This worked. All other attempts lead to duplicate entries, chaos and frustration. Cleaning these duplicates up without loosing shares was too complicated. So I had to return to the data from 7.x multiple times.

  18. lock commented on Aug 7, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  19. locked as resolved and limited conversation to collaborators on Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions