WSL 2 disk image cannot be moved to a different drive
- [x] I have tried with the latest version of Docker Desktop
- [ ] I have tried disabling enabled experimental features
- [x] 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 https://github.com/docker/roadmap/issues/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
- Have the disk image in a directory on drive C.
- Open Settings -> Resources -> Advanced.
- Attempt to change the Disk image location to a directory on drive D.
Same issue as above. "Settings > Resources > Advanced - Disk image location" resets back to default after it's changed and doesn't actually change the image location.
Also on Windows 10, Docker Desktop 4.17.0 (99724), WSL2
Same issue Windows 10
Also same issue, in settings I change it and it looks fine. but never uses the listed path. Ive tried the whole Shutdown WSL and unregister then reimport. still doesnt stick.
Updated: actually it did work changes from unregistering and reimporting, it just still cant show any update in the UI.
The same issue: Windows Version: 10 Pro 22H2 19045.2728 Docker Desktop Version: 4.17.0
Same here Windows 10 Entreprise 22H2 19045.2788 Docker Desktop Version: 4.17.1
Same here with: Docker Desktop 4.18.0 Windows 10 Enterprise 22H2 19045.2728
Log file excerpt:
`[2023-04-05T19:31:41.917478800Z][com.docker.backend.exe][I] moving WSL data disk from "" to "D:\ddd\DockerDesktopWSL"
[2023-04-05T19:31:41.921106100Z][com.docker.backend.exe][W] failed to rename, use copy: rename
[common/cmd/com.docker.backend/internal/handlers.(*AppHandler).DoApply.func1() [ common/cmd/com.docker.backend/internal/handlers/app.go:150 +0xf6 [common/cmd/com.docker.backend/internal/handlers.(*AppHandler).DoApply [ common/cmd/com.docker.backend/internal/handlers/app.go:148 +0x4aa`
Thx
Hi folks, thanks for raising and apologies that this isn't working. We'll look at this during planning early next week and I'll provide an update shortly thereafter.
This is infuriating. The app is hardcoded to look in an arbitrary folder rather than the folder I provide.

Hi, There was indeed a bug when moving the WSL data folder to another disk, thanks for the detailed report. This has been fixed and should be published in next release.
Closing this issue because a fix has been released in Docker Desktop 4.20. See the release notes for more details.
Cannot change the data location to another disk.
Docker version 4.34.2 (the latest as of Sept. 21, 2024)
Docker Desktop - Settings not applied An error occurred while applying the "Disk image location" setting. The previous value has been restored.
failed to move WSL disk: moving disk file: rename C:\Users\XXXXXX\AppData\Local\Docker\wsl\disk\docker_data.vhdx D:\docker_storage\DockerDesktopWSL\disk\docker_data.vhdx: The process cannot access the file because it is being used by another process.
Diagnostics ID:
BCFA9071-6E10-4653-8ABC-9EA2CD6F7A30/20240921165450
Edition Windows 10 Pro Version 22H2 Installed on 6/29/2024 OS build 19045.4894 Experience Windows Feature Experience Pack 1000.19060.1000.0
Cannot change the data location to another disk.
Docker version 4.34.2 (the latest as of Sept. 21, 2024)
Docker Desktop - Settings not applied An error occurred while applying the "Disk image location" setting. The previous value has been restored.
failed to move WSL disk: moving disk file: rename C:\Users\XXXXXX\AppData\Local\Docker\wsl\disk\docker_data.vhdx D:\docker_storage\DockerDesktopWSL\disk\docker_data.vhdx: The process cannot access the file because it is being used by another process.
Diagnostics ID:
BCFA9071-6E10-4653-8ABC-9EA2CD6F7A30/20240921165450
Edition Windows 10 Pro Version 22H2 Installed on 6/29/2024 OS build 19045.4894 Experience Windows Feature Experience Pack 1000.19060.1000.0
Same issue, same env.
Hi!
Having the same issue. So, please, reopen and fix the issue. OS: Windows 11 Pro. Build 26100.2894 Docker Desktop version: 4.37.1
Steps:
- open Docker Desktop UI
- open Settings > Resources
- click Browse and select new location on the disk D for disk image
- click Apply & restart
- receive notification that it may take time, agree to move
- no restart happens, button changes to Apply
- press Apply, the same notification about moving appears
- agree second time, after few seconds an error appears:
Glad to provide more details if required.
Still cannot move. This is such a basic must have thing and which is not working.
Docker Version: Docker version 28.1.1, build 4eba377
Windows 11.
C:\Users\xyz>wsl -l -v
NAME STATE VERSION
* Ubuntu-24.04 Stopped 2
docker-desktop Stopped 2
Additonally, I cannot see the docker-desktop-data
same here. docker desktop for windows v4.52.0