Join Us and become a Member for a Verified Badge to access private areas with the latest PS4 PKGs.
PS4 News       Thread starter 73n1x69       12      
Status
Not open for further replies.
to backup database:

run the hen payload and then run the ftp payload.

ftp into /system_data/priv/mms/
and copy app.db to your computer.

you can take addcont.db if you like that holds stuff like extra seasons of games.

Note: when you install new games you will need to backup app.db again so it includes those new games too.


to restore broken database:

run the hen payload and then run the ftp payload.

ftp into /system_data/priv/mms/

upload your saved app.db from your computer to that directory overwriting the app.db inside the ps4

power off the ps4 as you normally would then boot it back up and see if it has changed.

this worked for me when I was playing around with that run games from hdd idea, my database rebuilt and I lost all the tiles for 40+ games but I had saved a copy of my app.db and when I tried to put it back with just the ftp payload running it would rebuild again but when I used hen payload and the ftp payload it restored all my tiles and still works now.

if someone wanted to make a payload to back it up they could do something like this

Code:
#include "ps4.h"

int _main(void) {
    initKernel();
    initLibc();
    copyFile("/system_data/priv/mms/app.db", "/system_data/priv/mms/app.backup");
    return 0;
}

void copyFile(char *sourcefile, char* destfile)
{
    FILE *src = fopen(sourcefile, "r");
    FILE *out = fopen(destfile,"w");
    char buffer[60480];
    size_t bytes;
    while (0 < (bytes = fread(buffer, 1, sizeof(buffer), src)))
            fwrite(buffer, 1, bytes, out);
    fclose(src);
    fclose(out);
}

thanks very much for the explanation. i think this should be in the tutorial section of the PS4 forums. it will help lots of people :)
 
if you want a payload to backup the database to a usb drive here you go: DbBackup.zip

https://pastebin.com/A226z7Nt
Code:
#include "ps4.h"


int _main(void) {
    initKernel();
    initLibc();

        FILE *usbdir = fopen("/mnt/usb0/.dirtest", "wb");
 
         if (!usbdir)
            {
                usbdir = fopen("/mnt/usb1/.dirtest", "wb");
                if (!usbdir)
                {
                           copyFile("/system_data/priv/mms/app.db", "/system_data/priv/mms/app.db_backup");
                        copyFile("/system_data/priv/mms/addcont.db", "/system_data/priv/mms/addcont.db_backup");
                        return 0;
                }
                else
                {
                        fclose(usbdir);
                        unlink("/mnt/usb1/.dirtest");
                        mkdir("/mnt/usb1/DB_Dackup/", 0777);
                    copyFile("/system_data/priv/mms/app.db", "/mnt/usb1/DB_Dackup/app.db");
                    copyFile("/system_data/priv/mms/addcont.db", "/mnt/usb1/DB_Dackup/addcont.db");
                }
            }
            else
            {
                        fclose(usbdir);
                        unlink("/mnt/usb0/.dirtest");
                        mkdir("/mnt/usb0/DB_Dackup/", 0777);
                    copyFile("/system_data/priv/mms/app.db", "/mnt/usb0/DB_Dackup/app.db");
                    copyFile("/system_data/priv/mms/addcont.db", "/mnt/usb0/DB_Dackup/addcont.db");
            }
    return 0;
}

void copyFile(char *sourcefile, char* destfile)
{
    FILE *src = fopen(sourcefile, "r");
    FILE *out = fopen(destfile,"w");
    char buffer[60480];
    size_t bytes;
    while (0 < (bytes = fread(buffer, 1, sizeof(buffer), src)))
            fwrite(buffer, 1, bytes, out);
    fclose(src);
    fclose(out);
}
just put a usb stick/drive into the usb port and run the DbBackup.bin payload

it will save the addcont.db and app.db files inside a folder called DB_Dackup on the usb drive.

if you do not use a usb stick/drive it will backup the database into the /system_data/priv/mms/ folder on the ps4 and it will be called app.db_backup.

to restore the db just ftp into the /system_data/priv/mms/ directory and upload your backup copy.

credit to @XVortex for the neat way to check which usb port has the drive in it in their ps4dumper source, I tried a few other things with no decent result but @XVortex had a simple method to do the trick :)
 
Status
Not open for further replies.
Back
Top