NetWorker: Using uasm for save and recovery
Summary: This Article describes several uses for the NetWorker uasm command, which underlies save and recover data encoding and decoding operations. It can be used for performance testing by isolating specific datapath activities and for troubleshooting operations. Finally, it can be used as a low-level recovery assistant for damaged savesets sometimes. ...
Instructions
About uasm
The uasm command is a low-level utility used by NetWorker for encoding any sort of data using external data representation (XDR). It underlies the save and recover utilities and while it is not used in common scenarios, it has various uses which this article describes:
- Impromptu save, recovery of move of NetWorker index file systems.
- Testing the read or write speed of a data source on a client, without other software or network overhead.
- Recovering data from damaged save sets (tape, in particular).
uasm command is not strictly supported for normal NetWorker recovery operations. This information is provided as a means to perform complex manual recovery operations on problem save sets or for testing purposes. uasm cannot be expected to recover non-file system backups due to the index and multi-save set dependencies in more complex save sets, such as databases.
Saving or moving index file systems:
NetWorker Index file systems have special properties and the recommended way to move them is using uasm. See NetWorker: How to Move a Client File Index to a New Location for complete details. Assuming you have access from the command line to both the source and destination file system, run the command:
uasm -s -i /nsr/index/client_name | uasm -r -m "/nsr/index"="/new_index_path"
Replace /nsr/index/client_name with the full path of the index or source folder. In the -m argument, replace the parent folder (/nsr/index) with the source parent folder, and the destination parent (/new_index) with the appropriate location for the folder to copy (client_name).
Testing save read speed from source data:
To test the host disk subsystem's data transfer speed to uasm for encoding, run a uasm save and discard the data immediately to isolate source read performance:
Linux
date +%FT%T; uasm -s -i <source_directory> > /dev/null 2>&1; date +%FT%T
Windows
time /t & uasm -s -i <source_directory> > NUL 2>&1 & time /t
Recovering from scanner-created files:
For tapes which have bad spots or other partial save set damage, it may become necessary to use uasm to recover from the files created by scanner. See NetWorker: Using the scanner utility for more information about how to bypass the recover command and NetWorker's normal workflow to produce uasm-recoverable scanner_file save set dumps.
UNIX file systems cannot be recovered to Windows file system, and conversely. To recover a scanner-generated file, first run uasm to ensure that the file is viable, and determine the path hierarchy in the saveset:
uasm -rnv < scanner_file
Once the path is known, you can run the recover by redirecting from the original_path of the saveset to a recovery_path of your choosing, which will be re-created if it does not already exist:
uasm -rv -m "original_path"="new_path" < scanner_file
If the path is already known, you can specify it directly as part of the uasm command to only recover the file or directory argument supplied. This can be used with the -m path redirection switch, or not. The recover path provided is case-sensitive.
uasm -rv "/etc"="/tmp/etc" /etc/hosts < scanner_file
This method can also be used in a pipeline directly from the scanner command, if disk space is not available to create a scanner save set file. You can pipe the scanner command directly to any of the above uasm examples, as appropriate, with the same scanner command used to create a scanner save set file, but instead of redirecting to file, pipe to uasm, for example:
scanner -S saveset_id device_path | uasm_command
Additional Information
In some cases, it may become necessary to test with non-NetWorker tools in order to disprove NetWorker's involvement with an issue. Although uasm is very low level and generally should be a sufficient speed or reliability test to remove most of the NetWorker framework from investigation, using OS-native tools can be desirable where environmental issues are suspected.
Windows
- Create a batch file for execution. This facilitates the use of Windows'
cmd.exedelayed environment expansion.
@echo off
setlocal enableextensions
setlocal enabledelayedexpansion
echo START: %DATE%_%TIME%>test.log
for /f "tokens=*" %%A in ('dir /b /s /a-d X:\test') do @echo !DATE!_!TIME!: %%A >> test.log & @type "%%A" > NUL 2>>C:\temp\test.log
echo STOP: %DATE%_%TIME%>>C:\temp\test.log
- Note that in this case, the '
C:\test' within parentheses should be replaced with the actual path, or the script should be executed from the path desired to test backup for. - Note that '
test.log' should be replaced in both instances for the output file. It will contain only the errors from the operation along with start / stop timestamps per file. Since we are using the 'type' command in this case, this is a pure file read attempt using the Windows-native command.\
Linux
- Linux behaves similarly, though it is not necessary to create a script file unless reusability is expected and desired. A loop is not necessary but preferred since it will enumerate all files prior to processing and attempt to read them as well.
catreplacestypebut performs the same function (OS-native file read):
echo "START: $(date +%F_%T)">test.log; while read FSO; do echo "$(date +%F_%T): ${FSO}">>test.log; cat -A ${FSO}>/dev/null 2>>test.log; done <<<$(find /proc -type f); echo "STOP: $(date +%F_%T)">>test.log <<< $(find /test -type f)
- Again, replace
/testand/test.logwith paths appropriate to the test. Generally this test is suitable for testing both network stability and performance outside of NetWorker by reading the file in the path and emptying them to the null device immediately.