how to backup nextcloud accounts and restore

LV52

Dabbler
Joined
Oct 14, 2022
Messages
10
Recently, I have upgrade the truenas system from 22.04 to 22.12. In 22.04, I have installed the nextcloud 23.0 and it work well.
After I upgrade the truenas system from 22.04 to 22.12, I found that the nextcloud 23.0 was unable to running, it stuck in 2/3.
So, I newly install a nextcloud 25.0 and it also work well in truenas 22.12, but the nextcloud 25.0 without any old data.

I follow some tutorial that use rsync copy the old nextcloud data (only "data" folder) to new nextcloud path.
Then I use the "php occ files:scan --all" command in nextcloud shell, it works.
But the new nextcloud 25.0 I have only one root account, the "php occ files:scan --all" command only restore the old data of root account.
I have 5 accounts in old nextcloud 23.0 (such as, root, aa,bb,cc,dd), now only one account restore in new nextcloud.

Also, I tried to create a same name account in new nextcloud 25.0 (such as aa), the system will tell me that "The user already has files", which means the system knows that files and accounts exist but can't display them.

My quesetion is, how can I restore or rescan the old account in nextcloud 23.0 to nextcloud 25.0.
If I can restore the old account in nextcloud 23.0, I use the "php occ files:scan --all" command again, maybe I can restore all data in old nextcloud 23.0?

thank!
 
Last edited:

victort

Guru
Joined
Dec 31, 2021
Messages
973
Recently, I have upgrade the truenas system from 22.04 to 22.12. In 22.04, I have installed the nextcloud 23.0 and it work well.
After I upgrade the truenas system from 22.04 to 22.12, I found that the nextcloud 23.0 was unable to running, it stuck in 2/3.
So, I newly install a nextcloud 25.0 and it also work well in truenas 22.12, but the nextcloud 25.0 without any old data.

I follow some tutorial that use rsync copy the old nextcloud data (only "data" folder) to new nextcloud path.
Then I use the "php occ files:scan --all" command in nextcloud shell, it works.
But the new nextcloud 25.0 I have only one root account, the "php occ files:scan --all" command only restore the old data of root account.
I have 5 accounts in old nextcloud 23.0 (such as, root, aa,bb,cc,dd), now only one account restore in new nextcloud.

Also, I tried to create a same name account in new nextcloud 25.0 (such as aa), the system will tell me that "The user already has files", which means the system knows that files and accounts exist but can't display them.

My quesetion is, how can I restore or rescan the old account in nextcloud 23.0 to nextcloud 25.0.
If I can restore the old account in nextcloud 23.0, I use the "php occ files:scan --all" command again, maybe I can restore all data in old nextcloud 23.0?

thank!
What I did as a workaround is to rename the old user account folders, then create new users with the same names as before. After that you can rename the folders back to the original names and run the scan command again.

For example if I have a user named bob@bobmail.com, I would rename his folder to bob@bobmail.com1, create an account using bob@bobmail.com, then rename the folder to its original and rescan the files.
 

LV52

Dabbler
Joined
Oct 14, 2022
Messages
10
What I did as a workaround is to rename the old user account folders, then create new users with the same names as before. After that you can rename the folders back to the original names and run the scan command again.

For example if I have a user named bob@bobmail.com, I would rename his folder to bob@bobmail.com1, create an account using bob@bobmail.com, then rename the folder to its original and rescan the files.
Yes, your method is feasible, I also saw it in other website, and it is enough for me. However, if someone have a large number of accounts, he must to manually modify and create a large number of accounts in this situation?
In addition, the original passwords of other users will be reset during the process of creating accounts. Above approach is the only viable solution?
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
Yes, your method is feasible, I also saw it in other website, and it is enough for me. However, if someone have a large number of accounts, he must to manually modify and create a large number of accounts in this situation?
In addition, the original passwords of other users will be reset during the process of creating accounts. Above approach is the only viable solution?
It’s the only one I have come across.

If someone has another one they are welcome to share.

I suspect that the database would be needed in addition to the user files to accomplish this.
I haven’t tried that though.
 

LV52

Dabbler
Joined
Oct 14, 2022
Messages
10
It’s the only one I have come across.

If someone has another one they are welcome to share.

I suspect that the database would be needed in addition to the user files to accomplish this.
I haven’t tried that though.
I think so. If someone want to back up the account information, he should back up the nextcloud database files maybe, but I haven't seem someone has concrete way to do that yet. Thanks for the communication!
 
Top