4

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.

1 Answer 1

1

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.

1
  • Sorry by being too late. This helped me. Thank you, kashyap.
    – Fenrir
    Commented Oct 17, 2013 at 19:11

You must log in to answer this question.

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