Synology_app_mover icon indicating copy to clipboard operation
Synology_app_mover copied to clipboard

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

Open PrestarLin opened this issue 1 year ago • 15 comments

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 avatar Oct 20 '24 02:10 PrestarLin

image these doesnot backup

PrestarLin avatar Oct 20 '24 02:10 PrestarLin

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.

007revad avatar Oct 20 '24 07:10 007revad

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...

PrestarLin avatar Oct 20 '24 07:10 PrestarLin

This will do the job : https://github.com/007revad/Synology_app_mover/issues/114#issuecomment-2375487880

It did for me.

OrpheeGT avatar Oct 20 '24 08:10 OrpheeGT

@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.

007revad avatar Oct 20 '24 08:10 007revad

@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.

PrestarLin avatar Oct 20 '24 08:10 PrestarLin

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

007revad avatar Oct 20 '24 08:10 007revad

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.

OrpheeGT avatar Oct 20 '24 08:10 OrpheeGT

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?

PrestarLin avatar Oct 20 '24 08:10 PrestarLin

This will do the job : #114 (comment)

It did for me.

Here

OrpheeGT avatar Oct 20 '24 08:10 OrpheeGT

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 avatar Oct 20 '24 09:10 OrpheeGT

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 avatar Oct 20 '24 09:10 OrpheeGT

image

OrpheeGT avatar Oct 20 '24 09:10 OrpheeGT

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

OrpheeGT avatar Oct 20 '24 09:10 OrpheeGT

Start the app and pray

I like your optimism

007revad avatar Oct 20 '24 09:10 007revad