Backup and restore

To start or restore backup use StartBackup or StartRestore operations respectively.

Non blocking operations

Execution of the StartBackup and StartRestore methods simply starts the requested actions on the server and returns immediately. The StartBackup and StartRestore methods do not wait for operation to complete.


Task StartBackup(string backupLocation, FileSystemDocument fileSystemDocument, bool incremental, string fileSystemName);
backupLocation string The path to a directory where the backup will be stored
fileSystemDocument FileSystemDocument The file system configuration document that will be stored with the backup location as 'Filesystem.Document' file. Pass null to use the current one.
WARNING: The file system configuration document may contain sensitive data which will be decrypted and stored in the backup.
incremental bool Indicates if it should be the incremental backup
fileSystemName string The name of the file system to backup.

Return Value
Task A task that represents the asynchronous start operation


await store.AsyncFilesCommands.Admin
		.StartBackup(@"C:\backups\NorthwindFS", null, false, "NorthwindFS");

If you are interested in checking the current backup status you can retrieve it by getting Raven/Backup/Status configuration item:

BackupStatus status = await store.AsyncFilesCommands.Configuration

if (status.IsRunning)
	// ... //


Task<long> StartRestore(FilesystemRestoreRequest restoreRequest);
restoreRequest FilesystemRestoreRequest Restore information

Return Value
Task<long> A task that represents the asynchronous restore operation. The task result is the operation identifier.


long restoreOperationId = await store.AsyncFilesCommands.Admin
									.StartRestore(new FilesystemRestoreRequest()
										BackupLocation = @"C:\backups\NorthwindFS",
										FilesystemLocation = @"~\FileSystems\NewNorthwindFS",
										FilesystemName = "NewNorthwindFS"

If you needed to wait until the operation finishes, you would have to initialize DocumentStore associated with <system> database and wait for the operation completion:

using (var sysDbStore = new DocumentStore
	Url = "http://localhost:8080/"
	await new Operation((AsyncServerClient)sysDbStore.AsyncDatabaseCommands, restoreOperationId)