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 ...

Changing the Reserved IP Address in a Static DHCP Reservation in Windows Server

  Static IPs preferred DHCP is a good thing if it works - set and forget. But what happens if the DHCP server is down for some reason? Exactly - the whole network stops working. Another problem of DHCP are those random IPs a client gets each time. This is very bad for printers that use DHCP. Therefore I prefer static IPs over dynamic.   Windows Server 2012 R2 Essentials: You cannot stop Windows LAN Configuration Service anymore Unfortunately, there is some strange behavior on Server 2012 R2 Essentials if you just enter static IPs on your Windows clients - your Windows OS will show exclamation marks on your network connection from time to time, etc. There is actually a Windows Server LAN Configuration service which keeps overwriting your manual settings and the bad thing is that you cannot stop that service in Server 2012 R2 any more for some reason...So, instead, I decided to use DHCP on the server and add an Alternative IP Configuration with all static data as...

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...