Closed gshipley closed 1 year ago
@gshipley Can you please provide the o/p of crc start --log-level debug
after setting the disk-size, this should have logs from the disk-resize operation, run:
$ crc config set disk-size 512
$ crc stop
$ crc start --log-level debug
Log file
In the log file I can see following we have to check if that windows-11 specific issue because on linux I tried same and able to get disk expanded to 512GB.
DEBU Running SSH command: realpath /dev/disk/by-label/root
DEBU SSH command results: err: <nil>, output: /dev/sda4
DEBU Using root access: Growing /dev/sda4 partition
DEBU Running SSH command: sudo /usr/bin/growpart /dev/sda 4
DEBU SSH command results: err: Process exited with status 1, output: NOCHANGE: partition 4 is size 63961055. it cannot be grown
DEBU No free space after /dev/sda4, nothing to do
@anjannath @jsliacan Can you folks try it on win-10 or in win-11 (if have one)?
Will give it a try manually, but below is the test from this release on win10 baremetal machine (see the case that I isolated). It seemed to have worked. Not sure if we have access to Win11 atm.
</testcase>
<testcase name="[It] podman preset basic use unset preset in config [podman-preset]" classname="Test Suite" status="passed" time="0.0644078"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values setup CRC [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="5.0212578"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values start CRC [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="675.978582"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values check VM's memory size [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0954754"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values check VM's number of cpus [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0649705"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values check VM's disk size [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0659444"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values stop CRC [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="21.2395566"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use custom values start CRC [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="655.5058403"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use custom values check VM's memory size [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0777708"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use custom values check VM's number of cpus [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0613301"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use custom values check VM's disk size [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0669636"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use custom values stop CRC [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="20.800499"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use flawed values start CRC with sub-minimum memory [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0622494"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use flawed values start CRC with sub-minimum cpus [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.076805"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use flawed values start CRC with smaller disk [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="6.5156013999999995"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use flawed values start CRC with sub-minimum disk [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0616362"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values again start CRC [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="517.8281093"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values again check VM's memory size [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0823113"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values again check VM's number of cpus [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0591255"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values again check VM's disk size [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="0.0667019"/>
<testcase name="[It] vary VM parameters: memory cpus, disk use default values again clean up [openshift-preset, vm-resize]" classname="Test Suite" status="passed" time="26.3750404"/>
</testsuite>
on linux I tried same and able to get disk expanded to 512GB.
There is some platform-specific code involved in disk resizing, the log you pasted is the generic code common to all 3 platforms. On Windows, this code needs to run before trying to resize the disk: https://github.com/crc-org/crc/blob/32916615274dab8064a7a99b1de7fb4a063dff22/pkg/drivers/hyperv/hyperv_windows.go#L73-L80
The disk-size
value is applied only when an already created CRC instance is stopped and re-started, it doesn't take the value of disk-size
when creating a fresh new instance, from the logs shared by @gshipley it was a new instance creation, we can see the following from his logs:
DEBU Creating VM...
DEBU Running 'Hyper-V\New-VM crc -Path 'C:\Users\gshipley\.crc\machines\crc' -MemoryStartupBytes 65000MB'
DEBU Running 'Hyper-V\Remove-VMNetworkAdapter -VMName crc'
DEBU Running 'Hyper-V\Set-VMMemory -VMName crc -DynamicMemoryEnabled $false'
DEBU Running 'Hyper-V\Set-VMProcessor crc -Count 10'
DEBU Running 'Hyper-V\Set-VM -VMName crc -AutomaticStartAction Nothing -AutomaticStopAction ShutDown -CheckpointType Disabled'
DEBU Running 'Hyper-V\Add-VMHardDiskDrive -VMName crc -Path 'C:\Users\gshipley\.crc\machines\crc\crc.vhdx''
So the value of disk-size
was not applied in your case, I changed the disk-size to 50 and stopped and started CRC and the VM disk was resized:
PS > crc config view
- consent-telemetry : no
- disk-size : 50
crc start
logs showing the disk resize happening:
INFO Starting CRC VM for openshift 4.12.0...
DEBU Updating CRC VM configuration
DEBU Resizing disk from 53687091200 bytes to 51539607552 bytes
DEBU Running 'Hyper-V\Resize-VHD -Path 'C:\Users\anath\.crc\machines\crc\crc.vhdx' -SizeBytes 51539607552'
DEBU Running 'Hyper-V\Start-VM crc'
DEBU Waiting for machine to be running, this may take a few minutes...
DEBU retry loop: attempt 0
DEBU Running 'Hyper-V\Get-VM crc | Select-Object -ExpandProperty State'
DEBU Machine is up and running!
DEBU Running 'Hyper-V\Get-VM crc | Select-Object -ExpandProperty State'
INFO CRC instance is running with IP 127.0.0.1
and growing the filesystem inside the VM..
DEBU Running SSH command: realpath /dev/disk/by-label/root
DEBU SSH command results: err: <nil>, output: /dev/sda4
DEBU Using root access: Growing /dev/sda4 partition
DEBU Running SSH command: sudo /usr/bin/growpart /dev/sda 4
DEBU SSH command results: err: <nil>, output: CHANGED: partition=4 start=1050624 old: size=63961055 end=65011679 new: size=99612639 end=100663263
INFO Resizing /dev/sda4 filesystem
DEBU Using root access: Remounting /sysroot read/write
DEBU Running SSH command: sudo mount -o remount,rw /sysroot
DEBU SSH command results: err: <nil>, output:
DEBU Using root access: Growing /dev/sda4 filesystem
DEBU Running SSH command: sudo xfs_growfs /dev/sda4
DEBU SSH command results: err: <nil>, output: meta-data=/dev/sda4 isize=512 agcount=33, agsize=242560 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=0 inobtcount=0
data = bsize=4096 blocks=7995131, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 7995131 to 12451579
we can investigate and work on making the disk-size
effective even for the first start/fresh instance creation
I just tested this on macOS, and the disk is resized even for the first start/fresh instance creation, so this is a Windows-specific issue.
On windows 10, and now on windows 11, the disk size has never worked for me (first time or restarts) The workaround is to run a powershell resize after first boot. Double the time since you have to start twice but works fine.
Kind of forgot about it as my init workflow just does it for me so never retried to see if CRC fixed it.
This is a powershell script, you can put into a file like crc-resize.ps1
, and run from powershell or from WSL I use powershell.exe -File crc-resize.ps1
crc stop
Resize-VHD -Path $HOME\.crc\machines\crc\crc.vhdx -SizeBytes 200GB
Get-VHD -Path $HOME\.crc\machines\crc\crc.vhdx
crc start
I will retry today the newest crc double start to see if its working (Windows 11)
I ran this script with the crc deleted and it still fails.
echo "CRC Init first time"
crc status
crc setup
function crcrestart() {
echo "CRC starting and configuring disk."
crc stop
crc status
crc config set disk-size 512
crc config view
crc start --log-level debug
crc status
}
crcrestart
crcrestart
As you noted above the first time, nothing happens to resize, the line creation of the disk should probably pass the requested size (i assume 'Hyper-V\New-VM could take a disk param ?)
CRC Init first time
Machine does not exist. Use 'crc start' to create it
level=info msg="Using bundle path C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64.crcbundle"
level=info msg="Checking if current user is in crc-users and Hyper-V admins group"
level=info msg="Checking if CRC bundle is extracted in '$HOME/.crc'"
level=info msg="Checking if C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64.crcbundle exists"
level=info msg="Checking if the daemon task is installed"
level=info msg="Checking if the daemon task is running"
level=info msg="Checking admin helper service is running"
Your system is correctly setup for using CRC. Use 'crc start' to start the instance
CRC starting and configuring disk.
Machine does not exist. Use 'crc start' to create it
Machine does not exist. Use 'crc start' to create it
Changes to configuration property 'disk-size' are only applied when the CRC instance is started.
If you already have a running CRC instance, then for this configuration change to take effect, stop the CRC instance with 'crc stop' and restart it with 'crc start'.
- consent-telemetry : no
- cpus : 10
- disk-size : 512
- enable-cluster-monitoring : true
- memory : 39968
level=debug msg="CRC version: 2.13.1+b5b864fd\n"
level=debug msg="OpenShift version: 4.12.0\n"
level=debug msg="Podman version: 4.3.1\n"
level=debug msg="Running 'crc start'"
level=debug msg="Total memory of system is 68479045632 bytes"
level=debug msg="No new version available. The latest version is 2.13.1"
level=debug msg="Checking file: C:\\Users\\jduim\\.crc\\machines\\crc\\.crc-exist"
level=info msg="Checking if running in a shell with administrator rights"
level=debug msg="Running '$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent());$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)'"
level=info msg="Checking Windows release"
level=debug msg="Running '(Get-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\" -Name ReleaseId).ReleaseId'"
level=info msg="Checking Windows edition"
level=debug msg="Running '(Get-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\").EditionID'"
level=debug msg="Running on Windows Professional edition"
level=info msg="Checking if Hyper-V is installed and operational"
level=debug msg="Running '@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent'"
level=debug msg="Running '@(Get-Service vmms).Status'"
level=info msg="Checking if Hyper-V service is enabled"
level=debug msg="Running '@(Get-Service vmms).Status'"
level=info msg="Checking if crc-users group exists"
level=debug msg="Running 'Get-LocalGroup -Name crc-users'"
level=info msg="Checking if current user is in crc-users and Hyper-V admins group"
level=debug msg="Running 'Get-LocalGroupMember -Group 'crc-users' -Member 'jduim''"
level=debug msg="Running 'Get-LocalGroupMember -SID 'S-1-5-32-578' -Member 'jduim''"
level=info msg="Checking if vsock is correctly configured"
level=debug msg="Running 'Get-Item -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\GuestCommunicationServices\\00000400-FACB-11E6-BD58-64006A7986D3\"'"
level=info msg="Checking if the daemon task is installed"
level=debug msg="Running 'Get-ScheduledTask -TaskName crcDaemon'"
level=debug msg="Running '(Get-ScheduledTask -TaskName \"crcDaemon\").Version'"
level=info msg="Checking if the daemon task is running"
level=debug msg="Running '(Get-ScheduledTask -TaskName \"crcDaemon\").State'"
level=info msg="Checking admin helper service is running"
level=debug msg="Running '(Get-Service crcAdminHelper).Status'"
level=debug msg="Checking file: C:\\Users\\jduim\\.crc\\machines\\crc\\.crc-exist"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\oc.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\oc.exe'"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\podman.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\podman.exe'"
level=info msg="Loading bundle: crc_hyperv_4.12.0_amd64..."
level=debug msg="Cannot load secret from configuration: empty path"
level=debug msg="Using secret from keyring"
level=info msg="Creating CRC VM for openshift 4.12.0..."
level=debug msg="Running pre-create checks..."
level=debug msg="Running '@(Get-Module -ListAvailable hyper-v).Name | Get-Unique'"
level=debug msg="Running '@([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(([System.Security.Principal.SecurityIdentifier]::new(\"S-1-5-32-578\")))'"
level=debug msg="Creating machine..."
level=debug msg="Creating VM..."
level=debug msg="Running 'Hyper-V\\New-VM crc -Path 'C:\\Users\\jduim\\.crc\\machines\\crc' -MemoryStartupBytes 39968MB'"
level=debug msg="Running 'Hyper-V\\Remove-VMNetworkAdapter -VMName crc'"
level=debug msg="Running 'Hyper-V\\Set-VMMemory -VMName crc -DynamicMemoryEnabled $false'"
level=debug msg="Running 'Hyper-V\\Set-VMProcessor crc -Count 10'"
level=debug msg="Running 'Hyper-V\\Set-VM -VMName crc -AutomaticStartAction Nothing -AutomaticStopAction ShutDown -CheckpointType Disabled'"
level=debug msg="Running 'Hyper-V\\Add-VMHardDiskDrive -VMName crc -Path 'C:\\Users\\jduim\\.crc\\machines\\crc\\crc.vhdx''"
level=info msg="Generating new SSH key pair..."
level=info msg="Generating new password for the kubeadmin user"
level=debug msg="Created C:\\Users\\jduim\\.crc\\machines\\crc\\.crc-exist"
level=debug msg="Machine successfully created"
level=debug msg="Checking file: C:\\Users\\jduim\\.crc\\machines\\crc\\.crc-exist"
level=debug msg="Running 'Hyper-V\\Get-VM crc | Select-Object -ExpandProperty State'"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\oc.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\oc.exe'"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\podman.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\podman.exe'"
level=info msg="Starting CRC VM for openshift 4.12.0..."
level=debug msg="Updating CRC VM configuration"
level=debug msg="Running 'Hyper-V\\Start-VM crc'"
level=debug msg="Waiting for machine to be running, this may take a few minutes..."
level=debug msg="retry loop: attempt 0"
level=debug msg="Running 'Hyper-V\\Get-VM crc | Select-Object -ExpandProperty State'"
level=debug msg="Machine is up and running!"
level=debug msg="Running 'Hyper-V\\Get-VM crc | Select-Object -ExpandProperty State'"
level=info msg="CRC instance is running with IP 127.0.0.1"
I snipped a bunch of stuff... but same log snipped from the second try - the instance is stopped, the size changed, crc started again and after second start it still says
CRC VM: Running
OpenShift: Running (v4.12.0)
RAM Usage: 9.133GB of 41.14GB
Disk Usage: 16.63GB of 32.74GB (Inside the CRC VM)
Cache Usage: 35.03GB
Cache Directory: C:\Users\jduim\.crc\cache
log shows ...
CRC VM: Running
OpenShift: Starting (v4.12.0)
RAM Usage: 8.491GB of 41.14GB
Disk Usage: 16.32GB of 32.74GB (Inside the CRC VM)
Cache Usage: 35.03GB
Cache Directory: C:\Users\jduim\.crc\cache
CRC starting and configuring disk.
level=info msg="Stopping kubelet and all containers..."
level=info msg="Stopping the instance, this may take a few minutes..."
Stopped the instance
CRC VM: Stopped
OpenShift: Stopped (v4.12.0)
RAM Usage: 0B of 0B
Disk Usage: 0B of 0B (Inside the CRC VM)
Cache Usage: 35.03GB
Cache Directory: C:\Users\jduim\.crc\cache
Changes to configuration property 'disk-size' are only applied when the CRC instance is started.
If you already have a running CRC instance, then for this configuration change to take effect, stop the CRC instance with 'crc stop' and restart it with 'crc start'.
- consent-telemetry : no
- cpus : 10
- disk-size : 512
- enable-cluster-monitoring : true
- memory : 39968
level=debug msg="CRC version: 2.13.1+b5b864fd\n"
level=debug msg="OpenShift version: 4.12.0\n"
level=debug msg="Podman version: 4.3.1\n"
level=debug msg="Running 'crc start'"
level=debug msg="Total memory of system is 68479045632 bytes"
level=debug msg="No new version available. The latest version is 2.13.1"
level=debug msg="Checking file: C:\\Users\\jduim\\.crc\\machines\\crc\\.crc-exist"
level=debug msg="Running 'Hyper-V\\Get-VM crc | Select-Object -ExpandProperty State'"
level=info msg="Checking if running in a shell with administrator rights"
level=debug msg="Running '$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent());$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)'"
level=info msg="Checking Windows release"
level=debug msg="Running '(Get-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\" -Name ReleaseId).ReleaseId'"
level=info msg="Checking Windows edition"
level=debug msg="Running '(Get-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\").EditionID'"
level=debug msg="Running on Windows Professional edition"
level=info msg="Checking if Hyper-V is installed and operational"
level=debug msg="Running '@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent'"
level=debug msg="Running '@(Get-Service vmms).Status'"
level=info msg="Checking if Hyper-V service is enabled"
level=debug msg="Running '@(Get-Service vmms).Status'"
level=info msg="Checking if crc-users group exists"
level=debug msg="Running 'Get-LocalGroup -Name crc-users'"
level=info msg="Checking if current user is in crc-users and Hyper-V admins group"
level=debug msg="Running 'Get-LocalGroupMember -Group 'crc-users' -Member 'jduim''"
level=debug msg="Running 'Get-LocalGroupMember -SID 'S-1-5-32-578' -Member 'jduim''"
level=info msg="Checking if vsock is correctly configured"
level=debug msg="Running 'Get-Item -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\GuestCommunicationServices\\00000400-FACB-11E6-BD58-64006A7986D3\"'"
level=info msg="Checking if the daemon task is installed"
level=debug msg="Running 'Get-ScheduledTask -TaskName crcDaemon'"
level=debug msg="Running '(Get-ScheduledTask -TaskName \"crcDaemon\").Version'"
level=info msg="Checking if the daemon task is running"
level=debug msg="Running '(Get-ScheduledTask -TaskName \"crcDaemon\").State'"
level=info msg="Checking admin helper service is running"
level=debug msg="Running '(Get-Service crcAdminHelper).Status'"
level=debug msg="Checking file: C:\\Users\\jduim\\.crc\\machines\\crc\\.crc-exist"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\oc.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\oc.exe'"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\podman.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\podman.exe'"
level=info msg="Loading bundle: crc_hyperv_4.12.0_amd64..."
level=debug msg="Checking file: C:\\Users\\jduim\\.crc\\machines\\crc\\.crc-exist"
level=debug msg="Running 'Hyper-V\\Get-VM crc | Select-Object -ExpandProperty State'"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\oc.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\oc.exe'"
level=debug msg="Copying 'C:\\Users\\jduim\\.crc\\cache\\crc_hyperv_4.12.0_amd64\\podman.exe' to 'C:\\Users\\jduim\\.crc\\bin\\oc\\podman.exe'"
level=info msg="Starting CRC VM for openshift 4.12.0..."
level=debug msg="Updating CRC VM configuration"
level=debug msg="Running 'Hyper-V\\Start-VM crc'"
level=debug msg="Waiting for machine to be running, this may take a few minutes..."
level=debug msg="retry loop: attempt 0"
level=debug msg="Running 'Hyper-V\\Get-VM crc | Select-Object -ExpandProperty State'"
level=debug msg="Machine is up and running!"
level=debug msg="Running 'Hyper-V\\Get-VM crc | Select-Object -ExpandProperty State'"
level=info msg="CRC instance is running with IP 127.0.0.1"
I tried manually stop; resize; start using powershell
Resize-VHD -Path $HOME\.crc\machines\crc\crc.vhdx -SizeBytes 512GB
which works fine.
General information
crc setup
before starting it (Yes/No)? YesCRC version
CRC status
This is after manually editing the vm setting in hyperv manager, otherwise disk usage will always show 32gb
CRC config
Host Operating System
Steps to reproduce
Expected
Virtual disk size matches the config value.
Actual
Disk size always remains at 32gb. Even after stop, cleanup, setup, start etc. In order to change the virtual disk size, as seen in above output, I need to stop the vm (crc stop) and then manually edit the disk size in hyper-v manager.