Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to set up a simple but effective solution to make a backup of my rackspace cloud servers. These servers each run subversion, trac, and some database-backed custom php applications.

My idea is to set up a LVM and mount a volume under, say, /srv. In this volume, I keep the data from all applications. Instead of caring about how to back-up each app in a different way (svn hotcopy, trac-admin hotcopy, huge mess for mysql), I simply take an LVM snapshot and back this one up cloud files using the excellent cloudcity script (http://github.com/jspringman/cloudcity/blob/master/cloudcity).

The advantage of this solution is that it is quick and easy, and LVM allows to make decent backups. As more apps are added, it should not be required to change the backup script much.

The downside, and main point of my question here, is that I am not sure how to get LVM working on Rackspace cloud, because there is only one root volume and no service like Amazon's EBS. I was thinking it may be possible to create a large empty file and use this as a "physical volume".

Has anybody done anything like this before? Or do you know why it can never work? It would be great to hear from you.

Thanks,

batrick

share|improve this question

2 Answers 2

up vote 2 down vote accepted

It can be done via loopback. Here is a small example of a script that uses LVM within a file; the techniques used can easily be adapted for your purposes.

share|improve this answer
    
thanks, it seems to work! –  batrick May 22 '10 at 21:17

Keep in mind, that LVM snapshot can significally decrease write performance. In your situation this is probably not a concert.

Another importatn thing: if you take a snapshot of filesystem, mysql backup can be in inconsistent state, becouse some data can still be in memory buffers and not have been written to disk yet. Proper way of backing up mysql with lvm snapshot is described here. In the worst case you can get corrupted database.

Tip: to create shapshot, you should have some free space in you volume group to copy changed extents (shapshots are created by Copy on Write strategy).

share|improve this answer
    
i was not aware of the first problem, thanks for the pointer i will look into it. on the second, my thinking is to use mylvmbackup, which is readily packaged for my distribution (ubuntu). mylvmbackup will be called with backup type "none", so it only takes care of locking the tables before creating the snapshot. for svn, and trac's sqlite, there is no similar mechanism, unfortunately. –  batrick May 22 '10 at 23:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.