How to backup to removable storage: RoboCopy and PowerShell

PowerShell script exchange

Re: How to backup to removable storage: RoboCopy and PowerShell

Veeam Logoby Gostev » Mon Jan 11, 2010 4:27 pm

Sure, you could absolutely do that.

I think I should also mention the following new feature here in this thread for future readers:
v4.1 Support for rotated media
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: How to backup to removable storage: RoboCopy and PowerShell

Veeam Logoby Rich » Mon Jan 11, 2010 4:49 pm

Thanks for the prompt response, I'll read up on v4.1 features re rotated media.

I understand every environment is different, however, typically - how will Veeam file copy throughput compare vs standard Windows file copy utilities i.e. Robocopy?
Rich
Novice
 
Posts: 6
Liked: never
Joined: Fri Nov 27, 2009 9:37 am
Full Name: Richard Main

Re: How to backup to removable storage: RoboCopy and PowerShell

Veeam Logoby Gostev » Mon Jan 11, 2010 5:06 pm

Windows performance will be similar to other tools... but there are definitely no issues with performance, because this would affect the speed of backups to Windows/CIFS.

Linux file copy performance is where our file copy engine really shines comparing to other existing tools. :D
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: How to backup to removable storage: RoboCopy and PowerShell

Veeam Logoby Rich » Tue Jan 12, 2010 9:55 am

Hi Gostev - initial tests show a marked difference between veeam 'File Copy' vs Robocopy performance. Using Veeam to copy a 1Gb file from onboard Veeam server disks to USB hard drive took 3 minutes, vs 40 seconds for Robocopy. I realise this is a crude test, however, wasn't expecting this variation. We'll continue to use Robocopy to copy Veeam backups to cycled USB drives, your thoughts on Veeam 'File Copy' performance would be appreciated though. Thanks again.
Rich
Novice
 
Posts: 6
Liked: never
Joined: Fri Nov 27, 2009 9:37 am
Full Name: Richard Main

Re: How to backup to removable storage: RoboCopy and PowerShell

Veeam Logoby Gostev » Tue Jan 12, 2010 11:29 am

Richard, have you done one test after another? If so, the second test would use Windows system cache, this would explain the difference. Anyhow, I am not saying File Copy for Windows is brilliant because we never ever done performance testing with it, so it may have issues. Our primary use case for file copies is between Windows and Linux/ESX.
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: How to backup to removable storage: RoboCopy and PowerShell

Veeam Logoby Gostev » Tue Jan 12, 2010 12:34 pm

We've done just done a quick clean test with 2 different 1GB VBK files and tried to copy both with Windows Explorer and with File Copy job, and the time was about the same (Windows Explorer was a few seconds faster): around 1 min 20 sec.
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: How to backup to removable storage: RoboCopy and PowerSh

Veeam Logoby broadview » Wed May 19, 2010 9:36 pm

You could also use a .vbs script to send the email without needing to install powershell, I am doing this in many instances on many of my systems.
Seems a little more stable and less dependent on the user credentials running the script.

Here is an example of one script I use (Unrelated) that sends email:

Code: Select all
'Monitoring servers free disk space
'
'Build an array of the computer names to monitor free space on multiple servers
'Query those computers for all local, active hard disks and get their Drive letter and free space in MBs
'Trap errors if any of the computers are not on or unable to be contacted, note error description, continue
'Authenticate with SMTP Server
'Send email with all gathered information to IT
'

'drive types
Const Unknown = 0
Const Removable = 1
Const FLOPPY = 2
Const HDD = 3
Const NETWORK = 4
Const CD = 5

'Setup mail parameters
Sub SendMail(Sender, Recipient, Subject, Message)
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Subject
objMessage.From = Sender
objMessage.To = Recipient
objMessage.TextBody = Message

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.domain.com"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user@domain.com"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "PASSWORD"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send
End Sub

'get current computer name (from system environment variables)
Function GetCurrentComputerName
set oWsh = WScript.CreateObject("WScript.Shell")
set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
End Function

str = ""
Dim strComputer(14)
strComputer(0) = "Altigen"
strComputer(1) = "BACKUP"
strComputer(2) = "COPIERPC"
strComputer(3) = "Corp3"
strComputer(4) = "dc1"
strComputer(5) = "FS1"
strComputer(6) = "FS2"
strComputer(7) = "FS3"
strComputer(8) = "MS1"
strComputer(9) = "MV"
strComputer(10) = "TS1"
strComputer(11) = "QB"
strComputer(12) = "VC1"
strComputer(13) = "VC2"
strComputer(14) = "VCS1"

dim errorstr
Dim size
Dim free
Dim pct
Dim vol
Dim dlet 'Drive Letter
dim voldlet

For Each strComputer in strComputer
  On Error Resume Next
  Err.Clear
  Set objWMIService = GetObject("winmgmts:{impersonationLevel=Impersonate}\\" & strComputer & "\root\cimv2")
  Set colDisks = objWMIService.ExecQuery _
  ("Select * from Win32_LogicalDisk Where DriveType = " & HDD & "")
  If Err > 0 then str = str & vbcrlf & "Server: " & strComputer & " ***Error*** " & Err.Description & vbcrlf
  If Err < 1 then str = str & vbcrlf & "Server: " & strComputer & vbcrlf
    For Each objDisk in colDisks
      if (not isnull(objDisk.FreeSpace)) and (not objDisk.VolumeName = "PAGEFILE") then
        If Err < 1 then
        size = FormatNumber(CLng(objDisk.Size/1024/1024),0)
        free = FormatNumber(CLng(objDisk.FreeSpace/1024/1024),0)
        pct = FormatNumber((free * 100 / size),2)
        vol = objDisk.VolumeName
        dlet = objDisk.DeviceID
      voldlet = vol & " (" & dlet & ")"
      'if pct < 20 then
      '   errorstr = "***ERROR"
      'end if
        str = str & vbTab & voldlet
      if len(voldlet) > 24 then
         str = str & vbTab
      else
         str = str & vbTab & vbTab & vbTab
      end if
      str = str & "Size = " & size & " MB" & vbTab & "Free = " & free & " MB" & vbTab & "Pct Free = " & pct & "%" & vbcrlf
        end if
      end if
    Next
 Next

str = str & vbcrlf & vbcrlf & "This report was generated by ""V:\Scripts\Server Available Drive Space Report.vbs"" run via scheduled tasks on FS1"

'Send the email
SendMail "sender@domain.com","recip@domain.com", "Server Available Drive Space Report", str
broadview
Lurker
 
Posts: 2
Liked: never
Joined: Mon Mar 01, 2010 5:38 pm
Full Name: Broadview Mortgage

Re: How to backup to removable storage: RoboCopy and PowerSh

Veeam Logoby bruc2082 » Mon Feb 04, 2013 6:36 pm

I need help with rotating media. I have a nice Robocopy script configured, however, I do not know how to configure Veeam to call it up. Anybody know how to set this up? Below are the two Robocopy commands for the two backup jobs I have.

robocopy "F:\01 Local Linux VM Backups" "E:\01 Local Linux VM Backups" /COPYALL /PURGE /E /XO /W:1 /IPG:15 /NP /NDL /R:1 /B

robocopy "F:\01 Local Windows VM Backups" "E:\01 Local Windows VM Backups" /COPYALL /PURGE /E /XO /W:1 /IPG:15 /NP /NDL /R:1 /B
bruc2082
Lurker
 
Posts: 1
Liked: never
Joined: Mon Feb 04, 2013 6:26 pm
Full Name: Jason Bruce

Re: How to backup to removable storage: RoboCopy and PowerSh

Veeam Logoby v.Eremin » Tue Feb 05, 2013 8:38 am

Hi, Jason.

Please, be aware that you can only specify *cmd,*exe or *bat files as the job post-activity. So, you’ll have to either convert your powershell script into a batch file (powershell-script-in-a-bat-file) or just execute your PowerShell script from a batch file, using the following command:

Code: Select all
Powershell.exe -File C:\YourScript.ps1

Hope this helps.
Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 7 guests