Skip to content

pbs-plus/go-mtf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-mtf

Go Reference

A pure-Go library for reading Microsoft Tape Format (MTF) streams - the format produced by NTBACKUP.EXE and commonly found in .bkf backup files.

Features media spanning, transparent decompression, sparse reconstruction, Media Based Catalog parsing, and near-zero-allocation classification.

Features

  • Typed block iterator - Next yields media/set/entry/set-end blocks; a medium's role is self-evident from the sequence.
  • Faithful extraction - NTFS security descriptors, extended attributes, sparse maps, and every remaining stream are auto-materialized onto the Header; sparse files are reconstructed (holes zero-filled).
  • Transparent decompression - Stac LZS (MTF_LZS221) and the compression/encryption frame layer; encryption via a pluggable decryptor (the spec defines no cipher).
  • Multi-media spanning — reassembles a data set split across media, including mid-file splits. The Continuation callback gives the application full context (tape name, family ID, sequence) to prompt an operator.
  • Media Based Catalog - standard Type 1 Set Map / File/Directory Detail parsing, auto-detected Backup Exec XML catalogs, and a becatalog companion for vendor-specific payloads.
  • Media family identification - Family() combines the TAPE block and Set Map to tell you the family ID, total tape count, and which data sets live on which tapes. Essential for the "I have one tape, what do I need?" use case.

Quick start

r, err := mtf.Open("backup.bkf")
if err != nil { log.Fatal(err) }
defer r.Close()

for {
	b, err := r.Next()
	if err == io.EOF { break }
	if err != nil { log.Fatal(err) }

	switch b.Kind {
	case mtf.KindEntry:
		fmt.Println(b.Header.Name)
		if b.Header.Type == mtf.EntryFile {
			io.Copy(os.Stdout, r) // stream file content
		}
	case mtf.KindSetEnd:
		fmt.Println("data set ended; catalog:", b.Catalog != nil)
	}
}

Documentation

Full reference lives in docs/:

Command-line tools

These are small utilities built on the library, primarily for surveying archives:

Tool Purpose
cmd/bkfscan Parallel .bkf surveyor using Census.
cmd/bkfcensus Single-file Census reporter.
bkfscan /mnt/archive/BEData          # survey

Project layout

go-mtf/
  mtf.go          public types & constants
  reader.go       the block iterator
  header.go       field accessors & offsets
  strings.go      MTF string decoding
  datetime.go     date/time decoding
  streams.go      data-stream materialization & sparse
  catalog.go      Media Based Catalog (standard)
  spanning.go     multi-media continuation
  compress.go     compression/encryption frames
  lzs.go          Stac LZS decompressor
  census.go       cartridge classification
  becatalog/      Backup Exec XML catalog parser
  cmd/            bkfscan, bkfcensus (survey utilities)
  docs/           detailed documentation

License

MIT. See LICENSE.

About

A pure-Go library for reading Microsoft Tape Format (MTF) streams

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages