After This Operation of Additional Disk Space Will Be Used Do You Want to Continue Yes Abort
Linux Windows
You can increase the size of your persistent disk when your virtual machine (VM) instance requires additional storage space or higher performance limits. You can only resize a persistent disk to increase its size. You cannot reduce/decrease the size of a persistent disk.
You can resize disks at any time, whether or not the disk is attached to a running VM.
Compute Engine manages the hardware behind persistent disks, so that you can add and resize your disks without handling striping or redundancy.
Resize the disk
VMs using public images automatically resize the boot disks. In all other cases, you need to manually resize the boot disk or non-boot disks.
To increase the size of a boot or non-boot disk, use the following procedure:
Console
-
In the Google Cloud console, go to the Disks page.
Go to Disks
-
In the list of persistent disks in your project, click the name of the disk that you want to resize.
-
On the disk details page, click Edit.
-
In the Size field, enter the new size for your disk. Disks with MBR partition tables can resize only up to 2 TB.
-
Click Save to apply your changes to the disk.
gcloud
In the gcloud CLI, use the disks resizecommand and specify the --size flag with the desired disk size, in gigabytes.
gcloud compute disks resize DISK_NAME --size DISK_SIZE
Replace the following:
-
DISK_NAME: the name of the disk that you are resizing. -
DISK_SIZE: the new size, in gigabytes, for the disk. Disks with MBR partition tables can resize only up to 2 TB.
API
In the API, construct a POST request to the compute.disks.resize method. In the request body, specify the sizeGb parameter and set it to the desired disk size, in gigabytes.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME/resize { "sizeGb": "DISK_SIZE" } Replace the following:
-
PROJECT_ID: your project ID. -
ZONE: the zone where your disk is located. -
DISK_NAME: the name of the disk to resize. -
DISK_SIZE: the new size, in gigabytes, for the disk. Disks with MBR partition tables can resize only up to 2 TB.
Back up the disk
Resizing a disk doesn't delete or modify disk data, but as a best practice, always back up your disk by creating a snapshot before you make any changes to the file system or partitions.
Resize the file system and partitions
After resizing your disk, you might need to resize its file system and partitions.
-
Boot disk: VMs using public images automatically resize the root partition and file system after you've resized the boot disk on the VM and restarted the VM. If you are using an image that does not support this functionality, you must manually resize the root partition and file system.
-
Non-boot disk: After resizing the disk, you must extend the file system on the disk to use the added space.
The following example shows how to manually resize the root partition and file system of a boot disk, and how to manually resize the file system of a non-boot data disk with no partition table.
Linux instances
-
In the Google Cloud console, go to the VM instances page.
Go to VM instances
-
Next to the instance that has the new attached disk, click the SSH button. The browser opens a terminal connection to the instance.
-
Use the
dfcommand and thelsblkcommand to list the size of the file system and find the device names for your disks.$ sudo df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sda1 ext4 9.7G 1.2G 8.5G 12% / /dev/sdb ext4 250G 60M 250G 1% /mnt/disks/disk-1
$ sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk └─sda1 8:1 0 10G 0 part / sdb 8:16 0 500G 0 disk /mnt/disks/disk-1
This example includes the following disks:
- Boot disk: The
/dev/sda1partition is on a boot disk that has been resized to 20 GB. The partition table and the file system provide only 9.7 GB to the operating system. - Non-boot data disk: The
/dev/sdbnon-boot data disk has no partition table, but the file system on that disk provides only 250 GB to the operating system. The mount directory for this disk is/mnt/disks/disk-1.
The
dfcommand shows that the/dev/sda1partition is mounted as the root file system, and the/dev/sdbdisk is mounted as a non-boot data disk at/mnt/disks/disk-1. Make note of the Type column, which indicates if your disk uses anext4orxfsfile system. - Boot disk: The
-
Resize the root partition and file system on the boot disk. This example assumes the VM image does not support automatic root partition and file system resize.
-
Resize the root partition by using
parted. For example, the followingpartedcommand in interactive mode expands partition 1 of/dev/sdato the maximum possible size:sudo parted /dev/sda ... (parted) resizepart Partition number? 1 Warning: Partition /dev/sda1 is being used. Are you sure you want to continue? Yes/No? y End? [10.7GB]? 100% (parted) quit
-
Move GPT data structures to the end of the disk to align the GPT table.
sudo sgdisk --move-second-header /dev/sda
-
Read the new partition table using
partprobe.sudo partprobe /dev/sda
-
If you are using
ext4, use theresize2fscommand to extend the file system:sudo resize2fs /dev/sda1
-
If you are using
xfs, use thexfs_growfscommand to extend the file system:sudo xfs_growfs -d /
-
-
Resize the file system on the non-boot data disk.
-
If you are using
ext4, use theresize2fscommand to extend the file system:sudo resize2fs /dev/DEVICE_NAME
Replace
DEVICE_NAMEwith the device name for the disk. In this example, the device name is/dev/sdb. -
If you are using
xfs, use thexfs_growfscommand to extend the file system:sudo xfs_growfs MOUNT_DIR
Replace MOUNT_DIR with the mount point of the device. You can find the mount point listed in the
MOUNTPOINTcolumn in the output of thelsblkcommand.
-
-
Use the
dfcommand to verify that the file system is extended. For example:df -h /dev/sdb Filesystem Size Used Avail Use% Mounted on /dev/sdb 493G 70M 492G 1% /mnt/disks/disk-1
Windows instances
Use the Windows Disk Management tool to resize partitions on a Windows instance.
-
In the Google Cloud console, go to the VM instances page.
Go to VM instances
-
Next to the instance that has the resized disk, click the RDP button. The browser opens an RDP connection to the instance.
-
Right-click the Windows Start button and select Disk Management to open the Disk Management tool.
-
Refresh the Disk Management tool so that it recognizes the additional space on your zonal persistent disk. At the top of the Disk Management window, click Action and select Refresh.
-
On the disk that you resized, right-click the formatted partition and select Extend Volume.
-
Follow the instructions in the Extend Volume Wizard to extend your existing partition to include the extra disk space. If the existing partition is formatted in NTFS, the maximum partition size is limited by its cluster size settings.
-
After you complete the wizard and the volume finishes formatting, check the
Statuscolumn on the list of attached disks to ensure that the new disk has aHealthystatus.
You do not need to restart your instance after you complete this process. You can now use the added disk space to store data.
Source: https://cloud.google.com/compute/docs/disks/resize-persistent-disk
0 Response to "After This Operation of Additional Disk Space Will Be Used Do You Want to Continue Yes Abort"
إرسال تعليق