Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux guest with two disks for / and /home. /home is a write-through disk to keep data safe of snapshot restoring.

The problem is that the live snapshot corrupts /home data when restoring it. Probably this is caused by linux cache, because if I add some changes to /home and then I restart the machine, the changes are still there. I have tried to mount /home with the option sync, but this didn't solve the problem.

These are the steps to reproduce it:

  1. Start a guest linux with a write-through disk mounted as /home
  2. When you are logged in to your account, take a live snapshot
  3. Create a file in /home, e.g. $ echo 1 > ~/test.txt
  4. Close the machine and restore the new created snapshot.
  5. Start again the machine.
  6. $ ls -l ~/
  7. The file test.txt has disappeared...
  8. If you remount /home you will find it but corrupted. A $ ls -l ~/ will show you something like
    -????????? ? ? ? ? ? test.txt

Is there any way to solve this problem?

Thank you.

share|improve this question
up vote 1 down vote accepted

You'd need to use filesystem for /home that is freezable and thereby snapshot friendly. XFS has a very reliable freeze/unfreeze mechanism. So if you format your /home partition with xfs, you could use the following procedure.

$ xfs-freeze -f /home
<do the snapshotting>
$ xfs-freeze -u /home

I haven't tried this with virtualbox but we do something very similar on our production database instances for taking snapshots of our mysql db.

share|improve this answer
    
Sorry by being too late. This helped me. Thank you, kashyap. – Fenrir Oct 17 '13 at 19:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .