You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo -e ${grn}"LinuxmintWSL's VHD has a default maximum size of 256GB. Disk space errors which occur if size exceeds 256GB can be fixed by expanding the VHD. Would you like to resize your VHD? More information on this process is available at \033[36mhttps://docs.microsoft.com/en-us/windows/wsl/vhd-size\033[32m."${txtrst}| fold -sw $width
34
-
selectynin"Yes""No";do
35
-
case$ynin
36
-
Yes)
37
-
echo""
38
-
whileread -p ${mgn}"Path to virtual disk (e.g. C:\Users\silesh\wsl\ext4.vhdx) : "${txtrst} -r vhdpath;do
39
-
if [ "x$vhdpath"="x" ];then
40
-
echo -e ${red}"Path cannot be blank."${txtrst}
41
-
echo -en "\033[1A\033[1A\033[2K"
42
-
vhdpath=""
43
-
else
44
-
wsl_path=$(wslpath -a $vhdpath)
45
-
if [ !-f$wsl_path ];then
46
-
echo -e ${red}"Disk does not exist. "${txtrst}
47
-
echo -en "\033[1A\033[1A\033[2K"
48
-
vhdpath=""
49
-
else
50
-
echo"select vdisk file=\"$vhdpath\""| sudo tee -a ~/vhdresize.txt >/dev/null 2>&1
51
-
break
52
-
fi
53
-
fi
54
-
done
55
-
whileread -p ${mgn}"Size of virtual disk in MegaBytes(e.g. 512000 for 512GB) : "${txtrst} vhdsize;do
56
-
if [[ $vhdsize=~ ^-?[0-9]+$ ]];then
57
-
if [ "$vhdsize"-le 256000 ];then
58
-
echo -e ${red}"Disk size should be greater than 256000 MegaBytes."${txtrst}
59
-
echo -en "\033[1A\033[1A\033[2K"
60
-
vhdsize=0
61
-
else
62
-
echo -en "\033[1B\033[1A\033[2K"
63
-
echo"expand vdisk maximum=$vhdsize"| sudo tee -a ~/vhdresize.txt >/dev/null 2>&1
64
-
echo""
65
-
printf"%s""$(<~/vhdresize.txt)"
66
-
echo""
67
-
echo -e ${grn}"\nReview the information displayed above and confirm to proceed."${txtrst}
68
-
echo -e ${red}"Edit only your input if you want to make changes!!!"${txtrst}
69
-
selectynin"Proceed""Edit";do
70
-
case$ynin
71
-
Proceed)
72
-
break
73
-
;;
74
-
Edit)
75
-
"${EDITOR:-nano}"~/vhdresize.txt
76
-
break
77
-
;;
78
-
esac
79
-
done
80
-
echo"@echo off"| sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
81
-
echo"wsl --shutdown"| sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
82
-
echo"diskpart /s C:\Users\Public\vhdresize.txt"| sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
83
-
if env | grep "WT_SESSION">/dev/null 2>&1;then
84
-
echo"wt.exe -w 0 nt wsl.exe -d $WSL_DISTRO_NAME"| sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
85
-
else
86
-
echo"cmd /c start \"$WSL_DISTRO_NAME\" wsl.exe --cd ~ -d $WSL_DISTRO_NAME"| sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
0 commit comments