backup -- then restore

Support and queries relating to all previous versions of ZoneMinder
Locked
darkpaw
Posts: 166
Joined: Thu Apr 26, 2007 2:35 am

backup -- then restore

Post by darkpaw »

I just reinstalled my ZM system to Fedora Core 10, but made the partitions wrong. I created a huge /usr partition, when I should have created a huge /var partition.

Is there an easy way to "rearrange" these? I suppose it could be done via symlinks, but other than that, I would be willing to reinstall from scratch since I just did it. Which leads to my (other) question:

How can I "backup" everything in the database, reinstall the OS, then "restore" it? In the "old days", somebody had created an awesome "backup-zm" and "restore-zm" script, that would do exactly that...but that doesn't work when you install via the repository (due to the naming). What would be the commands to do this manually?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The backup script should still work for the most part. Not sure which one you were using, I had made a very basic one and Ross made one that was a bit more intuitive with a few more features. The basic one would not be difficult to adapt.

For the most part it just runs mysqldump and puts most of the tables in a flat file and tars it all up.

mysqldump zm -u <zm_db_user> -p > zm-db-backup.sql

This will get everything in the database.
darkpaw
Posts: 166
Joined: Thu Apr 26, 2007 2:35 am

mysqldump

Post by darkpaw »

Thanks. What would be the command to restore the tables after the reinstall? :)

I am not very familiar with mysql.
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

To restore a database you do the following at the console.

mysql -u <mysql_root> -p zm < zm-db-backup.sql

If you get an error that the database zm dosen't exist you type
mysqladmin -u <mysql_root> -p create zm

and then try again the db restore again.


Then you'd want to set the zm_db_user permissions if you havent' done so already on the restored system by typing

mysql -u <mysql_root> -p
then
grant select,insert,update,delete on zm.* to '<zm_db_user>'@localhost identified by '<zm_db_user_password>';
darkpaw
Posts: 166
Joined: Thu Apr 26, 2007 2:35 am

thanks

Post by darkpaw »

Outstanding information....thanks a lot.

:)
Locked