Backing up to a removable drive

Discussion in 'Acronis True Image Product Line' started by Xaneth, Sep 15, 2007.

Thread Status:
Not open for further replies.
  1. Xaneth

    Xaneth Registered Member

    Joined:
    Jun 19, 2007
    Posts:
    14
    I've got a client I've set up with an external 500 GB FreeAgent drive using a weekly backup schedule and daily differentials. All works ok, as long as the drive letter doesn't CHANGE!!! Regardless of hot plugging the drive, any time a camera or memory card is plugged in, the drive letter shifts on me. So I've been scouring the internet trying to find a way to statically fix the drive letter. I found a script that looked promising:

    Code:
    Dim objShell, objFs, objDriveCollection, wshSysEnv, strTemp, strSystemRoot, intDriveLetter
    Dim objDrive, objFile, strDriveType, strCMD, strVolume, strDrivesDone
    
    Set objShell = WScript.CreateObject("WScript.Shell")
    Set objfs = CreateObject("Scripting.FileSystemObject")
    Set objDriveCollection = objfs.Drives
    
    Set WshSysEnv = objShell.Environment("PROCESS")
    strTemp = WshSysEnv("Temp")
    strSystemRoot = WshSysEnv("SystemRoot")
    
    intDriveLetter=74 ' ascii for J
    strDrivesDone="" ' Drives that have been remapped. Prevents CDs being changed again after being moved higher up the alphabet
    
    For Each objDrive in objDriveCollection
    
    Select Case objDrive.DriveType
     Case 0: strDriveType = "Unknown"
     Case 1: strDriveType = "Removable"
     Case 2: strDriveType = "Fixed"
     Case 3: strDriveType = "Network"
     Case 4: strDriveType = "CD-ROM"
     Case 5: strDriveType = "RAM Disk"
    End Select
    
    if strDriveType = "Removable" AND instr(strDrivesDone,objDrive.DriveLetter)=0 then
    
     ' discover volume ID
     strCMD = strSystemroot & "\system32\cmd /c mountvol.exe " & objDrive.DriveLetter & ": /L > " & strTemp & "\volume.txt" 
     objshell.run strCMD,0,true
     Set objFile = objfs.OpenTextFile(strTemp & "\volume.txt", 1)
     strVolume = ltrim(objFile.ReadLine)
     objFile.close
    
     ' unmount
     strCMD = "mountvol.exe " & objDrive.DriveLetter & ": /d"
     objShell.Run strCMD,0,true
    
     ' Remount
     strCMD = "mountvol.exe " & chr(intDriveLetter) & ": " & strVolume
     objShell.Run strCMD,0,true
     strDrivesDone=strDrivesDone & chr(intDriveLetter)
     intDriveLetter=intDriveLetter+1
    
    end if
    
    wscript.sleep 500
    
    objshell.sendkeys "%f"
    
    objshell.sendkeys "c"
    
    
    Next
    
    After running the script, it changed my floppy drive (removable) to J:, but not the drive I intended to work with. The system is connected to a multi-function printer and has a total of about 6 or 7 drives, confusing the matter. I noticed that the FreeAgent drive did NOT show up as a removable drive, but as a fixed drive, like the C: drive and backup partition D:. I edited the script to work against fixed drives like:

    Code:
    Dim objShell, objFs, objDriveCollection, wshSysEnv, strTemp, strSystemRoot, intDriveLetter
    Dim objDrive, objFile, strDriveType, strCMD, strVolume, strDrivesDone
    
    Set objShell = WScript.CreateObject("WScript.Shell")
    Set objfs = CreateObject("Scripting.FileSystemObject")
    Set objDriveCollection = objfs.Drives
    
    Set WshSysEnv = objShell.Environment("PROCESS")
    strTemp = WshSysEnv("Temp")
    strSystemRoot = WshSysEnv("SystemRoot")
    
    intDriveLetter=74 ' ascii for J
    strDrivesDone="" ' Drives that have been remapped. Prevents CDs being changed again after being moved higher up the alphabet
    
    For Each objDrive in objDriveCollection
    
    Select Case objDrive.DriveType
     Case 0: strDriveType = "Unknown"
     Case 1: strDriveType = "Removable"
     Case 2: strDriveType = "Fixed"
     Case 3: strDriveType = "Network"
     Case 4: strDriveType = "CD-ROM"
     Case 5: strDriveType = "RAM Disk"
    End Select
    
    if strDriveType = [GLOW=""Fixed""]"Fixed"[/GLOW] AND instr(strDrivesDone,objDrive.DriveLetter)=0 then
    
     ' discover volume ID
     strCMD = strSystemroot & "\system32\cmd /c mountvol.exe " & objDrive.DriveLetter & ": /L > " & strTemp & "\volume.txt" 
     objshell.run strCMD,0,true
     Set objFile = objfs.OpenTextFile(strTemp & "\volume.txt", 1)
     strVolume = ltrim(objFile.ReadLine)
     objFile.close
    
     ' unmount
     strCMD = "mountvol.exe " & objDrive.DriveLetter & ": /d"
     objShell.Run strCMD,0,true
    
     ' Remount
     strCMD = "mountvol.exe " & chr(intDriveLetter) & ": " & strVolume
     objShell.Run strCMD,0,true
     strDrivesDone=strDrivesDone & chr(intDriveLetter)
     intDriveLetter=intDriveLetter+1
    
    end if
    
    wscript.sleep 500
    
    objshell.sendkeys "%f"
    
    objshell.sendkeys "c"
    
    
    Next
    
    Do NOT do this!!! It reassigned the C: drive to NOTHING, and now nothing works, I have to attempt a system recovery of some sort. I'd restore from Acronis, except the backups haven't been working because my J: drive changed to N:!!! The most recent backup I have is the 31st of August!!! Any words of wisdom? Consolation?
     
  2. DwnNdrty

    DwnNdrty Registered Member

    Joined:
    Mar 28, 2007
    Posts:
    3,335
    Location:
    Florida - USA
    You do not need a script to do this. Simply assign a letter far enough from any letter that may be used when you plug in any other devices. You can even use X for instance, for the external, and when you plug in other devices letters after C or D will be used.

    This explains how to do it:
    http://support.microsoft.com/kb/307844
     
  3. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,483
    Location:
    California
    This may be too late to help you, but I would try assigning a late drive letter (like X:, Y: or Z:) to the external drive using Windows Disk Management. That way it shouldn't be affected by USB flashdrives and other devices being plugged in and using the "next available" drive letter.
     
  4. Xaneth

    Xaneth Registered Member

    Joined:
    Jun 19, 2007
    Posts:
    14
    X: is the first drive letter I tried, however, when plugging in any removable device, such as a camera, etc, the drive letter shifts regardless. I need a way to lock the X: drive in, or reserve it somehow so that it doesn't shift.

    I came onsite and after a reboot the C: drive came back fortunately (phew).

    I will try the X: drive tactic once again and keep an eye on it, but it would be nice to be able to make a drive letter reservation.
     
    Last edited: Sep 15, 2007
  5. TonyR

    TonyR Registered Member

    Joined:
    Sep 14, 2007
    Posts:
    28
    In XP,
    go to START/ RUN/
    type in diskmgmt.msc
    at top click"action"
    at drop down menu click "all tasks"
    then click "change drive letter"

    highlight the drive you are having problems with and assign a letter closer to z..
    you can assign X if u want.
    [I use V for video since I had the same "shifting problem" when I installed my Western digital 500 gig external drive.
    it kept changing every time I plugged a usb device in..

    this should cement the letter.....
     
    Last edited: Sep 15, 2007
  6. Xaneth

    Xaneth Registered Member

    Joined:
    Jun 19, 2007
    Posts:
    14
    I'm thoroughly familiar with how to change the drive letter in that fashion, and it is the first thing I did when implementing the solution, however it shifted from X: on me as well. I don't have the details about what I was seeing back then (5 months ago), but will report here if/when it happens again. I've gone back to trying X:, and so far it hasn't shifted yet.

    I DO appreciate all the posts, thanks for the input everyone!
     
  7. Xaneth

    Xaneth Registered Member

    Joined:
    Jun 19, 2007
    Posts:
    14
    It continues to shift. Drive has not been moved, unplugged or anything (according to the end user), and it has shifted away from X: to H:, resulting in backup failures once again. How to lock this drive in? I may have to scrap the whole external drive idea and just mount another hard drive internally if it continues.
     
  8. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,647
    Location:
    NSW, Australia
    Xaneth,

    This link illustrates a somewhat similar problem but from the Ghost recovery environment rather than from Windows.

    http://radified.com/cgi-bin/yabb2/YaBB.pl?num=1144131251

    I'd try this. Remove all flash drives and plug in the USB HD. Delete all entries from [HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices]. Reboot and WinXP will reassign drive letters. If you leave the USB HD plugged in it should keep the new drive letter even when you add flash drives.

    Let us know.
     
  9. Xaneth

    Xaneth Registered Member

    Joined:
    Jun 19, 2007
    Posts:
    14
    Thanks a lot Brian, I also use Ghost exclusively at the office, though most of our images are factory based images that I pull across the network using a Bart network boot disk. This clears up a lot, and may solve the issues I'm looking at, if the end user wants to go this far with it. In fact, I think I've talked them into getting a 500 GB internal drive, to maintain a static mapping, and I'll be taking the 500 GB external off their hands, as I can use that kind of mobile space. Still it is good information to know for any future reference, as I'd like to be able to provide scheduled backup solutions for customers, and don't want to rule out the use of external capabilities.
     
  10. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    8,647
    Location:
    NSW, Australia
    Xaneth,

    Thanks for the feedback. I like internal HD backup too.
     
Thread Status:
Not open for further replies.