Skip to content

ext4 writable snapshot

YANGYongqiang edited this page Aug 20, 2012 · 20 revisions

ext4 writable snapshot provides writable snapshot based on ext4 snapshot, which can be visited at http://sourceforge.net/apps/mediawiki/next3/index.php?title=Ext4_snapshots_TODO. It is a project of GSoC 2012 accepted by openSUSE and I am honored to be mentored by Amir Goldstein [email protected]. Many thanks to Google, openSUSE and Amir. Any suggestions or feedback are welcome by [email protected] :-)

For Users

1. How to create a writable snapshot

ln command is used to create a writable snapshot, so it is impossible to create a hard link to a snapshot file. For example, ln S C creates a writable snapshot C for snapshot S. S can only be mounted in read-only mode while C can be mounted in read-write mode.

2. Current writable snapshot's status

Writable snapshot basically works, but it is not stable.

For developers

1. How writable snapshot works

Actually, the command creates a snapclone file C in whose inode stores snapshot's inode number. Reads and writes on snapclone work like snapshot files. In other words, if a block is not mapped in snapclone, it is read through to snapshot file, otherwise the block is directly read from the snapclone file. Writes are written to snapclone directly.

2. group counters fixing

We need to fix free block counters of block groups inside writable snapshots, because snapshots block bitmaps are fixed on-the-fly to clear "excluded" block bits, but free blocks counters are not fixed on-the-fly.

3. TODO

Anyone who is interested in filesystem is welcome to help us strengthen ext4 snapshot. Below are the things you can do at the beginning as a warm up dumping into ext4 snapshot.

  • Now an in-memory snapclone inode stores pointer to a snapshot inode via orphan list's prev field, which is a hacky way, and a non-hacky way is needed.
  • Recursive is not tested and I have no idea if it works,
  • Writable snapshot is not tested heavily, so some better tests are welcome.
  • Merging writable snapshot into OpenSUSE.
  • Implement correct deletion of snapshots with clones