Comprehensive data protection for all workloads
Post Reply
TheWaterbug
Enthusiast
Posts: 29
Liked: 2 times
Joined: Dec 06, 2019 7:29 pm
Full Name: Steven Kan
Contact:

Setting up and seeding two rotated hard drives?

Post by TheWaterbug »

I want to rotate 2 USB HDDs in my offsite repository, for air-gapping purposes:

Image

I've read through the instructions on Backup Repositories with Rotated Drives a few times, and I'm still not quite sure how to do the initial setup.

The remote box, Backup4, is actually in my main office right now, because I'm seeding it with a Backup Copy job from the main Veeam box, Backup3. I added Backup4 as a Managed Server, and Populated it with USB Ext HDD1, currently connected as Backup4's D: drive. USB Ext HDD2 is currently connected as Backup4's E: drive.

When it's finished with USB Ext HDD1, how do I introduce it to USB Ext HDD2? How will it know to use it as part of the same repository? How will it know to use it at all, as opposed to say USB Ext HDD3 that might get plugged in at some later point, but not for the purposes of being part of the rotating set?

Should I disconnect USB Ext HDD1, connect USB Ext HDD2 and ensure that it gets assigned as D:? And then after that will it matter what the drive letter is?

Can I also seed USB Ext HDD2 by just copying then contents of USB Ext HDD1\Backup to USB Ext HDD2\Backup before assigning it as D: and then letting the job run?

I want to get the rotating repository set up and seeded over GbE before bringing it home where the speed drops to 20 Mbps.

Thanks!
haslund
VeeaMVP
Posts: 839
Liked: 149 times
Joined: Feb 16, 2012 7:35 am
Full Name: Rasmus Haslund
Location: Denmark
Contact:

Re: Setting up and seeding two rotated hard drives?

Post by haslund »

First, make sure you ticked the checkbox on the backup repository to enable rotating disks as described here https://helpcenter.veeam.com/docs/backu ... l?ver=95u4
Take note of the folder to the backup repository on D:\
Simply safely remove the USB Ext HDD1, then change the drive letter of the USB Ext HDD2 to D:\ and ensure the folder structure you had present on the USB Ext HDD1 is present.
Re-run the backup job(s).
Rasmus Haslund | Twitter: @haslund | Blog: https://rasmushaslund.com
TheWaterbug
Enthusiast
Posts: 29
Liked: 2 times
Joined: Dec 06, 2019 7:29 pm
Full Name: Steven Kan
Contact:

Re: Setting up and seeding two rotated hard drives?

Post by TheWaterbug »

Thanks! After a bunch more reading, I think I'm understanding this a bit better. So the machine on which the repository resides needs to see these mounted at the same drive letter, correct?

I did some testing with my remote box, and the physical disk #1 always gets mounted as D:, and physical disk #2 always gets mounted as E:, regardless of which USB port they're plugged into and/or which of them is on or off when the box is booted. I supposed this is a good feature of Windows for the vast majority of applications, but not this one. So I need to programmatically un-mount and mount the two physical disks by GUID.

I found these instructions and now I have a PowerShell script on the backup repository computer to unmount whichever disk is currently mounted as D: and then mount the other one as D:.

Code: Select all

$TheDDrive = mountvol D: /L
$TheDDrive = $TheDDrive.trim()
$Drive1 = "\\?\Volume{GUID-of-Disk1}\"
$Drive2 = "\\?\Volume{GUID-of-Disk2}\"
mountvol E: /d
mountvol D: /d
if ($TheDDrive -eq $Drive1)
    {
    'D was Drive1; now mounting Drive2'
    $MountDrive = 'mountvol D: "' + $Drive2 + '"'
    $MountDrive
    Invoke-Expression $MountDrive
	}
elseif ($TheDDrive -eq $Drive2)
    {
    'D was Drive2; now mounting Drive1'
    $MountDrive = 'mountvol D: "' + $Drive1 + '"'
    $MountDrive
    Invoke-Expression $MountDrive
	}
else {
    'Some other disk is mounted as D:'
    }
I ran this script from PowerShell and then manually triggered my Backup and Backup copy jobs to this repository, and then did it again a few times, and it works as expected. The jobs properly reported:

Code: Select all

12/15/2019 12:05:45 PM :: Rotated drive content has changed from the previous job run.  
12/15/2019 12:05:51 PM :: Rotated drive was changed, restarting backup copy job  
Now I have to figure out how to trigger the PowerShell script remotely, from the main Veeam box, just before the jobs run.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Setting up and seeding two rotated hard drives?

Post by oleg.feoktistov »

Now I have to figure out how to trigger the PowerShell script remotely, from the main Veeam box, just before the jobs run.
Steven, you can configure your job to run pre-job scripts as described here.
Note that scripts are being executed on Backup server by default, so you need to use powershell remoting cmdlets to trigger it elsewhere.
Assuming that your script is kept on the target repository server, an example of a separate pre-job script would be:

Code: Select all

$session = New-PSSession -Computername REP-REMOTE-01 -Credential $creds
Invoke-Command -Session $session -Command { C:\Scripts\MountUSB.ps1 }
Where -Command runs the script under the path on target server.

Or else you can wrap it in -ScriptBlock and run directly from Backup server as a whole:

Code: Select all

$session = New-PSSession -Computername REP-REMOTE-01
Invoke-Command -Session $session -ScriptBlock {
 //Your mounting script here
}
Make sure that WinRM is enabled on the target machine.

Thanks!
Oleg
foggy
Veeam Software
Posts: 21069
Liked: 2115 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Setting up and seeding two rotated hard drives?

Post by foggy »

Hi Steven, this is not even required. You need to keep the drive letter the same during the first switch only. After the first backup to each drive is performed, Veeam B&R will follow the "known" drives regardless of the drive letter.
TheWaterbug
Enthusiast
Posts: 29
Liked: 2 times
Joined: Dec 06, 2019 7:29 pm
Full Name: Steven Kan
Contact:

Re: Setting up and seeding two rotated hard drives?

Post by TheWaterbug »

Thanks, both of you.
  1. I did figure out how to send the script from the other box, and how to specify the script as a pre-execute condition for a job.
    1. But then I realized that I have multiple jobs that I want to alternate between the two drives, so if I have the job (or jobs) execute the script, I could run into a situation where one job swaps 1 for 2, and then the other jobs swaps 2 for 1, and then I don't have two sets any more. Or if I only have one job run the script, and it fails to execute for some reason, then the other job won't do the swap.
    2. I think it might be better to have the remote box do the switching on its own, via Task Scheduler, so that it happens independently of any backup jobs running, or in what sequence they run.
  2. Regarding drive letters, can you describe a bit more how that works?
    1. When I set up the repository, I had to populate it with a drive letter.
    2. If it doesn't find that drive letter, does it then search all mounted volumes for the correct directory structure?
    3. If that's the case, then #1 doesn't matter, and I can forget all the mount-swapping stuff, and then I can just turn them on/off and let them mount at whatever drive letter they want.
In any case, some more explicit explanation of how to set up rotated drives might be helpful in the documentation! Or just refer people to this thread ;-)
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Setting up and seeding two rotated hard drives?

Post by oleg.feoktistov » 1 person likes this post

Steven, as soon as you perform first backup to your external drive, its guid gets registered in the VBR configuration database.
Thus, you need your USB Ext HDD1 and USB Ext HDD2 to have the same letter only once - till they both have at least one restore point.
Then, VBR will simply search the drives by their guids and put backups under the path you highlighted in the backup repository settings.
So, it would be {guid}\folder\
And every time you attach external drive, yes, drive letter may vary, but its guid assigned by Windows stays the same.
No need to use the script at all.
Thanks! Oleg
TheWaterbug
Enthusiast
Posts: 29
Liked: 2 times
Joined: Dec 06, 2019 7:29 pm
Full Name: Steven Kan
Contact:

Re: Setting up and seeding two rotated hard drives?

Post by TheWaterbug »

Thanks, Oleg! Now it makes complete sense. And, now that I'm reading the online documentation for the nth time, I'm seeing a description of this behavior:
Drive letters for external drives may change when you add new volumes or storage hardware such as CD-ROM on the server. On Microsoft Windows backup repositories, Veeam Backup & Replication can keep track of drives and detect them even if the drive letter changes.

To detect a drive correctly, Veeam Backup & Replication must have a record about it in the configuration database. Consider the following requirements:

When you insert a drive for the first time, the drive is not registered in the configuration database. Such drive must have the same letter as the one specified in the Path to folder field in backup repository settings. For more information, see Configuring Path and Load Control Settings.
If the drive has some other letter, Veeam Backup & Replication will not be able to detect and use it.

When you insert a drive that has already been used and has some restore points on it, the drive is already registered in the configuration database. Veeam Backup & Replication will be able to detect and use it, even if the drive letter changes.
I don't know why I didn't see this all the first time, before I posted the question. But it's all sorted out now, and I'm testing it over. my. slow. WAN. link.
Post Reply

Who is online

Users browsing this forum: Google [Bot], rjv1971 and 229 guests