Skip to content

WSL 2 disk image cannot be moved to a different drive #13269

@rdicroce

Description

@rdicroce
  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: BE7C0EE9-BDCD-4944-9FE7-288AF3A9CF9D/20230301151135

Actual behavior

WSL 2 disk image cannot be moved to a different drive.

Expected behavior

WSL 2 disk image can be moved to a different drive.

Information

  • Windows Version: 10 Pro 22H2
  • Docker Desktop Version: 4.17.0
  • WSL2 or Hyper-V backend? WSL2
  • Are you running inside a virtualized Windows e.g. on a cloud server or a VM: No

In Settings -> Resources -> Advanced, the disk image location lets you choose where to store the WSL 2 image. I was excited about this since it looked like it would resolve docker/roadmap#239. I tried to move my image from my C drive to my much larger D drive. It appeared to work, but then I noticed the directory I chose on the D drive was still empty.

So I went back in and looked at the setting again. It had reverted back to its original value. I tried changing it again, and it still didn't work. I exited the settings window and re-opened it. The original value was back.

A peek in the log file suggests that the cause is that Docker is attempting to simply rename the file, which does not work if the destination is on a different drive:

[2023-03-01T14:54:44.028780800Z][com.docker.backend.exe][W] failed to rename, use copy: rename <HOME>\AppData\Local\Docker\wsl\data\ext4.vhdx D:\Docker\wsl\DockerDesktopWSL\ext4.vhdx: The system cannot move the file to a different disk drive.

Output of & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check

Steps to reproduce the behavior

  1. Have the disk image in a directory on drive C.
  2. Open Settings -> Resources -> Advanced.
  3. Attempt to change the Disk image location to a directory on drive D.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions