Click here to Skip to main content
11,496,146 members (315 online)
Click here to Skip to main content

Reading MTF Backup Files

, 4 Apr 2007 CPOL 63.2K 1.1K 31
An article explaning how to read backup files created with the Microsoft Tape Format (MTF) specification.
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.

Screenshot - BackupReader.gif

Introduction

We use the NTBackup utility to backup our files at the office. Recently, one of the backup files turned out to be corrupt. Searcing for a solution, I came upon William T. Kranz's freeware ntbkup utility. Although ntbkup did a great job recovering the backup file, it is a command line utility. So, I decided to write a backup reader with a GUI.

Background

Volume, file, and folder information in a MTF backup file is stored as so called Descriptor Blocks. MTF is a linear file format. Reading a MTF backup file is a straightforward process. A backup file contains Data Set Descriptor Blocks, which are followed by Volume Descriptor Blocks. Volume Descriptor Blocks are followed by Directory Descriptor Blocks, which are in turn followed by File Descriptor Blocks.

Each descriptor block is followed by one or more Data Streams. Data streams are used for various purposes. They can be used for padding, storing checksums, long file/folder names, etc. One or more data streams associated with a file descriptor block typically contain file data.

Using the code

To read a backup file, an implementation creates a new instance of the CBackupReader class, passing the name of the backup file as an argument. Then, a catalog is created using the CCatalogNode class. The CCatalogNode class has a tree structure. The root of the tree is the backup file itself. Its child nodes represent the data sets in the backup file. Each data set node contains one (and only one) volume node. Volume nodes contain folders and files as child nodes. To extract a file from the catalog, one traverses the tree to reach the file and calls the ExtractTo method of the CCatalogNode class.
// Open the backup file
CBackupReader mFile = new CBackupReader(mFileName);
// Read the catalog
CCatalogNode node = mFile.ReadCatalog();
// Extract a node from the catalog
node.ExtractTo(mFile, mTargetPath); 

Limitations

  • Backup Reader was tested with a few relatively small backup files. The largest backup file tested was about 2 GB.
  • Compressed and encrypted archives are not supported.
  • Backup Reader works on Windows archives only. Although descriptor block definitions for other operating systems are included in the source code, they are not tested.
  • Archives that span multiple tapes/disks are not supported.

References

  1. ntbkup - William T. Kranz's freeware backup utility
  2. MTF specification and a Linux backup reader with C source code

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ozgur Ozcitak

Turkey Turkey
No Biography provided

Comments and Discussions

 
GeneralError on Backup Reader Pin
YasharGhassemi18-Apr-10 3:05
memberYasharGhassemi18-Apr-10 3:05 
QuestionHow can I use this code to read SQL SERVER BACKUP Files (*.bck)? Pin
VENKAT SEERLA10-Feb-10 21:35
memberVENKAT SEERLA10-Feb-10 21:35 
GeneralCompile this code Pin
ananon10-Jan-09 10:54
memberananon10-Jan-09 10:54 
GeneralIs it compatible with Veritas BKF Structure Pin
Maverick Debasish31-Dec-08 23:59
memberMaverick Debasish31-Dec-08 23:59 
GeneralRe: Is it compatible with Veritas BKF Structure Pin
Ozgur Ozcitak6-Jan-09 1:54
memberOzgur Ozcitak6-Jan-09 1:54 
GeneralRe: Is it compatible with Veritas BKF Structure Pin
Maverick Debasish6-Jan-09 6:04
memberMaverick Debasish6-Jan-09 6:04 
Generalerror to compile Pin
icelso20066-Oct-07 13:18
membericelso20066-Oct-07 13:18 
GeneralRe: error to compile Pin
r_stevenz24-Nov-08 16:07
memberr_stevenz24-Nov-08 16:07 
QuestionAny help will be appreciated Pin
SaeidehV30-Sep-07 23:34
memberSaeidehV30-Sep-07 23:34 
GeneralSQL MTF Pin
DanielSass2-Sep-07 5:30
memberDanielSass2-Sep-07 5:30 
GeneralRe: SQL MTF Pin
Ozgur Ozcitak13-Sep-07 21:58
memberOzgur Ozcitak13-Sep-07 21:58 
Questionlicense ? Pin
seb900025-Jul-07 6:54
memberseb900025-Jul-07 6:54 
AnswerRe: license ? Pin
Ozgur Ozcitak1-Aug-07 4:45
memberOzgur Ozcitak1-Aug-07 4:45 
GeneralPossible Bug Pin
winki_14-May-07 5:49
memberwinki_14-May-07 5:49 
GeneralRe: Possible Bug Pin
Ozgur Ozcitak6-Jun-07 2:13
memberOzgur Ozcitak6-Jun-07 2:13 
QuestionMerhaba [modified] Pin
bukos21-Apr-07 14:12
memberbukos21-Apr-07 14:12 
AnswerRe: Merhaba Pin
Ozgur Ozcitak3-May-07 1:39
memberOzgur Ozcitak3-May-07 1:39 
GeneralRe: Merhaba Pin
bukos3-May-07 11:21
memberbukos3-May-07 11:21 
QuestionReverse action code ? Pin
dss.manager9-Apr-07 1:12
memberdss.manager9-Apr-07 1:12 
AnswerRe: Reverse action code ? Pin
ozgurozcitak9-Apr-07 6:06
memberozgurozcitak9-Apr-07 6:06 
GeneralMany Thanks! Pin
CrnlJohnSmith28-Mar-07 16:06
memberCrnlJohnSmith28-Mar-07 16:06 
Generalthanks for this nice tool. Pin
volkan.ozcelik22-Mar-07 6:18
membervolkan.ozcelik22-Mar-07 6:18 
GeneralRe: thanks for this nice tool. Pin
ozgurozcitak27-Mar-07 4:28
memberozgurozcitak27-Mar-07 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 4 Apr 2007
Article Copyright 2007 by Ozgur Ozcitak
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid