This document describes how to resolve full Persistent Disk volumes and disk resizing issues on Compute Engine instances.
Before you begin
- Always create a snapshot of your disk before performing any troubleshooting steps to make sure that you back up your data.
-
If your Linux boot disk is 100% full, then the
growpartcommand might fail because it can't create temporary files in the/tmpdirectory. To resolve this issue, force the command to use memory for temporary files instead by setting theTMPDIRenvironment variable:sudo env TMPDIR=/dev/shm growpart /dev/DEVICE_NAME PARTITION_NUMBER. For example:sudo env TMPDIR=/dev/shm growpart /dev/sda 1. -
If you haven't already, set up authentication.
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
-
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud initIf you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
-
Rate limited error when modifying a disk
The following are common errors you might encounter when you attempt to modify an Extreme Persistent Disk volume or a Google Cloud Hyperdisk volume. You might see these errors appear in several places, such as in your serial console output or application logs.
Disk cannot be resized due to being rate limited.
Cannot update provisioned iops due to being rate limited.
Cannot update provisioned throughput due to being rate limited.
Review the following time limits for modifying disks:
- You can resize an Extreme Persistent Disk volume or a Hyperdisk Throughput volume only once in a 6-hour period.
- You can resize a Hyperdisk Extreme volume only once in a 4-hour period.
- You can change the provisioned input/output operations per second (IOPS) or throughput for a Hyperdisk volume only once in a 4-hour period.
To resolve these errors, wait the required amount of time since your last modification before attempting to modify the disks again.
Disk capacity errors
The following sections describe common errors related to disk capacity and how to resolve them.
Full disks
The following are common errors you might encounter when your Persistent Disk volume reaches full capacity. You might see these errors appear in several places, such as in your serial console output or application logs.
No space left on device
Not enough storage is available to process this command
Error: There isn't enough space on the disk.
To resolve this issue, do the following:
Create a snapshot of the disk.
Delete files that you don't need on the disk to free up space.
If your disk requires more space after deleting files, then resize the disk.
Inaccessible compute instance due to full boot disk
Your compute instance might become inaccessible if its boot disk is full. Identifying this issue can be difficult because connectivity errors don't always indicate a full boot disk. If a full boot disk blocks access from the Google Cloud CLI or Remote Desktop Protocol (RDP), then you might encounter the following errors:
Network error: Software caused connection abort
Your Remote Desktop Services session has ended. The connection was lost because the remote computer is running low on memory or disk space.
ERROR: (gcloud.compute.ssh) Could not SSH into the instance. It is possible that your SSH key has not propagated to the instance yet. Try running this command again. If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.
You cannot connect to the VM instance because of an unexpected error. Wait a few moments and then try again.
No space left on device
USERNAME@VM_EXTERNAL_IP: Permission denied (publickey).
ERROR Exception calling the response handler. [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']...
When a Linux boot disk reaches 100% capacity, the guest agent,
google-guest-agent, can't write SSH keys to the ~/.ssh/authorized_keys
file. Essential login and logging services, such as the systemd-logind
service and authentication logging to the /var/log/auth.log file, can also
fail. As a result, SSH attempts often return a Permission denied (publickey)
error that resembles an SSH key issue. Before troubleshooting SSH keys, check
the serial port output for No space left on device messages to confirm
whether the boot disk is full.
To resolve the preceding issues, do the following:
Confirm that the connectivity failure is due to a full boot disk:
For Linux compute instances: inspect the serial port output:
gcloud compute instances get-serial-port-output INSTANCE_NAME
Replace
INSTANCE_NAMEwith the name of your compute instance. To stream live log entries as they arrive, run thegcloud compute instances tail-serial-port-outputcommand instead.If the boot disk is full, then the output contains the message
No space left on device.For Windows compute instances: use the Special Administration Console (SAC).
After you open a Command Prompt channel in SAC, check free space:
wmic logicaldisk get caption,freespace,size
If you haven't already done so, then create a snapshot of the compute instance's boot disk.
Try to restart the compute instance.
If you still can't access the compute instance, then complete the following steps:
Stop the compute instance:
gcloud compute instances stop INSTANCE_NAME
Replace
INSTANCE_NAMEwith the name of your compute instance.Increase the size of the boot disk:
gcloud compute disks resize BOOT_DISK_NAME --size DISK_SIZE
Replace the following:
BOOT_DISK_NAME: the name of your compute instance's boot diskDISK_SIZE: the larger size, in gigabytes (GB), for the boot disk
For example, to resize a disk named
example-disk-1to 6 GB, run the following command:gcloud compute disks resize example-disk-1 --size=6GB
Start the compute instance:
gcloud compute instances start INSTANCE_NAME
Replace
INSTANCE_NAMEwith the name of your compute instance.
Reattempt to connect to the compute instance by using SSH.
If the boot disk is 100% full, then automatic expansion of the root file system can fail during startup because resize utilities or system services can't write temporary files. If you still can't access the compute instance, then do one of the following:
Create a larger boot disk from a snapshot and create a compute instance from that disk. For more information, see Recover an inaccessible compute instance or a full boot disk.
For Linux compute instances only: Create a larger recovery disk from a snapshot of the boot disk and attach that disk to a temporary rescue instance. You can then free up space or manually expand the partition and file system. For more information, see Rescue an inaccessible VM.
For Linux compute instances only: Boot the compute instance temporarily in rescue mode by using the open-source Compute Engine Rescue tool, and then follow the steps in File system issues.
File system issues
The following sections describe common file system issues and how to resolve them.
File system resize issues
After you resize a boot disk, most compute instances automatically expand the
root file system. However, automatic expansion can fail if the boot disk is
100% full because resize utilities and services such as the systemd-logind
service can't write temporary files. Some image types also require manual
resizing.
If your image doesn't support automatic resizing, if automatic expansion failed, or if you resized a non-boot Persistent Disk volume, then manually resize the file system and partitions. If you can't connect to a Linux compute instance by using SSH, then use a rescue instance to free up space or expand the file system. For instructions, see Rescue an inaccessible VM.
To check if your root file system expanded automatically after you resized the boot disk, complete the following steps:
Check if your compute instance resized the boot disk by using one of the following methods:
Inspect your serial port output. Check for a line confirming that the compute instance resized the root partition.
For example, on compute instances with Debian images, if the automatic resize was successful, then the console logs include the line
... expand-root.sh[..]: Resizing ext4 filesystem on /dev/sda1.If you can connect to a Linux compute instance by using SSH, then run the
df -hcommand to check whether free disk space is available.For example, this output shows that the root file system is 92% full:
Filesystem Size Used Avail Use% Mounted on udev 63G 0 63G 0% /dev tmpfs 13G 1.4M 13G 1% /run /dev/sda1 339G 315G 24G 92% /
If your compute instance didn't resize the root file system, then manually resize the file system and partitions.
Storage Spaces Direct (S2D) limitation
When you use S2D, you can't increase capacity by resizing underlying Persistent Disk volumes. If you resize disks at the hardware level, then S2D won't recognize the added space, and data might become inaccessible. To increase capacity, add servers or drives instead of resizing existing Persistent Disk volumes.
To check if the disk is configured as part of an S2D cluster or storage pool, complete the following steps:
In the Google Cloud console, go to the VM instances page.
Next to the compute instance that has the resized disk, click RDP. The browser opens an RDP connection to the compute instance.
Right-click the Windows Start button and select Disk Management to open the Disk Management tool. For example, the following screenshot shows that Disk 1 has a protective partition for Storage Spaces in place:
Alternatively, you can run either of the following PowerShell commands to find any Persistent Disk volumes that belong to an S2D configuration:
Get-Disk | Where-Object Model -eq "Storage Space"
Get-PhysicalDisk | Where-Object {$_.ObjectId -like "*Spaces*"}
What's next
- Rescue an inaccessible VM
- Recover a VM with a corrupted or full disk
- Modify the size of a Persistent Disk
- Troubleshoot SSH errors