Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/VirtualClient/VirtualClient.Dependencies/MountDisks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,30 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel
this.fileSystem.Directory.CreateDirectory(newMountPoint);
}

await this.diskManager.CreateMountPointAsync(
try
{
await this.diskManager.CreateMountPointAsync(
volume,
newMountPoint,
CancellationToken.None);

}
catch (ProcessException exc) when (exc.Message.Contains("OEM") || exc.Message.Contains("ESP") || exc.Message.Contains("recovery partition"))
{
// DiskPart cannot assign a mount point to an OEM, ESP, or recovery partition.
// These partitions are special system partitions that should be skipped.
this.Logger.LogTraceMessage(
$"Skipping mount point assignment for volume '{volume.Index}' on disk '{disk.DevicePath}'. " +
$"DiskPart cannot assign a mount point to an OEM, ESP, or recovery partition.");

if (this.fileSystem.Directory.Exists(newMountPoint))
{
this.fileSystem.Directory.Delete(newMountPoint, recursive: false);
}

continue;
}

// We want the mount point and directory structure to be owned by the user executing
// the application. This helps to prevent permissions issues.
string loggedInUser = this.PlatformSpecifics.GetLoggedInUser();
Expand Down