Posts Tagged ‘Backup’

Robust File and Folder Copy.

By default Robocopy will only copy a file if the source and destination have different time stamps or different file sizes.

 

Syntax

ROBOCOPY Source_folder Destination_folder [files_to_copy] [options]

 

Key

file(s)_to_copy : A list of files or a wildcard.

(defaults to copying *.*)

 

  Source options

/S : Copy Subfolders.

/E : Copy Subfolders, including Empty Subfolders.

/COPY:copyflag[s] : What to COPY (default is /COPY:DAT)

(copyflags : D=Data, A=Attributes, T=Timestamps

S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

/SEC : Copy files with SECurity (equivalent to /COPY:DATS).

/DCOPY:T : Copy Directory Timestamps. ##

/COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU).

/NOCOPY : Copy NO file info (useful with /PURGE).

 

/A : Copy only files with the Archive attribute set.

/M : like /A, but remove Archive attribute from source files.

/LEV:n : Only copy the top n LEVels of the source tree.

 

/MAXAGE:n : MAXimum file AGE – exclude files older than n days/date.

/MINAGE:n : MINimum file AGE – exclude files newer than n days/date.

(If n < 1900 then n = no of days, else n = YYYYMMDD date).

 

/FFT : Assume FAT File Times (2-second date/time granularity).

/256 : Turn off very long path (> 256 characters) support.

 

Copy options

/L : List only – don’t copy, timestamp or delete any files.

/MOV : MOVe files (delete from source after copying).

/MOVE : Move files and dirs (delete from source after copying).

 

/Z : Copy files in restartable mode (survive network glitch).

/B : Copy files in Backup mode.

/ZB : Use restartable mode; if access denied use Backup mode.

/IPG:n : Inter-Packet Gap (ms), to free bandwidth on slow lines.

 

/R:n : Number of Retries on failed copies – default is 1 million.

/W:n : Wait time between retries – default is 30 seconds.

/REG : Save /R:n and /W:n in the Registry as default settings.

/TBD : Wait for sharenames To Be Defined (retry error 67).

 

Destination options

 

/A+:[RASHCNET] : Set file Attribute(s) on destination files + add.

/A-:[RASHCNET] : UnSet file Attribute(s) on destination files – remove.

/FAT: Create destination files using 8.3 FAT file names only.

 

/CREATE: CREATE directory tree structure + zero-length files only.

/DST: Compensate for one-hour DST time differences ##

/PURGE: Delete dest files/folders that no longer exist in source.

/MIR: MIRror a directory tree – equivalent to /PURGE plus all subfolders (/E)

 

Logging options

/L: List only – don’t copy, timestamp or delete any files.

/NP: No Progress – don’t display % copied.

/LOG:file : Output status to LOG file (overwrite existing log).

/UNILOG:file : Output status to Unicode Log file (overwrite) ##

/LOG+:file : Output status to LOG file (append to existing log).

/UNILOG+:file : Output status to Unicode Log file (append) ##

/TS : Include Source file Time Stamps in the output.

/FP : Include Full Pathname of files in the output.

/NS : No Size – don’t log file sizes.

/NC : No Class – don’t log file classes.

/NFL : No File List – don’t log file names.

/NDL : No Directory List – don’t log directory names.

/TEE : Output to console window, as well as the log file.

/NJH : No Job Header.

/NJS : No Job Summary.

 

 Repeated Copy Options

/MON:n : MONitor source; run again when more than n changes seen.

/MOT:m : MOnitor source; run again in m minutes Time, if changed.

 

/RH:hhmm-hhmm : Run Hours – times when new copies may be started.

/PF : Check run hours on a Per File (not per pass) basis.

 

 Job Options

/JOB:jobname : Take parameters from the named JOB file.

/SAVE:jobname : SAVE parameters to the named job file

/QUIT : QUIT after processing command line (to view parameters).

/NOSD : NO Source Directory is specified.

/NODD : NO Destination Directory is specified.

/IF : Include the following Files.

 

Advanced options you’ll probably never use

/EFSRAW : Copy any encrypted files using EFS RAW mode. ##

/MT[:n] : Multithreaded copying, n = no. of threads to use (1-128) ###

default = 8 threads, not compatible with /IPG and /EFSRAW

The use of /LOG is recommended for better performance.

 

/SECFIX : FIX file SECurity on all files, even skipped files.

/TIMFIX : FIX file TIMes on all files, even skipped files.

 

/XO : eXclude Older – if destination file exists and is the same date or newer than the source – don’t bother to overwrite it.

/XC | /XN : eXclude Changed | Newer files

/XL : eXclude “Lonely” files and dirs (present in source but not destination)

This will prevent any new files being added to the destination.

/XX : eXclude “eXtra” files and dirs (present in destination but not source)

This will prevent any deletions from the destination. (this is the default)

 

/XF file [file]… : eXclude Files matching given names/paths/wildcards.

/XD dirs [dirs]… : eXclude Directories matching given names/paths.

XF and XD can be used in combination  e.g.

ROBOCOPY c:\source d:\dest /XF *.doc *.xls /XD c:\unwanted /S

 

/IA:[RASHCNETO] : Include files with any of the given Attributes

/XA:[RASHCNETO] : eXclude files with any of the given Attributes

/IS : Include Same, overwrite files even if they are already the same.

/IT : Include Tweaked files.

/XJ : eXclude Junction points. (normally included by default).

 

/MAX:n : MAXimum file size – exclude files bigger than n bytes.

/MIN:n : MINimum file size – exclude files smaller than n bytes.

/MAXLAD:n : MAXimum Last Access Date – exclude files unused since n.

/MINLAD:n : MINimum Last Access Date – exclude files used since n.

(If n < 1900 then n = n days, else n = YYYYMMDD date).

 

/BYTES : Print sizes as bytes.

/X : Report all eXtra files, not just those selected & copied.

/V : Produce Verbose output log, showing skipped files.

/ETA : Show Estimated Time of Arrival of copied files.

## = New Option in Vista (XP027) all other options are valid for the XP version of Robocopy (XP010)

### = New Option in Windows 7 and Windows 2008 R2

 

Robocopy EXIT CODES

 

File Attributes [RASHCNETO]

 

R – Read only

A – Archive

S – System

H – Hidden

C – Compressed

N – Not content indexed

E – Encrypted

T – Temporary

O – Offline

If either the source or desination are a “quoted long foldername” do not include a trailing backslash as this will be treated as an escape character, i.e. “C:\some path\” will fail but “C:\some path\\” or “C:\some path\.” or “C:\some path” will work.

 

By copying only the files that have changed, robocopy can be used to backup very large volumes.

 

ROBOCOPY will accept UNC pathnames including UNC pathnames over 256 characters long.

 

/REG Writes to the registry at HKCU\Software\Microsoft\ResKit\Robocopy

 

/XX (exclude extra) If used in conjunction with /Purge or /Mir, this switch will take precedence and prevent any files being deleted from the destination.

 

To limit the network bandwidth used by robocopy, specify the Inter-Packet Gap parameter /IPG:n

This will send packets of 64 KB each followed by a delay of n Milliseconds.

 

Open Files

 

Robocopy will fail to copy files that are locked by other users or applications, so limiting the number of retries with /R:0 will speed up copying by skipping any in-use files. The Windows Volume Shadow Copy service is the only Windows subsystem that can copy open files. Robocopy does not use the Volume Shadow Copy service, but it can backup a volume shadow that has already been created with VSHADOW or DISKSHADOW.

 

Permissions

 

All versions of Robocopy will copy security information (ACLs) for directories, version XP010 will not copy file security changes unless the file itself has also changed, this greatly improves performance.

 

/B (backup mode) will allow Robocopy to override file and folder permission settings (ACLs).

 

ERROR 5 (0x00000005) Changing File Attributes … Access is denied

This error usually means that File/Folder permissions or Share permissions on either the source or the destination are preventing the copy, either change the permissions or run the command in backup mode with /B.

 

To run ROBOCOPY under a non-administrator account will require backup files privilege, to copy security information auditing privilege is also required, plus of course you need at least read access to the files and folders.

 

Availability

 

Robocopy is a standard command in Windows 7 and above. The Windows Server 2003 Resource Kit Tools include Robocopy XP010, which can be run on NT 4/ Windows 2000. Robocopy does not run on Windows 95, or NT 3.5. (RoboCopy is a Unicode application).

 

Robocopy ‘Jobs’ and the ‘MOnitor source’ option provide an alternative to setting up a Scheduled Task to run a batchfile with a RoboCopy command.

 

Examples:

 

Copy files from one server to another including subfolders (/S)

If this command is run repeatedly it will skip any files already in the destination, however it is not a true mirror as any files deleted from the source will remain in the destination.

 

ROBOCOPY \\Server1\reports \\Server2\backup *.doc /S

List files over 32 MBytes in size:

 

ROBOCOPY C:\work /MAX:33554432 /L

Move files over 14 days old: (note the MOVE option will fail if any files are open and locked.)

 

ROBOCOPY C:\work C:\destination /move /minage:14

Backup a Server:

The script below copies data from FileServ1 to FileServ2, the destination holds a full mirror along with file security info. When run regularly to synchronize the source and destination, robocopy will only copy those files that have changed (change in time stamp or size.)

 

@ECHO OFF

SETLOCAL

 

SET _source=\\FileServ1\e$\users

 

SET _dest=\\FileServ2\e$\BackupUsers

 

SET _what=/COPYALL /B /SEC /MIR

:: /COPYALL :: COPY ALL file info

:: /B :: copy files in Backup mode.

:: /SEC :: copy files with SECurity

:: /MIR :: MIRror a directory tree

 

SET _options=/R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL

:: /R:n :: number of Retries

:: /W:n :: Wait time between retries

:: /LOG :: Output log file

:: /NFL :: No file logging

:: /NDL :: No dir logging

 

ROBOCOPY %_source% %_dest% %_what% %_options%

 

Run two robocopy jobs at the same time with START /Min

 

Start /Min “Job one” Robocopy \\FileServA\C$\Database1 \\FileServeBackupA\c$\Backups

Start /Min “Job two” Robocopy \\FileServB\C$\Database2 \\FileServeBackupB\c$\Backups

 

 

Related Posts:

Robocopy Error 5

Note: Make sure to backup the information of the tasks scheduled.

Symptoms:

–          Error while trying to open the Configured Tasks.

–          Error while trying to access the properties of the tasks.

–          Status message of tasks as: “Could not Start”

–          This normally happens in Microsoft Windows 2003 / 2003 R2

Error

Could_not_start

 

Resolution:

–          Stop the “Task Scheduler “Service.

–          Delete all the files in this path: C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\S- 1 – 5 – 18

–          Restart the Service and check if it works.

–          If not then restart the server.

–          The issue will be resolved.

Procedure to Restore the System State Backup:

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.
  2. Click Advanced Mode.
  3. Click the Restore and Manage Media tab.
  4. In the Items to restore box, expand the media that you want to restore, and then click to select the System State check box.
  5. In the Restore file tobox, specify the location where you want to restore the files by doing one of the following:
    • If you want to restore the files or folders to the same location in which they were when you backed up the data, click Original location, and then go to step 7.
    • If you want to restore the files or folders to a new location, click Alternate location.
      This option preserves the folder structure of the backed up data.
    • If you want to restore the files and folders to a single location, click Single folder.NOTE: If you do not designate an alternate location for the restored data, the restore operation erases the current system state data and replaces it with the information that you are restoring.
  6. If you selected Alternate location or Single folder, type the location in which you want the data to be restored, or click Browse and select the location.
  7. Click Start Restore.
  8. On the Confirm Restore page that appears, click Advanced if you want to set advanced restore options, and then click OK.
  9. Click OK to start the restore operation.

Procedure to Configure System State Backup:

Note: The Account must be a Domain Admin Account to perform the System State Backup.

To Back Up the System State:

To back up the system state (including the registry hives system, software, security, the Security Accounts Manager (SAM), and the default user (but not HKEY_CURRENT_USER)), follow these steps:

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.
  2. Click Advanced Mode.
  3. Click the Backup tab.
  4. On the Job menu, click New.
  5. Click to select the System State check box.
  6. In the Backup destination box, specify the destination for the new job.
  7. In the Backup media or file namebox, do the following:
    • If you are backing up to a file, specify a path and file name for the backup (.bkf) file. Or, click Browse, specify a file name and location where you want to save the file, and then click Save.
    • If the NAS is available save it to \\NASName\Backup location
    • If NAS is not available, save it to some Local Machine and make note of this local machine. Make sure that the destination location or drive has enough free space.
  8. Click Start Backup.
  9. If you want to set advanced backup options, such as data verification or hardware compressions, click Advanced. Specify the options that you want, and then click OK.
  10. Review the settings on the Backup Job Information page. Specify whether you want this backup to replace the information that is already present on the destination media, or add this backup to the existing information.
  11. Click Start Backup.

 

For Restore Procedure click here

Symptoms: The Device will be connected to the network, you will be able to ping the IP address assigned from DHCP to the device, but you will not be able to access the device using Web Interface and through network share too.

The issue resists even though you have installed the software’s provided in the CD ROM.

Resolution 1:

I found a very easy solution for the issue. As you know we have a small switch below the USB port, where it is mentioned as AUTO; ON; OFF as in the picture below (Marked)

By default the switch was on AUTO, so I was not able to access the shares and the web interface.

I changed it to ON, and the very few seconds I was able to access the shares and through web interface too.

Note: The Green Light blinks when the switch is at Auto, As soon as the Switch is changed to “ON” the Blue light starts to blink.

Resolution 2:

Reset the Device. (*IMP: Make sure you have the Data backup in other device or a computer)

–       Please switch the Device to OFF and wait until the lights are off.

–       Hold the function button for 10 seconds while it is still off.

–       While still holding the function button after 10 seconds please flip the switch to off.

–       Once the function light begins to blink release the function button and press it again for one second.

–       Wait until the power light is solid and this will restore your unit.

*This process will not delete any data and will only restore the admin password and set the IP address back to DHCP.

Also check for the Antivirus and the Firewall blocks, even they may come into picture.

Other Posts related to Backup:

Robocopy-error-5-0x00000005-changing-file-attributes-access-is-denied

What is Backup?

VM Backup

 

This error may occur if the reported folder is not accessible by the Service account on which the Backup is configured.

I use the below Robocopy command to backup my files to a network drive:

Robocopy “Source Folder” “Target Folder” /e /r:3 /w:1 /sec /mir /z /b /np /log:c:\Backup.log

As in the above syntaxes used below are the description of them:

/e: Copies subdirectories.

/r: Retry Option.

/w: Wait time.

/sec: Copies the security permission as same as the source folder.

/mir: Mirrors the directory tree. (Same as /e or /purge)

/z: Copies files in Restart mode.

/b: Copies files in Backup Mode.

/np: The progress of the copying operation will not be displayed. (% progress of each file)

/log: Creates a log file in the root directory so that you can have the details of copy.

For the error 5, it may be due to multiple reasons, include the below syntaxes to troubleshoot the error:

  1. You need to use the /FFT flag to assume FAT file times (2 second granularity). Although the target folder is Ntfs/Fat, these file systems also implement file times with 2 second granularity.
  2. You need to turn off the attribute copying. Robocopy uses the /COPY:DAT by default, which means to copy data, attributes and timestamp. You should turn off attribute copying by explicit setting /COPY:DT

This syntax should resolve the issue with Error 5 of Robocopy.

The Final Robocopy command would look like this:

Robocopy “Source Folder” “target Folder” /e /r:3 /w:1 /sec /mir /z /b /np /COPY:DT /FFT /log:c:\Backup.log

You may also get an issue where some of the automatic files generated by windows will not backup; these files may include Thumbs.db or Desktop.ini

You can exclude these file by adding the /XF syntax in the command.

You may also exclude some of the unwanted folder to be backed up from the command, for that you need to use /XD

Example command to exclude the unwanted files or folders:

Robocopy “Source Folder” “target Folder” /e /r:3 /w:1 /sec /mir /z /b /np /COPY:DT /FFT /XF *.ini thumbs.db /XD .trash /log:c:\Backup.log

Hope you have an error-free Backup 🙂

Other Posts related to backup:

https://ignitedsoul.com/2011/12/16/vm-backup-win-server-2008-r2-hyper-v/

https://ignitedsoul.com/2011/08/19/what-is-a-backup/

VM Backup – Backing up Virtual Machines with Windows Server 2008 R2 & Hyper-V

Overview

Virtual machines are basically made of files. They contain configuration files, virtual hard disks, snapshot files and saved state files. While running computers are virtual machines can benefit from virtualization, a lot of thought needs to be taken in order to protect the contents of the virtual machines and the VMs themselves, so that if something goes wrong, you can perform a pre-defined list of steps to successfully restore the VMs to a functional and running state.

Note: To install Windows Server Backup, log on to the computer by using the local Administrator account or another account with Administrator privileges. To perform backups or recoveries by using Windows Server Backup, you must be a member of the Administrators or Backup Operators groups.

Performing the backup

To perform the actual VM backup follow these steps:

1. Open Windows Server Backup from the Administrative Tools folder. In the Actions pane, click “Backup Once” (you can, of course, create a schedule for this backup).

 

2. In the “Backup Options” page, select “Different Options” and click Next.

3. In the “Select Backup Configuration” page, select “Custom” and click Next.

4. In the “Select Items for Backup” page, click “Add Items“.

5. In the “Select Items” window, click to select the volumes where the VM configuration files and VM hard disks are located. Also note that while it may look possible to select individual folders, do NOT select individual folders. Only select the entire volume. Failing to select the right volumes will result in a failure for the backup procedure and even if it will seem to you that all items were backed up, in fact you will not be able to restore your VMs. Click Ok.

6. Back in the “Select Items for Backup” page, click “Advanced Settings“.

7. In the “Advanced Settings” window, click to select “VSS Full Backup” and click Ok.

8. Back in the “Select Items for Backup” page, click Ok.

9. In the “Specify Destination Type” page, select the destination for the backup. I chose Local Drives, but you can also perform the backup on remote shares. Click Next.

10. In the “Select Backup Destination” page, use the drop-down list to select your destination. If you plan to backup on an external USB drive, make sure the computer recognizes it before you get to this spot. Also make sure that the destination volume contains enough free disk space for the backup to be place in. Remember that volume level backup are ALWAYS full, therefore if you’ve got 500 GB worth of VMs in one volume, you’ll need to have as much space as that (and preferably more) on your destination volume. Click Ok.

11. In the “Confirmation” page click Backup and let the backup procedure begin.

12. If you immediately switch to the Hyper-V management console, you’ll see that the VMs are being snapshotted. This is not equivalent to taking a Hyper-V snapshot, which in fact is not really a true snapshot and has nothing in relation to VSS snapshots. Because the VSS writer was registered, and because the Integration Services (Components) are installed and enabled on the VMs, they will be successfully backed up without being paused, saved or turned off. In addition, the ICs will inform the VMs that a backup procedure is taking place on the parent partition, so any VSS-aware application that is running inside the VM will also be triggered (which is very important for applications such as SQL, Exchange and so on).

13. Windows Server Backup begins to write the file(s) to disk.

14. When finished, click Close.

Summary

Backing up virtual machines can be a little different than backing up a traditional system.  Because a virtual machine is nothing more than a collection of files, it is important to be especially mindful of the backup process. One oversight along the way can mean a failed VM backup.  Hopefully this article has prepared you to backup your Virtual Machines with Hyper-V using Windows Server Backup.

 

 

Source: Petri

A backup is an exact copy of a file (including documentation) that is kept on a storage medium (usually in a compressed state) in a safe place (usually at a remote location) for use in the event that the working copy is destroyed. Notice that we placed emphasis on “including documentation”, because every media holding backups must include a history or documentation of the files on the media. This is usually in the form of labels and identification data on the media itself, on the outside casing, and in spreadsheets, hard catalogs, or data ledgers in some form or another. Without history data, restore media cannot locate your files, and the backup is useless. This is why you can prepare a tape for overwriting by merely formatting the label so that the magnetic head thinks the media is blank.

 

Various types of backups are possible, depending on what you back up and how often you back it up, as the following list describes:

  • Archived backup: A backup that documents (in header files, labels, and backup records) the state of the archive bit at the time of copy. The state (on-off) of the bit indicates to the backup software that the file has been changed since the last backup. When Windows Server 2008 Backup does an archived backup, it sets the archive bit accordingly.

 

  • Copy backup: An ad hoc “raw” copy that ignores the archive bit state. It does not set the archive bit after the copy. A copy backup is useful for quick copies between DR processes and rotations or to pull an “annual” during the monthly rotation

 

  • Daily backup: This does not form part of any rotation scheme. It is just a backup of files that have been changed on the day of the backup. We question the usefulness of the daily backup in Backup, because mission-critical DR practice dictates the deployment of a manual or automated rotation scheme. In addition, Backup does not offer a summary or history of the files that have changed during the day

 

  • Normal backup: A complete backup of all files (that can be backed up), period. The term normal is more a Windows Server 2008 term, because this backup is more commonly called a full backup in DR circles. The full backup copies all files and then sets the archive bit to indicate (to Backup) that the files have been backed up. You would do a full backup at the start of any backup scheme. You would also need to do a full backup after making changes to any scheme. A full backup, and documentation or history drawn from it, is the only means of performing later incremental backups. Otherwise, the system would not know what has or has not changed since the last backup.

 

  • Incremental backup: A backup of all files that have changed since the last full or incremental backup. The backup software sets the archive bit, which thereby denotes that the files have been backed up. Under a rotation scheme, a full restore would require you to have all the incremental media used in the media pool, all the way back to the first media, which contains the full backup. You would then have the media containing all the files that have changed (and versions thereof) at the time of the last backup.

 

  • Differential backup: This works exactly like the incremental, except that it does not do anything to the archive bit. In other words, it does not mark the files as having been backed up. When the system comes around to do a differential backup, it compares the files to be backed up with the original catalog. Differential backups are best done on a weekly basis, along with a full, or normal, backup, to keep differentials comparing against recently backed up files.