DevelopmentWindows

How to create and use Dev Drive in Windows 11

windows 11 dev drive

One of the most significant additions to the Windows 11 developer toolkit is the Dev Drive. This feature is tailored specifically for developers who need high-performance storage to handle their large files, repositories, and complex development environments. Dev Drive is designed to optimize storage and file-handling capabilities, ensuring that developers can work efficiently on large-scale projects without running into performance bottlenecks.

How to create a Dev Drive

  • First, open the “Settings” screen by right-clicking the “Start” button.
  • Then go to “System and Storage”.
  • Expand “Advanced Storage Settings” and click “Disks & Volumes”
  • Click the “Create Dev Drive” button

  • On this screen, you can choose to resize an existing disk or create a new virtual disk.
  • Create a new virtual disk for this example.
  • Choose where you want to store the virtual disk and give a name to it.
  • You have to give at least 50 gigabytes of disk size to your new Dev Drive.
  • You can choose partition style on this screen. Choose the Guid Partition Table.
  • Then click on “Initialize”.
  • This will create and initialize a new Dev Drive partition.
  • You can set a name and drive letter to your new drive.
  • Then click “Format”.
  • Now you can move your projects and solutions to this drive..

You can run the script that moves npm, gradle, nuget cache, and package files to Dev Drive. It also sets Environment Variables for them as their new path.

PowerShell
# Create a new directory for packages on Dev Drive
$DevDrive = "F:"
New-Item -Path $DevDrive\ -Name "MyPackages" -ItemType "directory"

# npm packages
Move-Item -Path $env:LocalAppData\npm-cache* -Destination $DevDrive\MyPackages

# NuGet packages
Move-Item -Path $env:UserProfile\.nuget* -Destination $DevDrive\MyPackages

# Maven packages
Move-Item -Path $env:UserProfile\.m2* -Destination $DevDrive\MyPackages

# Gradle cache
Move-Item -Path $env:UserProfile\.gradle* -Destination $DevDrive\MyPackages

# Set configuration
[Environment]::SetEnvironmentVariable("npm_config_cache", "$DevDrive\MyPackages\npm_cache", "User")
[Environment]::SetEnvironmentVariable("NUGET_PACKAGES", "$DevDrive\MyPackages\.nuget\packages", "User")
[Environment]::SetEnvironmentVariable("MAVEN_OPTS", "-Dmaven.repo.local=$DevDrive\MyPackages\.m2 $env:MAVEN_OPTS", "User")
[Environment]::SetEnvironmentVariable("GRADLE_USER_HOME", "$DevDrive\MyPackages\.gradle", "User")

Don’t forget. Installing applications to Dev Drive is not a recommended action

Lastly don’t forget to check Windows Defender. “Dev Drive Protection” should be enabled for asynchronous scans.

Shares: