Virtual Server Restore from Backup Fails When Symbolic Link is Encountered (All Rails Websites)

This is my first attempt at restoring Virtualmin virtual servers from backup and I’m hitting some snags. We’ve restored several “vanilla” virtual servers (migrated to a freshly built server) that have run fine, but each virtual server we’ve tried to restore that was hosting a Ruby on Rails website fails on extracting home directory contents because of the symlinks used in a Rails app’s deployment.

  • Backup was created as a .tar file for a single virtual server
  • The backup was sent to an FTP server for archival
  • The backup was restored on a new web server from the same FTP server
  • The virtual site is used to host a Ruby on Rails application that was deployed with Capistrano

On restoring the backup, everything works fine until the restore gets to the point at which the home directory contents are recreated. At that point we get:

Extracting TAR file of home directory ..
.. TAR failed!

/bin/tar: ./NameOfRailsApp/current: Cannot open: File exists
/bin/tar: Exiting with failure status due to previous errors

The file in question (./NameOfRailsApp/current) is a symbolic link that points to (for example) ./NameOfRailsApp/releases/20110803204710 which is a directory that contains the latest release of the application. This is important because when deploying a rails app with Capistrano, the deployment script updates symbolic links in multiple places to track the current version to be served, maintain persistent user data across versions (e.g. photo uploads), etc…

I’m really not sure why this would be a problem. This is a fresh restore for a site that does not exist at all on the server. I’m concerned that we would be unable to restore data for any of our rails customers without manually recreating the virtual server. Is there something I’m doing wrong here or something I can do to fix this?

Any thoughts anyone has would be very much appreciated!