Unsolved
This post is more than 5 years old
2 Intern
•
308 Posts
1
13787
November 30th, 2016 19:00
How to use the command line for backup and recovery operations on the Windows client
How to use the command line for backup and recovery operations on the Windows client
This article introduces how to use the command line on the Windows client for backup and recovery operations.
Detailed Information
As an administrator or user of Avamar, we all know that Avamar has a dedicated management console to control and manage backup and restore operations. And with the new version of the upgrade, the Avamar console interface is also more intuitive; management and operation is also easier. For Windows clients, if you have configured DTLT, we can also client-managed backup and recovery.
However, in daily work, we still encounter some requirements to help our clients with some simple backup and restore operations using the command line. As an engineer accustomed to the use of graphical interface tools, to tell the truth, I am not that familiar when it comes to performing some tasks using the command line. But since there is a demand, I have collected some commonly used commands and conducted some tests for your reference.
Those who have used our Avamar products before may have a little understanding of it, they should have also heard of the avtarprocess. It can be said that Avamar’s avtar is the core of our data transmission and everything is carried out through it. So we certainly cannot do without avtar. So first let’s understand what the Windows client avtarcan do for basic operation.
Backup --create or -c
Restore --extract or --get or -x
Delete the backup --delete
List backups --backups
List backup contents --list or -t
Verify a backup --validate
Displays the backup log --showlog
Note:
Where --backups, --list, --delete, and --showlog can run on each client or on the Avamar server with the Avamar client plug-in installed.
--create This command must be run on the client you want to back up.
--extract This command must be run on the client you need to restore to.
In addition, some commonly used parameters:
Username - id =
Password - ap = or - password =
You do not need to define this parameter if you are running on the Avamar grid.
Avamar server - server = or --hfsaddr =
This parameter does not need to be defined if the client is registered on the grid you need to contact.
Client Path - account = or --path =
Generate the log path: - logfile =
The backup number: - labelnumber = or --sequencenumber=
Only if the -validate parameter is used and is required to be defined
If not defined, then the most recent backup will be used
Backup label
This is the label for each successful backup that can be found on the Avamar console.
Backup expiration parameters: - expires =
Used to define when a backup expires
Common error:
Avtar Error <5126>: Login error 66: User not found in Avamar database.
The user name is incorrect.
Avtar Error <5126>: Login error 69: Authentication failure (Invalid password? User disabled?)
Incorrect password.
Avtar Error <5126>: Login error 74: Account not found in the Avamar database
The client path is incorrect.
Please use the full path you see in the Avamar GUI.
For example, the client name needs to be case-sensitive.
And the above error will lead to the final error as follows:
Avtar FATAL <5308>: Failed to initiate session with server
Avtar Info <6149>: Error summary: 2 errors: 5308, 5126
Avtar Info <5314>: Command failed (2 errors, exit code 10008: cannot establish connection with server (possible network or DNS failure))
Here are some common command references:
--create Reference example:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --create
This command will back up all file systems of server1 to the Avamar grid to which it is registered.
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --create C: \ test
This command will back up the C: \ test folder on server1 to the Avamar grid to which it is registered. The following is based on this command to do the test log:
Log reference annex: backup with create command.txt
After the backup is complete, the following appears on the Avamar console (label 137), because the backup expiration date is not specified and its retention is displayed as "N"
If the --expire parameter is specified, the result is as follows:
Log please refer to the attachment: Backup with create & expire command.txt
--backup Reference example:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --backups
This command will return results similar to the following:
Avtar Info <7377>: Backups for / clients / server1 as of 2013-11-06 15:47:12 Mountain Standard Time
Date Time Seq Label Size Plugin Working directory Targets
---------- -------- ----- ----------------- ---------- -------- --------------------- -------------------
2013-11-06 15:19:07 2 3K Windows c: \ avamartemp c: \ test
2013-11-06 15:17:09 1 6K Windows c: \ avamartemp c: \ test
The "Seq" column lists the "sequencenumber" or "labelnumber"
Specific log information refer to the following test results:
Log please refer to the attachment: avtar with backups flag.txt
--showlog Reference examples:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 -showlog
Log please refer to the attachment: avtar showlog flag.txt
This command prints the backup log with label 1 to the CMD window.
The log will not have wrapup information at the end.
In order to better view the log information, we can output the results to a file:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --showlog> avtarlog.log
--list Reference example
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 -list
This command will output results similar to the following:
C: \
C: \ test \
C: \ test \ avtarfilelist.txt
C: \ test \ extensions.txt
C: \ test \ diff \
C: \ test \ diff \ 1.txt
C: \ test \ diff \ 3.txt
If you only need to view the files under a directory, you can define the directory at the end of the command, for example: avtar --id = MCUser --ap= MCUser1 --path = / clients / server1 --labelnumber= 1 - Test \ diff
Log please refer to the attachment: avtar list.txt
Of course, we can also export the results to a file for easy viewing: avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 -list> filelist.txt
--extract Reference example:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --extract
This command restores all the contents of the backup with labelnumber1 to the original path.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C: \ Windows \ system32> cd C: \ Program Files \ avs\ bin
C: \ Program Files \ avs \ bin> avtar--id = MCUser --ap= MCUser1 --path = / REPLICATE / gen4s-
Util.sh.lab.emc.com/Darlene93/cnrdlid20l1c.corp.emc.com --labelnumber = 137 --extr
Act
Avtar Info <5551>: Command Line: avtar --exclude = C: \ Training --id = MCUser--passw
Ord = **************** --account = / REPLICATE / gen4s-util.sh.lab.emc.com / Darlene93 / cn
Rdlid20l1c.corp.emc.com --sequencenumber = 137 --extract
Avtar Info <7977>: Starting at 2015-03-24 12:50:49 China Standard Time [avtar Ju
N 12 2014 08:56:14 7.1.100-302 Windows 7 Enterprise Edition Service Pack 1 64-bi
T-AMD64]
Avtar Info <10793>: Single Instance Store Groveler Service NOT installed - WSS S
The IS Manager will not be started.
Avtar Info <6555>: Initializing connection (Avamar Deduplication Engine v2.0.0)
Avtar Info <5552>: Connecting to Avamar Server (10.32.167.93)
Avtar Info <5554>: Connecting to one node in each datacenter
Avtar Info <5583>: Login User: "MCUser", Domain: "default", Account: "/ REPLICATE
/gen4s-util.sh.lab.emc.com/Darlene93/cnrdlid20l1c.corp.emc.com "
Avtar Info <5580>: Logging in on connection 0 (server 0)
Avtar Info <5582>: Avamar Server login successful
Avtar Info <10632>: Using Client-ID = '91f70987c265c2c25177b5ea5ed29653b0a5e92a'
Avtar Info <5550>: Successfully logged into Avamar Server [7.2.0-316]
Avtar Info <5373>: 1 user exclude pattern entered.
Avtar Info <5295>: Starting restore at 2015-03-24 12:50:49 China Standard Time a
S "CORP \ lid20" on "cnrdlid20l1c" (4 CPUs) [7.1.100-302]
Avtar Info <19114>: --restoreshortnamesflag not specified; 8.3 names (if availa
Ble in the backup) will not be restored with files / dirs. If the target OS suppor
Ts 8.3 names, then the OS will create 8.3 names automatically.
Avtar Info <16346>: Backup # 137 created by avtarversion 7.1.100-302
Avtar Info <5949>: Backup file system character encoding is 65001 (UTF-8).
Avtar Info <8745>: Backup from Windows 7 Enterprise Edition with Service Pack 1 64-bi
T host "/REPLICATE/gen4s-util.sh.lab.emc.com/Darlene93/cnrdlid20l1c.corp.emc.com
"(Cnrdlid20l1c) with plugin 3001 - Windows Filesystem
Avtar Info <19850>: Backup # 137 timestamp 2015-03-24 12:33:33 China Standard Tim
E, 152 files, 531.1 KB
Avtar Warning <19107>: Unable to determine if there is enough disk space for the
Specified restore.
Avtar Info <5259>: Restoring backup to directory ""
Avtar Warning <6777>: Cannot translate path '' to full path, proceeding with ori
Ginal path
Avtar Info <7324>: Volume Type for "\" is "NTFS", Supports Compression = 1, Encryp
= 1, ACLS = 1, DataStreams = 1, Reparse = 1, Sparse = 1, Hardlinks = 1
Avtar Info <6694>: Not creating drive / volume / server designator 'C:'
Avtar Info <5262>: Restore completed
Avtar Info <7925>: Restored 0 bytes from selection (s) with 531.1 KB in 152 files
, 8 folders (531.1 KB in 152 files skipped)
Avtar Info <7883>: Finished at 2015-03-24 12:50:49 China Standard Time, Elapsed
Time: 0000h: 00m: 01s
Avtar Info <6645>: Not sending wrapup anywhere.
Avtar Info <5314>: Command completed (2 warnings, exit code 0: success)
C: \ Program Files \ avs \ bin>
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --extract C: \ test \ diff
This command restores everything in the C: \ test \ diff directory with a labelnumber of 1 to the original path.
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --extract --target = c: \ restore
The backup is restored to c: \ restore
In the c: \ restore will create the original path, for example: c: \ restore \ C \ test \ ...
Note: If you need to restore to another client, you need to restore the client to run the recovery command. This command is limited to restoring to a different path to the same client.
--overwrite Options:
Always: Files that already exist will be overwritten.
Modified: If the date / time value of the file in the backup is the same as that of the client, the file will not be restored.
Never: Protects client files from being overwritten.
Newest: If the date / time stamp of the file in the backup is newer than the client, it will be restored.
Newname: to restore the file, but give it a new name. For example, myfile.txt will be changed to myfile(1) .txt.
If we need to find out whether a backup contains a file:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --list | find / i "searchstring"
Replace searchstring with the name of the file you need to find, in quotation marks
The name cannot be the full name of the file, but you cannot use wildcards.
Of course, if the results are more, you can output them to a file, and then through the file editing tool to search for the file you need:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --list> backuplist.txt
Advanced recovery requirements:
Only files with certain extensions are restored:
1. First, list all the .bat files to export to a file:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --list | find / i ".bat"> batlist.txt
2. Edit the file to remove the files that do not need to be recovered
3. Then run the following command to restore the specified file:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --extract --exclude = * --include-from = batlist.txt
Use powershell to recover only new files than a specific date:
Consider the following scenario:
The file server crashes, but there are millions of files on it.
It takes a lot of time to recover all the files.
In order to restore faster, in the first stage, customers only want to restore a specific time earlier than the file
And then there is time behind the restoration of those who have not been restored files
The command first filters the eligible files and imports them into a file:
& - C: \ Program Files \ avs \ bin \ avtar.exe '--id = MCUser' '--password = MCUser1' '--path = / clients / server1' '--labelnumber = 1' '- List | '--verbose = 2' |% {$ _. Split ( "%") [1];} |% {$ _. Trimstart ();} | where {$ _ -ge "2013-08-01 } |% | $ Trimstart( "\");} | Set-Content newfiles.txt "|% | Split ( ':') [
Then restore:
& - C: \ Program Files \ avs \ bin \ avtar.exe '--id = MCUser' '--password = MCUser1' '--path = / clients / server1' '--labelnumber = 1' '- Extract '' --exclude = * '' --include-from = newfiles.txt '
After the above two commands, 2013-08-01 (yyyy-mm-dd) and their new files will be restored to the original path.
After that we can do a restore using the default override option "Never", so that only those files that have not been restored before will be restored.
Restoring system information:
Avtar --id = MCUser --ap = MCUser1 --path = / clients / server1 --labelnumber = 1 --extract --internal .system_info --target = c: \ avtar_system_info
This can be some useful Windows system information recovery, such as: machine.xml, partitiontables.xml, sessionlog, and statsfile. So when do we need to restore system information? First of all, you can see the backup time in the session log, the client's volume and basic configuration information. As the default backup log are only kept within 14 days in the client, and sometimes it may encounter recovery problems, we need to verify the backup status during that time, but no log can be queried you can restore the session log to verify, or do a BMR recovery. If you have forgotten how many disks and the size of the disks, you can refer to volumes.xml and other documents to configure.
When doing an avtar backup or restore, you can skip the MCS communication links and directly use gsan communicate.
These records are not displayed in the Avamar activity console or in the avagent.log.
Hope that the above information allows us to better understand some of our simple backup and recovery process.