o2image
DRAFT
Srinivas Eeda
December 9th, 2007
Introduction
o2image is a tool that can save OCFS2 filesystem metadata located on a device to a image-file. The image file may be examined using debugfs.ocfs2 to analyze filesystem layout affecting performance. Image file may also be used to analyze and/or restore data in catastrophic corrupted filesystems (NOTE: data may only be restored if it is intact and metadata hasn't changed since it's backup).
Image file is a sparse raw image which stores metadata at the same offsets as on the device. Since the raw image file is created as sparse it does not use space for files data (NOTE: It is critcal to store image file on a different filesystem which support sparsefile otherwise the image file uses the same amount of space as the device). An image file stores metadata blocks sequentially and consumes less space.
The -I option will cause o2image to install the metadata from image file on to the device. This can be used to restore the filesystem metadata back to the device in emergency situations.
Usage
o2image [ -rsI ] <device> <image-file>
Examples:
a) create a raw image of volume /dev/sda2
o2image -r /dev/sda2 /tmp/sda2.img
b) Create a gzip image of volume /dev/sda2
o2image -r /dev/sda1 - | gzip > /tmp/sda2.img.gz
c) viewing a gziped image file
zcat /tmp/sda2.img.gz | cp --sparse=always /dev/fd/0 /tmp/sda2.img
NOTE: gunzip is not aware of creating sparse files
d) Restore metadata from image file on to the device
o2image -I /tmp/sda2.img /dev/sda2