metastore: backup filesystem metadata

diskLet’s say you moved a directory of files from Linux to your FAT32 pen drive temporarily. The ownership, permissions etc. of the contents would be lost. What if you want to retain them along with the data? metastore is another useful tool than can be added to our list of filesystem metadata backup utilities.

metastore works with files, directories and links in a file tree. It can backup and restore the following attributes of a file:

  • owner
  • group
  • permissions
  • xattrs
  • modification time (optional)

metastore can also

  • show stored and current metadata diff to track any modificaitons
  • recreate missing empty directories
  • remove extra empty directories

The intention of writing metastore was to cover for the limitation of git, which does not store metadata.

Installation

metastore is available in the default Ubuntu repos. However, the version is dated and the utility got several updates recently. Run the following commands to fetch the latest development version and compile it on Ubuntu:

$ sudo apt-get install libbsd-dev
$ git clone https://github.com/przemoc/metastore
$ cd metastore
$ make
$ sudo make install

Usage

$ metastore --help
Usage: metastore ACTION [OPTION...] [PATH...]

Where ACTION is one of:
  -c, --compare            Show differences between stored and real metadata
  -s, --save               Save current metadata
  -a, --apply              Apply stored metadata
  -d, --dump               Dump stored (if no PATH is given) or real metadata
                           (if PATH is present, e.g. ./) in human-readable form
  -V, --version            Output version information and exit
  -h, --help               Help message (this text)

Valid OPTIONS are:
  -v, --verbose            Print more verbose messages
  -q, --quiet              Print less verbose messages
  -m, --mtime              Also take mtime into account for diff or apply
  -e, --empty-dirs         Recreate missing empty directories
  -E, --remove-empty-dirs  Remove extra empty directories
  -g, --git                Do not omit .git directories
  -f, --file=FILE          Set metadata file (./.metadata by default)

Examples

Create a meatadata (with modification time) backup of current directory in a specific file (default ./.metadata):

$ metastore --s . -f output

Restore the metadata:

$ metastore -a -m . -f output

Rating

Features: 4/5
Usability: 4.5/5

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s