Unable to Delete Clone on an image

Recently, while refreshing our images in SQLClone, we attempted to delete an image that had a clone associated with the image. When we tried to deleted the clone, we received the error "Deletion Failed". To fix this issue, we logged onto the sqlclone machine and stopped the agent, and then we were able to delete the clone.
In the event viewer on both the sqlclone server and the server with the sqlclone agent, the same error appeared : 

An error was reported by "SSQLMTL8291" (AGENT, RateLimited): RaygunErrorMessage { InnerError: RaygunErrorMessage { InnerError: null, InnerErrors: null, Data: [], ClassName: "System.ComponentModel.Win32Exception", Message: "Could not detach virtual disk D:\data\MSSQL12.MSSQLSERVER\MSSQL\DATA\clones\monitoring_00010891_op2\disk.vhd. Error message: The device is not ready", StackTrace: [RaygunErrorStackTraceLineMessage { LineNumber: 117, ClassName: "RedGate.SqlClone.Unmanaged.Vhd", FileName: null, MethodName: "UnmountVhdFromFile(String vhdFile)", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 6, ClassName: "RedGate.SqlClone.Core.Vhd.VhdService", FileName: null, MethodName: "UnmountDiskImage(String diskImagePath)", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 0, ClassName: "RedGate.SqlClone.Core.Vhd.ExceptionHandlingVhdService", FileName: null, MethodName: "Try(String attemptedOperation, Action action, String possibleResolutions)", Raw: null }] }, InnerErrors: null, Data: [], ClassName: "VhdException", Message: "Error while unmounting VHD 'D:\data\MSSQL12.MSSQLSERVER\MSSQL\DATA\clones\monitoring_00010891_op2\disk.vhd':
Could not detach virtual disk D:\data\MSSQL12.MSSQLSERVER\MSSQL\DATA\clones\monitoring_00010891_op2\disk.vhd. Error message: The device is not ready", StackTrace: [RaygunErrorStackTraceLineMessage { LineNumber: 17, ClassName: "RedGate.SqlClone.Core.Vhd.ExceptionHandlingVhdService", FileName: null, MethodName: "Try(String attemptedOperation, Action action, String possibleResolutions)", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 55, ClassName: "RedGate.SqlClone.Core.Vhd.ExceptionHandlingVhdService", FileName: null, MethodName: "UnmountDiskImage(String diskImagePath)", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 55, ClassName: "RedGate.SqlClone.Core.Vhd.VhdMountDropper", FileName: null, MethodName: "<Drop>b__5_0()", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 16, ClassName: "System.Threading.Tasks.Task", FileName: null, MethodName: "Execute()", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 12, ClassName: "System.Runtime.ExceptionServices.ExceptionDispatchInfo", FileName: null, MethodName: "Throw()", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 354, ClassName: "RedGate.SqlClone.Agent.CloneDropper+<DropClone>d__5", FileName: null, MethodName: "MoveNext()", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 12, ClassName: "System.Runtime.ExceptionServices.ExceptionDispatchInfo", FileName: null, MethodName: "Throw()", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 46, ClassName: "System.Runtime.CompilerServices.TaskAwaiter", FileName: null, MethodName: "HandleNonSuccessAndDebuggerNotification(Task task)", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 139, ClassName: "RedGate.SqlClone.Agent.Drivers.CloneDriver+<DeleteClone>d__8", FileName: null, MethodName: "MoveNext()", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 12, ClassName: "System.Runtime.ExceptionServices.ExceptionDispatchInfo", FileName: null, MethodName: "Throw()", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 46, ClassName: "System.Runtime.CompilerServices.TaskAwaiter", FileName: null, MethodName: "HandleNonSuccessAndDebuggerNotification(Task task)", Raw: null }, RaygunErrorStackTraceLineMessage { LineNumber: 457, ClassName: "RedGate.SqlClone.Agent.AgentCloneService+<DropClone>d__9", FileName: null, MethodName: "MoveNext()", Raw: null }] }

We have encountered this case on four different clones, over a span of multiple days. Is there a different fix possible so that we don't have to log onto the sqlclone machine each time to stop the sqlclone agent? Sometimes we don't have direct access to the machine and have to ask the user to stop their agents which becomes a long arduous process.

We are currently using v2.6.0.10030

Tagged:

Answers

  • The error message "The device is not ready" (error 21) usually means that the network connection between the machine with the clone and the location where the image is stored is interrupted. In many cases, this can be difficult to recover without restarting SQL Server, since it puts the database into an error state, but that doesn't seem to be the situation here. Do you know of any steps that could be used to reproduce the problem? We might also be able to learn something from a full agent log file, if you wanted to share that with us through a support ticket. 
  • BenethorBenethor Posts: 22 Bronze 1
    edited July 23, 2018 1:14PM
    Thank you for the quick response. sadly I have no way of recreating the error state which is problematic for us. It has occurred in two different sqlclone environments now, and in one of the cases we were unable to delete the clone in the evening but the following morning we were able to with no problems.
    I have no problem sharing the full agent log file, although I`m not sure exactly what that refers to. Are you interested in the event viewer output (if so that`s what I provided above). If it`s not that, if you would be able to clarify exactly what that is that would be appreciated.

    Thanks,
  • You can find information about locating the log files here:
    https://documentation.red-gate.com/clone2/troubleshooting/log-locations

    It's the last part (SQL Clone Agent Service) which is most likely to be helpful.

    If you could open a ticket with support@red-gate.com and send the logs along then we can see if there's anything we can determine from them, thanks!
Sign In or Register to comment.