ext4dev snapshots HOWTO:
========================

This HOWTO file contains some basic examples of how to start working
with ext4dev snapshots.
For instructions how to build and install ext4dev snapshots see INSTALL file.

Getting started with snapshots:
===============================

1. Setup an ext4dev filesystem
==============================
Run the "snapshot.ext4dev mkfs" command to create a new ext4dev filesystem.

# snapshot.ext4dev mkfs /dev/1/vol1
mke2fs 1.41.14-next3-1.0.13-7 (24-May-2011)
...
# mount -t ext4dev /dev/1/vol1 /var/vol/1

The format will fail if the filesystem is smaller than 4G.

Alternatively, run the "snapshot.ext4dev on" command to convert an existing ext4 filesystem to ext4dev.

# umount /var/vol/1
# snapshot.ext4dev on /dev/1/vol1
tune2fs 1.41.14-next3-1.0.13-7 (24-May-2011)
...
snapshot feature added to /dev/1/vol1
.
# mount -t ext4dev /dev/1/vol1 /var/vol/1

The conversion will fail if the filesystem is smaller than the 4G
or if the existing ext4 filesystem has a block size other than 4K.
It is recommended to remove the journal before converting to ext4dev.

2. Take a snapshot
==================
To take a snapshot named "Monday", use the command "snapshot.ext4dev take Monday".
To view the status of current snapshots, use the command "snapshot.ext4dev stat".

# snapshot.ext4dev take Monday
snapshot /var/vol/1@Monday was created
.
# snapshot.ext4dev stat
Mounted ext4dev filesystem and snapshots:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/1/vol1          480713424    203016 456091492   0% /var/vol/1
.
Snapshots list:
id inode attributes disk-usage mtime filename
---------------------------------------------
1 21184514 Sna---o- 172.0K Feb 9 18:51 /var/vol/1/.snapshots/Monday
.


3. Mount snapshots
==================
To mount the snapshot Monday, use the command "snapshot.ext4dev mount Monday".
The snapshot will be mounted at "<ext4dev-mnt>@Monday" with read-only access.

# snapshot.ext4dev stat
Mounted ext4dev filesystem and snapshots:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/1/vol1          480713424    203020 456091488   0% /var/vol/1
.
Snapshots list:
id inode attributes disk-usage mtime filename
---------------------------------------------
1 21184514 S-a----- 176.0K Feb 9 18:51 /var/vol/1/.snapshots/Monday
.
# snapshot.ext4dev mount Monday
snapshot /var/vol/1@Monday is mounted
.
# snapshot.ext4dev stat
Mounted ext4dev filesystem and snapshots:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/1/vol1          480713424    203020 456091488   0% /var/vol/1
/var/vol/1/.snapshots/Monday
                     480713424    203016 456091492   0% /var/vol/1@Monday
.
Snapshots list:
id inode attributes disk-usage mtime filename
---------------------------------------------
1 21184514 Sna---o- 176.0K Feb 9 18:51 /var/vol/1/.snapshots/Monday
.


4. Delete a snapshot
====================
Finally, to delete snapshot Monday, use the command "snapshot.ext4dev delete Monday".

# snapshot.ext4dev delete Monday
snapshot /var/vol/1@Monday was unmounted
.
snapshot /var/vol/1@Monday is deleted
.
# snapshot.ext4dev stat
Mounted ext4dev filesystem and snapshots:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/1/vol1          480713424    202844 456091664   0% /var/vol/1
.
Snapshots list:
id inode attributes disk-usage mtime filename
---------------------------------------------
1 21184514 ----s--- 0 Feb 9 18:51 /var/vol/1/.snapshots/Monday
.


5. What else?
=============
A few more useful commands:
"snapshot.ext4dev help <cmd>" - display help on snapshot.ext4dev commands
"snapshot.ext4dev debug <n>" - set snapshot.ext4dev debug level (default=1)
"snapshot.ext4dev tests" - runs a few simple sanity tests


