PS4 News       Thread starter 73n1x69       11663       12
Status
Not open for further replies.

FFTHEWINNER

Senior Member
Contributor
Verified
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 :)
 

stooged

Developer
Senior Member
Contributor
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.
Recent Articles
PS4 APU Floor Plan High-Resolution Die Shots & Vpikhur at Toorcon 2019
Those who enjoy PlayStation 4 eye candy may recall seeing PS4 System Controller High-Res Images awhile back, and recently Volodymyr Pikhur passed along some PS4 APU (Accelerated Processing Unit)...
JoystickUDP: Collection of Methods Using a PS4 Controller with UDPComms
Recently StanfordRoboticsClub shared on Github a collection of methods using a DualShock 4 PS4 Controller with UDPComms, which is a Python library to enable communication between different...
Star Wars Jedi: Fallen Order Joins New PS4 Game Releases Next Week
Explore the galaxy in the latest PlayStation 4 third-person action-adventure game Star Wars Jedi: Fallen Order from Respawn Entertainment arriving to PS4 next week on November 15th. Play as an...
Feel The Power of Pro with PlayStation 4 Pro Latest PS4 TV Spot!
Right behind their It's Time to Play! campaign and Black Friday Deals, Sony is ramping up PlayStation promotions for the holidays with the latest PS4 TV spot showcasing the Limited Edition PS4 Pro...
Top