Moving Large Directories on Solaris

When moving or copying really really large directories on Solaris, you can sometimes run into trouble, especially when some of the files in those directories are larger than 8 Gigabytes. One solution is to use a “ufsdump pipe to ufsrestore” command, but I have even had problems with this from time to time. My perfered method these days is to use a “tar pipe to tar” command. Be aware, however, that on Solaris you will need to include the “E” flag if the directory you are copying contains files larger than 8 Gigabytes.

Here is an example. Simply “CD” into the directory you want to copy and execute the following command, replacing “/new/directory” with path to the new destination directory.

tar cpBEf - * | (cd /new/directory; tar xBEf -)

WordPress Backup Script

I wrote this little script the other day to back up my WordPress install. Because I use Navicat, I had always been pretty good about backing up the database, but I didn’t backup the install base nearly as often as I should have. I’m sure it won’t be useful for everyone because it requires access to the command line, and mysqldump, but it’s nice to know that my blog is getting backed up.

It’s really just a simple shell script that is executed nightly by cron. You can set up the backup directories in any way you like, but if you store your database backups in a subdirectory of the WordPress install, make darn sure that the directory is not readable by the web server.

The example below assumes the following:

  • WordPress (your web root) is: /webserver/wordpress
  • Your dumps directory is: /home/backups/wp-backups
  • The name of your WordPress database is wpdata
  • Your WordPress database user is: dbuser
  • Your WordPress database password is: dbpassword

Remember to change these variables for your install.

———-SNIP———-
#!/bin/sh
Date=`date “+%Y-%m-%d”`;
echo “Creating Database Backup”;
mysqldump -u dbuser -pdbpassword wpdata | gzip > /home/backups/wp-backups/wordpress-$Date.sql.gz;
echo “Done”;
echo “Creating Filesystem Backup”;
cd /webserver/;
/usr/bin/tar -czf /home/backups/wp-backups/wordpress-$Date.tgz wordpress;
Echo “Done”;
echo “Backup Complete”;
———-/SNIP———-

Each time the script is run, it will create two timestamped files in /home/backups/wp-backups. The first one: wordpress-TIMESTAMP.sql.gz is a compressed export of your database. The second file: wordpress-TIMESTAMP.tgz is a compressed tar archive of your WordPress install.