Backup Failing

When trying to backup the Octopus Database and logs I am getting the following error. After looking through the forum it is a generic error but I’m not sure what is going on and don’t want to try to upgrade 2021.3.8275 to 2022.2.7580 without a proper backup:

ORDER BY [Id]
Loading T...
Process reader took 4024ms in transaction 'ExportController.Export': SELECT *
FROM [dbo].[Event]
ORDER BY [Id]
Error: ===============================================================================
Error: The filename, directory name, or volume label syntax is incorrect. : 'C:\Program Files\Octopus Deploy\Octopus\Events\Spaces-1.Release 2021.04.27-16.07.28-Automatic in project PatientDataImport was deleted by retention policy. Reason- Release 2021.04.27-16.07.28-Automatic is in phase Master, with a policy of Last 3 days; it will be deleted. Reason- Assembled on 4-27-2021; releases created after 4-27-2021 will be kept..json'
Error: System.IO.IOException
Error:    at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
Error:    at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
Error:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
Error:    at Octopus.Shared.Util.OctopusPhysicalFileSystem.Replace(String oldFilePath, Stream newStream, Int32 overwriteFileRetryAttempts)
Error:    at Octopus.Migrator.Core.ExportProcess.ExportController.WriteAnyObjectToFile(String directory, String filename, Object obj) in ExportController.cs:line 895
Error:    at Octopus.Migrator.Core.ExportProcess.ExportController.WriteFile[TDocument,TKey](String directory, String filename, TDocument obj) in ExportController.cs:line 879
Error:    at Octopus.Migrator.Core.ExportProcess.ExportController.WriteDocuments[TDocument,TKey](String singularNoun, IEnumerable`1 documents, ExportFileNameOption fileNameOption)+MoveNext() in ExportController.cs:line 837
Error:    at Octopus.Migrator.Core.ExportProcess.ExportController.Write(String singularNoun, IEnumerable`1 documents, ExportFileNameOption fileNameOption) in ExportController.cs:line 590
Error:    at Octopus.Migrator.Core.ExportProcess.ExportController.Export() in ExportController.cs:line 119
Error:    at Octopus.Migrator.Cli.Commands.ExportCommand.Start() in ExportCommand.cs:line 98
Error:    at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions)
Error:    at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime)
Error:    at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown)
Error:    at Octopus.Shared.Startup.OctopusProgram.RunHost(ICommandHost host)
Error:    at Octopus.Shared.Startup.OctopusProgram.Run()
Error: -------------------------------------------------------------------------------
Error: Terminating process with exit code 100
Error: Full error details are available in the log files at:
Error: C:\Users\daniel.talbot\AppData\Local\Octopus\Logs
Error: F:\Octopus\Logs
Error: If you need help, please send these log files to https://octopus.com/support
Error: -------------------------------------------------------------------------------
Error: 
Process Octopus.Migrator.exe in C:\Program Files\Octopus Deploy\Octopus exited with code 100
Error: The previous command returned a non-zero exit code of: 100
Error: The command that failed was: "C:\Program Files\Octopus Deploy\Octopus\Octopus.Migrator.exe" export --instance "OctopusServer" --directory "C:\temp" --password "XXXX" --include-tasklogs

Hi @daniel.talbot,

Thanks for reaching out, and welcome to the Octopus community!

Before upgrading, we recommend taking a full backup of your Octopus server database. If you haven’t already, I recommend looking at our documentation on upgrading major releases of Octopus Deploy. The docs do a good job of explaining how to mitigate risks before upgrading, and there is also a helpful section on how to roll back a failed upgrade.

We also recommend backing up your master and license keys along with the database.

The data exported using our old data migrator would not be sufficient if something did go wrong with the upgrade and you needed to restore your previous Octopus version. This would be one of the unsupported scenarios mentioned in our Data Migration documentation.

Please let me know if this helps or if you have any other questions as you prepare for your upgrade.

Thanks!
Dan

@dan_close So are you saying the following isn’t the export you are referring to? Because that is what seems to be failing. Apologies if just backup was misleading.

"C:\Program Files\Octopus Deploy\Octopus\Octopus.Migrator.exe" export --instance "OctopusServer" --directory "C:\Users\dt\Desktop\<BACKUP-FOLDER-AME>" --password "<PASSWORD-TO-USE>" --include-tasklogs

Hi Daniel,

Just stepping in for Dan while he’s offline!

Unfortunately it looks like you’ve run into this recently resolved issue with the Migrator.exe using the logs as the file name and will need to use another method to backup the data.

Our recommended way to backup your Octopus instance is to put it into Maintenance Mode and then taking a backup of the database using the TSQL command or complete it directly via SSMS for example:

Next take a backup of any folders Octopus uses that you’d like to keep as well as the MasterKey and you should have everything covered.

Finally, we recommend configuring a Test Instance from a Clone to complete the upgrade on, so it can be tested without impacting operations before making the switch to use the new version.

Let me know how you get on or if you have any issues or questions at all!

Best Regards,

1 Like