Kohei Nozaki's blog 

Entries tagged [backup]

Derby database backup script


Posted on Friday Feb 20, 2015 at 02:49PM in Technology


As Roller, and a virtual machine on VMware Fusion, I wrote an another Ant script which backups an Apache Derby database to automate backup of data of my Apache James server. the script has easy purge function as a target named purge too. intended environment is as follows:

  • Linux server

  • Accepts connection via ssh

  • Has executable ij command which is simple CLI JDBC frontend program shipped with Derby

  • Requires Derby instance to listen a port

It works as follows:

  1. Invoke SYSCS_UTIL.SYSCS_FREEZE_DATABASE() with ij to freeze the database

  2. Create a tarball of the database

  3. Invoke SYSCS_UTIL.SYSCS_UNFREEZE_DATABASE() with ij to unfreeze the database

  4. Download the tarball

  5. Delete the tarball

A bad thing is that due to lack of streaming download in sshexec task, it needs extra free space on the server. the script can be obtained from my GitHub repository.


Automating backup of Roller


Posted on Sunday Feb 01, 2015 at 11:17AM in Technology


I wrote an another Ant script to backup Apache Roller database and data directory. intended to use for PostgreSQL and Linux server. see my GitHub repository for more information.

At first I implemented it with sshexec task and used its output attribute to download the backup stream to local file but the file was corrupted. unfortunately sshexec task uses ByteArrayOutputStream to collect the output stream, then converts the byte array to String as far as I found out. I think it’s not preferable and it can be simply redirected to local file stream. so I changed implementation to that dump the data as a temporary file on remote server, then download it with scp task. I know it’s inefficient and consumes free space the same as the data. implementing redirection of the streams to sshexec task or changing the script to use ssh command directly would be a solution.


Automating daily cold backup of a virtual machine


Posted on Saturday Jan 31, 2015 at 01:24PM in Technology


I have a virtual machine which is running on VMware Fusion 6, and runs some batch jobs for every weekday. I wrote a backup script for it. it does some annoying work such as mounting, un-mounting and stopping or restarting the vm then simply copies .vmware directory into mounted directory. also purging function is available. see my GitHub repository for detail.

First, I wrote the script with tmutil which manipulates Time Machine via CLI, but it excludes virtual machines while exclusion list is empty so I stopped use it. so the script simply copies with copy task of Ant instead.

As to snapshot - I exclude it from the options because it’s not recommended for production use by VMware (VMware does not recommend running production virtual machines off snapshots on a permanent basis). additionally, they said that AutoProtect should only be used in testing environments. see http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1014509


Backup of a database server on VMware Fusion


Posted on Sunday Jan 25, 2015 at 06:05PM in Technology


There are some opinion about AutoProtect enables backup of a virtual machine with Time Machine, but I decided that I will backup my virtual machine as a regular file after shutdown. because there are some opinion that sometimes snapshots bring corruption of databases. they said that there’s possibility of occurrence of unsaved state during taking snapshots and I don’t want to corrupt my database.

But I don’t know what is difference between database servers and daily use computer? is there no possibility of serious corruption of something in daily use computers? has potentially snapshots some wrong design? is it unnecessary to force quiescing for daily use computer? doesn’t it bring crucial problems like data corruption on databases?

Googling with vmware snapshot database consistency gave me many interesting articles or discussions.

As to the procedure about backup after shutdown, following URL would be good to read:

How to mount Time Capsule from command line: