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

cannot backup Synology Photos‘ album and face data ... #130

Open
PrestarLin opened this issue Oct 20, 2024 · 15 comments
Open

cannot backup Synology Photos‘ album and face data ... #130

PrestarLin opened this issue Oct 20, 2024 · 15 comments

Comments

@PrestarLin
Copy link

hello, i test this script,and try to backup Synology Photos,and then i delete one album on the web of this package,and then use script to restore.
but i discover the number of album does not restore,why?

@PrestarLin PrestarLin changed the title cannot backup Synology Photos‘ album cannot backup Synology Photos‘ album and face data ... Oct 20, 2024
@PrestarLin
Copy link
Author

image
these doesnot backup

@007revad
Copy link
Owner

The script only backs up the packages and their settings and database. It does not backup any shared folders.

For a full backup, that you can later restore, you'd also need to backup:

  1. The Photos folder in each user's home folder.
  2. The photo shared folders if Shared Space is enabled.

@PrestarLin
Copy link
Author

The script only backs up the packages and their settings and database. It does not backup any shared folders.

For a full backup, that you can later restore, you'd also need to backup:

  1. The Photos folder in each user's home folder.
  2. The photo shared folders if Shared Space is enabled.

these data cannot be found in the home folder,such as face discover data , tag...

@OrpheeGT
Copy link

This will do the job :
#114 (comment)

It did for me.

@007revad
Copy link
Owner

@OrpheeGT just reminded me of something.

@PrestarLin Try this:

  1. Go to Synology Photos > Settings > Shared Space.
  2. Disable the Shared Space.
  3. Then go back in and Enable Shared Space.

@PrestarLin
Copy link
Author

@OrpheeGT just reminded me of something.只是让我想起了一件事。

@PrestarLin Try this: 试试这个:

  1. Go to Synology Photos > Settings > Shared Space.进入 Synology Photos > 设置 > 共享空间。
  2. Disable the Shared Space.禁用共享空间。
  3. Then go back in and Enable Shared Space.然后返回并启用共享空间。

i have not Enable Shared Space. maybe the script should also backup database? or not just package file.

@007revad
Copy link
Owner

Backing up, and restoring, the pgsql database is not possible because there are 7 or more Synology packages that use the same database. Restoring a backup of the database would also restore old data for the other 6 packages.

These are the ones I know of:

Audio Station
Calendar
Contacts
Download Station
Media Server
Synology Application Service
Synology Photos
Video Station

@OrpheeGT
Copy link

OrpheeGT commented Oct 20, 2024

So it makes sense only when source volume is meant to be deleted (like mine did when FS crashed)
image

You can add Surveillance Station to the list. Maybe Synology Drive too.

@PrestarLin
Copy link
Author

So it makes sense only when source volume is meant to be deleted (like mine did when FS crashed)因此,只有当源卷要被删除时才有意义(就像我在 FS 崩溃时所做的那样) image

You can add Surveillance Station to the list. Maybe Synology Drive too.您可以将 Surveillance Station 添加到列表中。也许 Synology Drive 也是如此。

how to backup it?

@OrpheeGT
Copy link

This will do the job : #114 (comment)

It did for me.

Here

@OrpheeGT
Copy link

pg_dump and pg_restore with postgres user would probably be an option to backup only some databases from whole DBs

image

pg_dump dbname > backup.sql

pg_restore backup.sql

But it probably does not handle user backup/rights...
image

The best way would be to install the app, it will create users/and db structure in @database..
Then truncate (delete ?) app DB with psql, and reimport it with pg_restore... ?

@OrpheeGT
Copy link

Maybe this could be tried at import step to prune empty/dummy db from fresh app install before it import real datas...

https://stackoverflow.com/questions/2056876/postgres-clear-entire-database-before-re-creating-re-populating-from-bash-scr

To be tested on dev env... I'm not a DB expert.

@OrpheeGT
Copy link

image

@OrpheeGT
Copy link

OrpheeGT commented Oct 20, 2024

Maybe something like

as root (sudo su -) :
# create temp backup folder on new volume
mkdir /volumeX/pg_dump

# Give owner rights to postgres
chown postgres: /volumeX/pg_dump

# switch to postgres user
su - postgres

# change folder
cd /volumeX/pg_dump

# backup desired DB from current DB before move. (here synofoto)
pg_dump synofoto > synofoto.sql

Now DB is backuped, when you want to restore it :

# Install app from Store (like Synology photo).
# It will create DB structure.
# Then stop newly installed app.

# Copy/restore all photos shared folder

# from root login as postgres user
su - postgres

# change to backuped folder DB
cd /volumeX/pg_dump

# Import backup
pg_restore --clean -d synofoto synofoto.sql

# Start the app and pray

@007revad
Copy link
Owner

007revad commented Oct 20, 2024

Start the app and pray

I like your optimism

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

No branches or pull requests

3 participants