Ha Bom
Ha Bom

Reputation: 2917

How to move MobyLinuxVM.vhdx to another drive

I use Docker on Windows 10. After running docker pull kaggle/python the file MobyLinuxVM.vhdx goes up to nearly 30 GB and makes my C drive full. How can I safely move this file to another drive?

Upvotes: 1

Views: 955

Answers (2)

André Gode
André Gode

Reputation: 21

Just editing the settings.json did not work for me.

I also do step 1 and 2:

1 - Shut down Docker

2 - Move the C:\path\to\file\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx to E:\Foo\Bar\MobyLinuxVM.vhdx (the bigger Driver)

But after that I started the Hyper-V-Manager and opened the hyper-v settings on the actions panel. There I changed C:\path\to\file\ to E:\Foo\Bar\.

I am not sure, but I think this is equal to the mentioned powershell commands.

After starting Docker for Desktop the new location is visible in the advanced settings of the docker settings dialog.

Hint: you can also use the Hyper-V settings to inspect the path where you can find the MobyLinuxVM.vhdx.

Second Hint: If you have more than the MobyLinuxVM.vhdx in the C:\path\to\file\ folder, you have to copy them all the new location. Otherwise they are not reachable by the Hyper-V Manager.

Upvotes: 1

Michaël B.
Michaël B.

Reputation: 21

1 - Shut down Docker

2 - Move the C:\path\to\file\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx to E:\Foo\Bar\MobyLinuxVM.vhdx (the bigger Driver)

3 - Edit %APPDATA%\Docker\settings.json to set "MobyVhdPathOverride": "E:\\Foo\\Bar\\MobyLinuxVM.vhdx"

4 - Start Docker

For the next time if you want to edit the VM Default location when running pull command, open powershell as administrator and run this command :

Set-VMHost -VirtualHardDiskPath <the/new/path>

to check if you changed the path run this command :

(get-vmhost).VirtualHardDiskPath

Upvotes: 2

Related Questions