Skip to main content

Backup to USB disks: Do-it-yourself setup for USB drive rotation / swapping

I was looking for a simple but effective solution to use external USB disk drives attached to my server for backup with backup applications that do not directly support USB drive rotation / swapping.

Unfortunately, Windows does not seem to support assigning the same drive letter to different USB drives, e.g. you cannot assign the letter U: to two different USB drives. This would be nice to be able to rotate the drives but it does not work. So my idea was to use a network share name that automatically mounts different USB drives to the same share name, depending on which USB drives are connected, that creates some sort of priority as we will see. An additional advantage is that drive can be also accessed directly from other computers through the network share.

The first step is to assign different drive letters to each USB disk through Windows disk management, e.g. U: and V:. Then create the same directory to be shared on each drive, e.g. "USB_SHARE". Backups will be stored there.

Then a simple batch file (usb_share.bat) can be created. First the share name USB_SHARE is auto-deleted (if it should already exist). Then we attempt to connect that share name to the USB drives. This will of course only succeed if the corresponding drive is attached to the PC. I.e. if U: is attached, it will be mounted as the share, if it is not attached, V: will be attempted to be mounted as the share. With "grant" we can give the appropriate network permissions, make sure that NTFS permissions also apply. So we can enter the following in the batch file:

net share USB_SHARE /delete
net share USB_SHARE=U:\USB_SHARE /grant:Everyone,FULL
net share USB_SHARE=V:\USB_SHARE /grant:Everyone,FULL


This batch file can be executed manually after connecting a USB drive and it can also be setup to be run automatically on computer startup, e.g. through the task scheduler on a Windows Server OS (make sure you tell Windows to execute it with admin permissions).

Hope this helps!

Anguel

Comments

Popular posts from this blog

SOLVED: Making Wake-on-Lan (WOL) work in Windows 10 / 8.x

WINDOWS 10 UPDATE: THIS FIX ALSO APPLIES TO WINDOWS 10 , IT IS EVEN MORE IMPORTANT,  BECAUSE WINDOWS 10 TURNS "FAST STARTUP" (read below) BACK ON AFTER UPDATES (yes, Microsoft does not stop creating nonsense features / bugs). TO DISABLE FAST STARTUP ON WIN 10 THROUGH GROUP POLICY PREFERENCES CREATE THE FOLLOWING KEY: HKLM\System\CurrentControlSet\Control\Session Manager\Power\HiberbootEnabled and set its value to 0 ! I had very serious problems getting Wake-On-Lan (WOL) to work on my new Dell Optiplex 9020 MT (MiniTower) on Windows 8.1 Pro. I finally got this to work and would like to share my experience here. Note: At the time of this writing the current Dell BIOS for Optiplex 9020 MT was A05. UPDATE: The same behavior is also observed with DELL BIOS A07. Maybe Dell needs to comply with some power saving requirements and therefore enables Deep Sleep instead of Wake-On-LAN? Whatever the reason is, it is extremely annoying that this is the default and it is not ...

Veeam Backup & Replication: "Failed to execute script in guest OS" (Linux Guest VM on Hyper-V)

Problem: Veeam Pre-Freeze / Post-Thaw .sh Scripts Fail on Linux Guest VMs (e.g. Ubuntu) with "Failed to execute script in guest OS" although the scripts run fine. I use Hyper-V but that should not matter. Failing scripts are configured to "Require successful script execution" under "Application-Aware Processing Options" under "Guest Processing" in the Veeam backup job. My Solution: Some commands executed inside the scripts seem to return error output which is passed back to Veeam through the script and confuse Veeam so it reports that the script was not successful. So we must redirect error output from such commands to 2>/dev/null or some file, otherwise error status is passed back to this script and Veeam reports a failure. For information about discarding error output, see https://bash.cyberciti.biz/guide//dev/null_discards_unwanted_output Additional information: Also make sure that Veeam scripts (*.sh) are located on the Veea...

Windows Server 2012 R2 ESSENTIALS: Virtualization How-To, Physical Hyper-V Host and Virtual Server (VM)

This is intended to be a guide how to install Microsoft Windows Server 2012 R2 ESSENTIALS as a virtual server, i.e. inside a virtual machine (VM). This VM will run on a physical Hyper-V host which will be again Windows Server 2012 R2 ESSENTIALS itself. This type of installation is allowed by Microsoft but they have not included a tool to simplify the process. In order to achieve our aim, we need to modify the original ISO by removing the Essentials Role and Essentials Setup using Microsoft's own tools. DISCLAIMER: To my best knowledge everything described here complies with the MS license terms. It worked for me but does not mean that it will work for you as is. So make sure that you have understood everything and check if each step applies to your system. There is no liability for damages. Physical Hyper-V Host vs Virtual Server (Guest VM) Windows Server 2012 R2 Essentials is a very interesting operating system for small businesses. What many people don't know: Microsoft...