Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new command to move a user's home folder - occ user:move-home #39136

Merged
merged 1 commit into from
Sep 14, 2021

Conversation

DeepDiver1975
Copy link
Member

@DeepDiver1975 DeepDiver1975 commented Aug 26, 2021

Description

➭ php7.4 ./occ help user:move
Description:
  Move a user's home folder to a new location.

Usage:
  user:move-home [<user_id> [<new_location>]]

How Has This Been Tested?

  • create a user user_1
  • login
  • create some files, version, thumbnails - maybe with encryption
  • occ u:mo user_1 /tmp
  • make sure all files are copied over to /tmp/user_1
  • delete original user home (data/user_1)
  • login again and check if all files are still accessible

Screenshots (if appropriate):

Screenshot from 2021-08-27 15-40-32

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

@update-docs

This comment has been minimized.

@DeepDiver1975 DeepDiver1975 marked this pull request as draft August 26, 2021 10:08
@DeepDiver1975 DeepDiver1975 force-pushed the feat/user-home-move branch 2 times, most recently from e731aa7 to 33b6f54 Compare August 27, 2021 13:36
@DeepDiver1975 DeepDiver1975 marked this pull request as ready for review August 27, 2021 13:42
@DeepDiver1975 DeepDiver1975 force-pushed the feat/user-home-move branch 2 times, most recently from e75b1ed to f2f6a1b Compare August 31, 2021 08:43
@phil-davis
Copy link
Contributor

https://drone.owncloud.com/owncloud/core/32044/1/9

needs a reabse - the CI now uses owncloudci/nodejs:14

@sonarcloud
Copy link

sonarcloud bot commented Sep 1, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

85.5% 85.5% Coverage
0.0% 0.0% Duplication

@mmattel
Copy link
Contributor

mmattel commented Sep 1, 2021

@DeepDiver1975 I need some info for understanding it:

We have in config.php the key datadirectory which points default lets say to /var/www/owncloud/data. Creating users will create for each user a subfolder with his user_id containing the default structure and user created content.

Now, when using the command above to migrate a users home, some questions raise:

  1. Is it true that you can move the complete user folder from data/ to somewhere else, using any possible target path which is not necessarily in the owncloud directory (with proper rights for the webserver user of course).
  2. In case (1) is true, this would mean that you have two datadirectory paths. One for the remaining users and one (or many!) for the moved ones. Is this correct? If not, please explain.
  3. You can define a particular user in the command. This means that you have to rerun this command for every user you want to do so. Is there a plan to have additional options to do this for multiple users?
  4. Is it correct that in the target path, the user folder must not exist.
  5. What is the usecase for, when does an admin need this command to run?
  6. Are there any limitation necessary to know? Like what happens if there are big files to move where you maybe run into php/webserver timeouts or other stuff.

Sorry for that many questions, but they are necessary for a proper documentation.

@DeepDiver1975
Copy link
Member Author

  • Is it true that you can move the complete user folder from data/ to somewhere else, using any possible target path which is not necessarily in the owncloud directory (with proper rights for the webserver user of course).

yes

  • In case (1) is true, this would mean that you have two datadirectory paths. One for the remaining users and one (or many!) for the moved ones. Is this correct? If not, please explain.

not only two data dirs - as many as you want ;-)

  • You can define a particular user in the command. This means that you have to rerun this command for every user you want to do so. Is there a plan to have additional options to do this for multiple users?

nothing planned at the moment. doing multiple users at once can be too error prone

  • Is it correct that in the target path, the user folder must not exist.

yes - the parent must exist. the user folder is rsynced over to the new location

  • What is the usecase for, when does an admin need this command to run?

think of an nfs based installation where different nfs shares exist and due to 'load balancing of storage usage' you want one user to have their files on a different share.

  • Are there any limitation necessary to know? Like what happens if there are big files to move where you maybe run into php/webserver timeouts or other stuff.

it is an occ command - no php timeouts play into this. heavy lifting of files is done using rsync
one limitation is that this obviously only works with posix storage and obviously not on object stores

@mmattel
Copy link
Contributor

mmattel commented Sep 1, 2021

Great answers, many thanks !

not only two data dirs - as many as you want ;-)

I was not aware of this capability, how/where do you define multiple data dirs (in config.php), where can I read more? As far I read our documentation, datadirectory is a string and not an array...

@mmattel
Copy link
Contributor

mmattel commented Sep 1, 2021

Q: would it be possible to show the progress of rsync in the output
with the rsync option --progress?
maybe as an occ option like -p

This would help the admin to see how far the command has progressed already

@DeepDiver1975
Copy link
Member Author

I was not aware of this capability, how/where do you define multiple data dirs (in config.php), where can I read more? As far I read our documentation, datadirectory is a string and not an array...

mainly via the ldap home folder app or some custom code - this is only necessary in very specific large scale setups.

@DeepDiver1975
Copy link
Member Author

Q: would it be possible to show the progress of rsync in the output
with the rsync option --progress?
maybe as an occ option like -p

This would help the admin to see how far the command has progressed already

Not easily right away .... one would need to do some research ...

@mmattel
Copy link
Contributor

mmattel commented Sep 2, 2021

See related issue: https://github.com/owncloud/enterprise/issues/4637

Copy link

@AlexAndBear AlexAndBear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise LGTM, also works quite well on my system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants