Tie specific drives to specific backups


Author
Message
scauffiel
scauffiel
New Member
New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)
Group: Forum Members
Posts: 5, Visits: 17
I think it'd be real handy to be able to specify certain backups to run only if certain backup targets are detected.  As an example, I have five daily backup RDX cartridge drives, labeled Monday through Friday, obviously.  For each of these days I have a full backup scheduled for the first of those days of the month (i.e. a full backup to the Monday drive on the first Monday of the month, a full backup to the Tuesday drive on the first Tuesday, etc.).  I then have differential backups scheduled for each of those days/drives for the second, third and fourth of those days of the month.  So each RDX drive gets a full backup and then up to four differentials in the course of a month. 

However there are days when we're off or I'm out of the area or whatever and the drives don't get swapped - and things can get kind of wonky, especially if I need to restore something.  It'd be nice if I could set the Monday schedule to only run when it detects the Monday drive; the Tuesday schedule to only run with it detects the Tuesday drive, etc.

jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)
Group: Forum Members
Posts: 4.4K, Visits: 32K
I don't work with RDX cartridges, so I'm not sure what's available in terms of identification, but if they can have a drive label like normal hard drives, you could have Reflect generate a PowerShell script to run your job, and then customize that baseline script to make the backup job conditional on the drive label of the destination matching an expected value.  I'd be happy to help with that after the holidays if that would be an acceptable solution.  Obviously it's not as easy as if Reflect supported something like this natively, but on the other hand it's possible to implement now.

As it happens, I have this same rotation issue at a client where the office manager is responsible for swapping backup disks and occasionally forgets to do it, but in that case the client decided they'd rather have the backup run, even if it goes to the wrong place and ends up purging an older backup sooner than it would've been normally, than not have the backup at all and therefore be at risk of losing more than a day's worth of work.  It also helps that Reflect's job logs include the label of the destination drive, so if you ever need to go back to see what disk a backup from a particular day actually went to, you can do that.

scauffiel
scauffiel
New Member
New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)
Group: Forum Members
Posts: 5, Visits: 17
jphughan - 24 December 2018 8:12 PM
I don't work with RDX cartridges, so I'm not sure what's available in terms of identification, but if they can have a drive label like normal hard drives, you could have Reflect generate a PowerShell script to run your job, and then customize that baseline script to make the backup job conditional on the drive label of the destination matching an expected value.  I'd be happy to help with that after the holidays if that would be an acceptable solution.  Obviously it's not as easy as if Reflect supported something like this natively, but on the other hand it's possible to implement now.

As it happens, I have this same rotation issue at a client where the office manager is responsible for swapping backup disks and occasionally forgets to do it, but in that case the client decided they'd rather have the backup run, even if it goes to the wrong place and ends up purging an older backup sooner than it would've been normally, than not have the backup at all and therefore be at risk of losing more than a day's worth of work.  It also helps that Reflect's job logs include the label of the destination drive, so if you ever need to go back to see what disk a backup from a particular day actually went to, you can do that.

Well so much for setting a Follow Up properly, lol.  Sorry for not getting back to you earlier, I set (or THOUGHT I had set) a follow up for the second week of January but I dunno what happened there.  ANYWAY, yes I can set drive labels on them and I'd love to try something like this if you could lend a hand with it as I don't do much with PowerShell at all.  I get what your client is saying too, but if you're willing to help I think I'll at least try this route until I regret it.  ;-)
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)
Group: Forum Members
Posts: 4.4K, Visits: 32K
D'oh!  I just make sure the "Notify me of replies to this post" option just above the "Post Reply" button is enabled, and then I get an email when somebody replies.  Anyhow, I'm still happy to work on it.  Give me perhaps a day or two and I should have a process for you to try. Smile

Edited 28 January 2019 5:03 PM by jphughan
scauffiel
scauffiel
New Member
New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)
Group: Forum Members
Posts: 5, Visits: 17
jphughan - 28 January 2019 5:02 PM
D'oh!  I just make sure the "Notify me of replies to this post" option just above the "Post Reply" button is enabled, and then I get an email when somebody replies.  Anyhow, I'm still happy to work on it.  Give me perhaps a day or two and I should have a process for you to try. Smile

Good plan!

Okay, that sounds great, thanks so much!
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)
Group: Forum Members
Posts: 4.4K, Visits: 32K
Two quick questions:

- Are all of your cartridges consistently assigned the same drive letter, or are you using Reflect's volume identifier based discovery option under Edit Defaults > Advanced > Destination Drive Discovery so that you don't have to worry about the drive letter?

- Are you using the "Alternative locations" feature in your definition file to specify multiple possible targets?

I'm hoping you're using drive letter based discovery and only using a single destination, because otherwise this script will get a bit more complicated.  In a nutshell, the script has to check the label of the destination drive/cartridge, but in order to do that it needs to know which drive/cartridge on your system is the destination for the backup.  If I can assume your definition file only has a single destination defined and that it's defined by drive letter rather than volume identifier, that's fairly straightforward.  If you're using volume identifiers and/or multiple possible destinations, it gets trickier.

Edited 28 January 2019 5:15 PM by jphughan
scauffiel
scauffiel
New Member
New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)
Group: Forum Members
Posts: 5, Visits: 17
You're in luck - it's always drive Q (for "RDX" lol) and nope, no alternative locations. ;-)
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)
Group: Forum Members
Posts: 4.4K, Visits: 32K
Ok, I've got your script modification.  A few things for you (and potentially anyone else who finds this thread later) to be aware of upfront:

- This modification assumes the definition file specifies a single destination by drive letter.  Definition files that specify their destination by volume identifier and/or specify alternative destinations will not work properly.  I could probably build support for that, but it would add more complication.

- If a backup job refuses to run because the wrong disk/cartridge is connected, the script will return an exit code that indicates an error.  This means that if you call this script from a scheduled task, the "Last Run Result" will indicate an error.  However, Reflect itself will not have a log entry for this failed job at all, and therefore if you have email notifications set up for job failures within Reflect, they will not be applied.  The reason is that this script stops Reflect from running at all if the wrong disk/cartridge is connected.  That's necessary to achieve the desired outcome here because if Reflect were to start, it would run the backup job, since it doesn't have a concept of right vs. wrong disk.  You could however extend the script itself to generate an email notification (or take other action) if it quits due to having the wrong disk attached.

If you're ok to proceed, here's what to do:

1. If you haven't already, create a definition file for your job.

2. In Reflect, go to the Backup Definition Files tab, right-click your definition file, and select "Generate a PowerShell script file". Make any desired selections in the wizard dialog (though none are required for this), then click OK.

3. Still in Reflect, go to the "PowerShell Files" tab, right-click your new script, and select Edit.

4. Take the contents of the attached Before-Main.txt file and paste them into your script immediately above the line near the end of the script that reads: "# Execute the Main function"

5. Underneath the line that reads "Main;", add a close brace/curly bracket character -- } -- in order to complete the "Else" statement begun by the content you just pasted in above.  Having the "Main" function inside the Else block means the backup will now run only if the expected disk is attached.

6. In the switch block at the top of the content you pasted in, change the $ExpectedVolName values for each day to the labels you'll be using for each disk.

7. Now make sure that your schedules, desktop shortcuts, and any manual job executions are associated with this new script, not the original definition file. To do that, go to the PowerShell Files tab, right-click your script, and select Schedule and/or Create Desktop Shortcut to create your new items. If you've been using scheduled backups, the last step is to go to the Backup Definition Files tab and remove your original schedule entries from the definition file. And whenever you want to run a backup manually, right-click the script rather than the definition file and select Run Now.

8. If you want to test your script manually and interactively to make sure it fails when it should and still runs when it should, open PowerShell Console with elevated privileges and try running it from there.  If you've never used PowerShell before, PowerShell scripts have to be called by entering the syntax of .\MyScript.ps1 as opposed to batch files in Command Prompt where you can just enter "MyScript".

Good luck! Smile

Attachments
Before-Main.txt (1 view, 1.00 KB)
Edited 28 January 2019 6:40 PM by jphughan
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)
Group: Forum Members
Posts: 4.4K, Visits: 32K
One follow-up question, since while rereading your original post I realized I may have assumed something that isn't the case.  Do you currently have a single definition file for the job and then multiple schedule entries to achieve the desired outcome of having a Full on the first occurrences of each weekday of a month and then Diffs on the remaining occurrences?  Or are you currently achieving that with completely separate definition files for each target disk/cartridge?  The script modifications I posted above assume the former setup, since you can achieve your desired scheduling outcome with a single definition file, which is cleaner.  If you're currently using the latter, then the script modifications I posted will still work (though some of it will be extraneous), but you'll need to perform the steps above for each of your definition files.  Therefore if you're currently using a setup involving multiple definition files, this might be an opportune time to switch to a single definition file with appropriately defined schedule entries.

Edited 28 January 2019 6:26 PM by jphughan
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)Macrium Evangelist (6.5K reputation)
Group: Forum Members
Posts: 4.4K, Visits: 32K
@scauffiel, did you get a chance to try that script out?  If so, how did it go?

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search