This also works on other emulators as long as it's a VMDK. If you need help with that, feel free to open an issue.
VMware workstation, specifically the vmware-vdiskmanager.exe
file.
[!NOTE] If you don't have VMware workstation or don't want to download the whole thing, simply use the
vmware-vdiskmanager.exe
file from the VdiskManager folder i provided (This is a new addition).
C:\LDPlayer\LDPlayer9
and C:\Program Files (x86)\VMware\VMware Workstation
), please refer to the Manual version of the instructions and ensure that you update the commands accordingly.[!NOTE] I recommend using the manual version since it seems to clear more storage.
Disk > Open Virtual Disk File
and choose the VMDK you want to shrink. (VMDKs are saved at \LDPlayer\LDPlayer9\vms\leidian#, # being the id of the instance (taken from ldmultiplayer), for example leidian1, leidian1 etc.).Erase Free Space
. Keep the settings unchanged and then click Erase.\
vmware-vdiskmanager.exe
is, right-click and choose open in terminal (or cmd or powershell).vmware-vdiskmanager.exe -k C:\Path\to\file.vmdk
(for cmd) or & vmware-vdiskmanager.exe -k C:\Path\to\file.vmdk
(for Powershell) and replace C:\Path\to\file.vmdk with the path to the VMDK you're shrinking.
- Please note, this process only applies if you have installed the programs in their default installation locations.
- The vmdk should shrink by 1GB. If you want to shrink it more, you can increase the count in Clear.bat from 1024 (1GB) to a bigger number (You can go overboard, it won't delete files you never deleted).
StorageClear.bat
. Shrink.bat
, it'll ask for the ID acquired in the previous step.StorageClearData.bat
and ShrinkData.bat
)If you get any errors, maybe try the manual version.
- You can also refer to Editing batch files to make your own batch files
- The vmdk should shrink by 1GB. If you want to shrink it more, you can increase the count in step 9 from 1024 (1GB) to a bigger number (You can go overboard, it won't delete files you never deleted).
cd C:\LDPlayer\LDPlayer9
.adb devices
(cmd) or .\adb devices
(powershell). If the output lists a device (emulator-5556 device) then you're good to go if not make sure step 2 is done and the LDPlayer instance is Launched.adb shell
(cmd) or .\adb shell
(powershell).su
.cd /sdcard
.dd if=/dev/zero of=fillfile bs=1048576 count=1024
(As said above, you can change 1024 (1GB) to a bigger number. Even if the number is bigger than how large the instance is, it won't delete anything (This ensures clearing the most space possible)).rm /sdcard/fillfile
.exit
.exit
.C:\LDPlayer\LDPlayer9\vms
by default (You can tell which instance is which by the name of the folders (leidian0, leidian1 etc) and the ID in LDMultiPLayer).system.vmdk
is the one you probably should not shrink.vmware-vdiskmanager.exe
which is available in the vmware workstation directory C:\Program Files (x86)\VMware\VMware Workstation
.vmware-vdiskmanager.exe
is and run vmware-vdiskmanager.exe -k "C:\LDPlayer\LDPlayer9\vms\leidian1\sdcard.vmdk"
(cmd) or .\vmware-vdiskmanager.exe -k "C:\LDPlayer\LDPlayer9\vms\leidian1\sdcard.vmdk"
(powershell). Don't forget to change "leidian1" depending on the instance you want to shrink.Refer to Editing Batch files to make your own batch files.
Instead of following the steps in the Manual version, you can edit the paths in the batch files and use the Batch (.bat) files version instead.
C:\LDPlayer\LDPlayer9
with the path to your LDPlayer installation (if there are spaces dont forget the double quotes (ex: C:\Path to\LDPlayer
would be "C:\Path to\LDPlayer"
).count=1024
with a bigger number to clear more space (You can go overboard, it won't delete files you never deleted)."C:\Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe"
with the path to your vmware-vdiskmanager.exe
file.C:\LDPlayer\LDPlayer9\vms\leidian
with the path to your LDPlayer vms (NOTE: \LDPlayer\LDPlayer9\vms\leidian is unchangeable. This means that, say you installed LDPlayer in your downloads folder, your path should be C:\Users\YOUR-USERNAME\Downloads\LDPlayer\LDPlayer9\vms\leidian
(of course YOUR-USERNAME should be replaced with your username)).