In order to recover, I shut down and put the old drives in, attached a USB drive, turned on ssh, ssh'd to the DS, and ran this to create a backup file of the video station database:
Code: Select all
pg_dump -U postgres -Fc -b -f /volumeUSB1/usbshare/videostation.dump video_metadata
(the name of the USB volume after the -f parameter may vary, or you can replace that with any destination file you like)
Then I shut down, put the new hard drives in (I had already run the initial restore to them), attached the USB drive, and started the DS again. I stopped video station, ssh'd in, and ran this to replace the video station database full of crap with all the info from the old drives:
Code: Select all
pg_restore -U postgres -c -d video_metadata /volumeUSB1/usbshare/videostation.dump
Again, the final path there should point to the database backup you created before, so the specific location may vary. The restore command gave a bunch of errors like this but they didn't seem to matter (I assume the specific object IDs just changed):
pg_restore: [archiver (db)] Error from TOC entry 2267; 2613 17072 BLOB 17072 postgres
pg_restore: [archiver (db)] could not execute query: ERROR: large object 17072 does not exist
Command was: SELECT pg_catalog.lo_unlink('17072');
Then I started video station again. It seems to have worked as desired -- all my shows and movies are listed again properly and their images are back.
For what it's worth this was with DSM 5.2-5565 Update 2 which uses PostgreSQL 9.3.6. I wouldn't have a lot of confidence it would work across different DSM versions (since they may have changed the database layout), but both old and new drives were on the same DSM version at the time I did it.