[p4] Backup scripts?

Lee Marzke lee at marzke.net
Mon Sep 25 05:45:42 PDT 2006


Arnt Gulbrandsen wrote:
> R. Tyler Ballance writes:
>   
>> I was wondering if anybody had any good ruby/python/perl scripts for 
>> creating and tarballing backups of my entire perforce repository (all 
>> three depots), once those tarballs exist, I am capable enough to 
>> write the scripts to rsync those to a remote server, but doing 
>> nightly backups of the perforce repository (given its database and 
>> metadata-centric approach to storing data) still eludes me :)
>>     
>
> You don't need a script, just run tar on the entire perforce directory. 
> The files you need to back up are db.*, license and all the 
> subdirectories (one per depot).
>
> Since you're so small, you probably don't even need to stop the p4d 
> while you're making the copy. Just do it at night while noone submits.
>
>   
Please read the Admin Guide.  Checkpoints are not optional,  and must
be used to obtain a backup of the meta-data.

Backing up all the depots in the perforce directory will work for
the non meta-data.

However backing up the db.* files does not guarantee that you will
have a consistent database.   You should run a checkpoint before
the backup and then backup the checkpoint file (  you don't need
the db.* files, but it doesn't hurt to include them )

You don't need a complex script.  Either have the backup program
do a p4 checkpoint before the job,  or with a small server run checkpoint
from cron before the backup.

I have my small clients use 2 cron entries,  one for checkpoint, and
one to start the backup 1 hour later.

Lee Marzke








More information about the perforce-user mailing list