Increasing capacity of a Block Storage for VPC boot volume
For boot volumes that are attached to an instance, you can increase the capacity from the default 100 GB up to 250 GB during or after instance provisioning in the console, from the CLI, with the API, or Terraform.
Increase boot volume capacity in the UI
Increase boot volume capacity for new or existing instances in the console. For existing instances, you can increase the boot volume capacity by selecting a boot volume from the list of Block Storage volumes.
Increase boot volume capacity during instance provisioning in the UI
When you create an instance from either a stock or custom image, you can increase the size of the boot volume. For example, a stock image would show 100 GB by default. You can modify the size up to 250 GB. For more information about creating virtual server instances, see Creating virtual server instances in the UI.
You can also specify a larger boot volume capacity when you create an instance template. For more information, see Creating an instance template.
Increase boot volume capacity from the list of Block Storage volumes in the UI
For an existing instance, you can increase its boot volume capacity by selecting it from the list of Block Storage volumes.
-
Go to the list of Block Storage volumes. In the IBM Cloud console, click the Navigation menu icon > Infrastructure > Storage > Block Storage volumes.
-
Select a boot volume from the list of volumes. The attachment type is boot.
-
In the boot volume details, click the Size pencil icon. Alternatively, select Expand volume from the Actions menu .
-
In the side panel, increase the boot volume size in the Create size field. The size must be more than the current size up to 250 GB.
-
Click Expand boot volume size.
Increase boot volume capacity from the CLI
Before you begin
Before you can use the CLI, you must install the IBM Cloud CLI and the VPC CLI plug-in. For more information, see the CLI prerequisites.
- Log in to the IBM Cloud.
This command returns a URL and prompts for a passcode. Go to that URL in your browser and log in. If successful, you get a one-time passcode. Copy this passcode and paste it as a response on the prompt. After successful authentication, you are prompted to choose your account. If you have access to multiple accounts, select the account that you want to log in as. Respond to any remaining prompts to finish logging in.ibmcloud login --sso -a cloud.ibm.com
Increase boot volume capacity when you create an instance from the CLI
Run the ibmcloud is instance-create
command and specify a boot volume capacity in GBs.
The following example creates an instance with a boot volume of 190 GB.
ibmcloud is instance create vsi-1 vpc-1 us-south-1 bx2-2x8 subnet-1 --image ibm-ubuntu-20-04-3-minimal-amd64-1 --boot-volume '{"name": "my-boot-vol-1", "volume": {"capacity": 190, "profile": {"name": "general-purpose"}}}'
Creating instance cli-vsi-1 under account VPC1 as user myuser@mycompany.com...
ID 0716_84f99419-554d-4c05-bea0-7034d1c40ed3
Name vsi-1
CRN crn:v1:bluemix:public:is:us-south-1:a/efe5afc483594adaa8325e2b4d1290df::instance:0716_84f99419-554d-4c05-bea0-7034d1c40ed3
Status pending
Availability policy on host failure restart
Startable true
Profile bx2-2x8
Architecture amd64
vCPU Manufacturer Intel
vCPUs 2
Memory(GiB) 8
Bandwidth(Mbps) 4000
Volume bandwidth(Mbps) 1000
Network bandwidth(Mbps) 3000
Metadata service enabled false
Image ID Name
9f6b534b-6061-40f4-ac42-5aba4dd0da7f ubuntu-20-04-3-minimal-amd64-1
VPC ID Name
r006-42ebadb6-65f8-4b2f-923b-50b0e44670df vpc-1
Zone us-south-1
Resource group ID Name
11caaa983d9c4beb82690daab08717e9 Default
Created 2022-02-24T16:43:47+05:30
Boot volume ID Name Attachment ID Attachment name
- PROVISIONING 0716-ee0ca315-7a21-42e2-99f7-b68377bbffe0 my-boot-vol1
You can also specify a larger boot volume capacity when you create an instance template from an image or snapshot. See the following example.
ibmcloud is instance template create tpl-1 vpc-1 us-south-1 bx2-2x8 cli-subnet-1 --image ubuntu-20-04-3-minimal-amd64-1 --boot-volume '{"name": "my-boot-vol1", "volume": {"capacity": 190, "profile": {"name": "general-purpose"}}}'
For more information about creating virtual server instances from the CLI, see Creating virtual server instances from the CLI. For more information about the commands that are used for increasing boot volume size, see the VPC CLI reference.
Increasing the capacity of an existing boot volume from the CLI
From the CLI, locate the boot volume that you want to expand. You can use the ibmcloud is volumes
command filter the results by specifying the resource group. Also, if you know the name or ID of the instance, you can view instance
details and get information about the boot volume.
After you located the volume, use the volume-update
command and provide the ID or name of the boot volume. Use the --capacity
parameter to indicate the new size of the boot volume in GBs.
For example, this example increases the capacity of my-boot-vol1 to 200 GB. The existing capacity displays as the boot volume capacity is being expanded. Run the ibmcloud is volume
command and specify the volume name to see the
new capacity.
ibmcloud is volume update my-boot-vol-1 --capacity 200
Updating volume my-boot-vol1 under account VPC1 as user myuser@mycompany.com...
ID 9d60ba27-170c-4e2a-9bf6-6dbb11f95c38
Name my-boot-vol1
CRN crn:v1:bluemix:public:is:us-south-1:a/efe5afc483594adaa8325e2b4d1290df::volume:9d60ba27-170c-4e2a-9bf6-6dbb11f95c38
Status updating
Capacity 190
IOPS 3000
Bandwidth(Mbps) 393
Profile general-purpose
Encryption key -
Encryption provider_managed
Resource group Default
Created 2022-02-24T16:43:47+05:30
Zone us-south-1
Volume Attachment Instance Reference Attachment type Instance ID Instance name Auto delete Attachment ID Attachment name
boot 0716_84f99419-554d-4c05-bea0-7034d1c40ed3 vsi-1 true 0716-ee0ca315-7a21-42e2-99f7-b68377bbffe0 boot-vol-name
Operating system ubuntu-20-04-amd64
Source image ID Name
9f6b534b-6061-40f4-ac42-5aba4dd0da7f ubuntu-20-04-3-minimal-amd64-1
Active true
Busy false
Tags -
Increase boot volume capacity with the API
Increase boot volume capacity when you create an instance with the API
When you create an instance by making a POST \instances
request, you can specify larger boot volume capacity for any of these contexts: when you create the instance from an image, a source boot volume, or an instance template.
Specify a boot volume name and capacity in the boot-volume-attachment
property. The capacity for the boot volume must be at least the image's minimum provisioned size, which is the default if you don't specify capacity.
The following example creates a virtual server instance from an image, with a boot volume that has 250 GB capacity.
curl -X POST "$vpc_api_endpoint/v1/instances?version=2022-02-01&generation=2"\
-H "Authorization: $iam_token"\
-d '{
"boot_volume_attachment": {
"volume": {
"capacity": 250",
"encryption_key": {
"crn": "crn:[...]"
},
"name": "my-boot-volume",
"profile": {
"name": "general-purpose"
}
}
},
"image": {
"id": "9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366"
},
.
.
.
}'
For more information, see Create an instance in the VPC API reference.
Increasing the capacity of an existing boot volume with the API
With the API, locate the boot volume that you want to expand by making a GET \volumes
call. Then, make a PATCH \volumes
call with the ID of the boot volume and specify a new value for capacity.
For example, this call increases the capacity of a boot volume to 250 GB.
curl -X PATCH "$vpc_api_endpoint/v1/volumes/$volume_id/?version=2022-02-12&generation=2"\
-H "Authorization: $iam_token" \
-d '{
"capacity": 250,
}'
Increasing the capacity of an existing boot volume with Terraform
To increase the capacity of a boot volume, use the ibm_is_volume
resource. When it's applied, the following example updates the capacity of the volume to 250 GB.
resource "ibm_is_volume" "boot-volume-example" {
name = "my-boot-volume"
size = 250
profile = "general-purpose"
zone = "us-south-2"
}
For more information about the arguments and attributes, see ibm_is_volume.
Modifying OS to use the increased capacity
After you expand the boot volume capacity, you have to make your OS recognize the capacity increase. You must independently grow the disk partition, and then increase the file system into the partition.
For more information about expanding the file system, see your OS Documentation. For example,
Modifying a Linux OS for expanded boot volumes
The following example is based on CentOS Linux 7. Instructions for other Linux distributions can vary. After you increased the volume capacity from 100 GB to 250 GB, you can log in to the virtual server instance to validate the increase. Then, increase the partition and then expand the file system on the volume.
Extending a file system is a moderately risky operation. Consider taking a snapshot of the volume to prevent data loss.
-
Establish an SSH connection to your virtual server instance by using the floating IP address that is assigned to the instance. For more information, see Connecting to Linux instances.
-
Run the
lsblk
command to see the list of attached storage volumes. In the following example,vda
is the expanded boot volume, andvdc
is the attached Block Storage for VPC data volume. Thevdb
disk is an instance storage volume. You can see that the partitions on thevda
disk remained unchanged, although the overall size is increased to 250G.[root@docs-demo-instance ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 250G 0 disk ├─vda1 253:1 0 200M 0 part /boot/efi └─vda2 253:2 0 99.8G 0 part / vdb 253:16 0 69.9G 0 disk vdc 253:32 0 1.2T 0 disk /myvolumedir vdd 253:48 0 370K 0 disk vde 253:64 0 44K 0 disk
-
Issue the
growpart
command to grow the partition size to cover the maximum available space.- By using the
--dry-run
option, you can preview the changes before you perform the partition update.[root@docs-demo-instance ~]# growpart /dev/vda 1 --dry-run NOCHANGE: partition 1 is size 409600. it cannot be grown [root@docs-demo-instance ~]# growpart /dev/vda 2 --dry-run CHANGE: partition=2 start=411648 old: size=209303552 end=209715200 new: size=523876319 end=524287967 # === old sfdisk -d === # partition table of /dev/vda unit: sectors /dev/vda1 : start= 2048, size= 409600, Id=ef /dev/vda2 : start= 411648, size=209303552, Id=83, bootable /dev/vda3 : start= 0, size= 0, Id= 0 /dev/vda4 : start= 0, size= 0, Id= 0 # === new sfdisk -d === # partition table of /dev/vda unit: sectors /dev/vda1 : start= 2048, size= 409600, Id=ef /dev/vda2 : start= 411648, size=523876319, Id=83, bootable /dev/vda3 : start= 0, size= 0, Id= 0 /dev/vda4 : start= 0, size= 0, Id= 0
- Update the partition size of the boot volume as shown in the following example.
[root@docs-demo-instance ~]# growpart /dev/vda 2 CHANGED: partition=2 start=411648 old: size=209303552 end=209715200 new: size=523876319 end=524287967
- By using the
-
Issue the command
lsblk
to verify that the partition is resized. The following example shows that thevda2
partition is successfully increased in size.[root@docs-demo-instance ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 250G 0 disk ├─vda1 253:1 0 200M 0 part /boot/efi └─vda2 253:2 0 249.8G 0 part / vdb 253:16 0 69.9G 0 disk vdc 253:32 0 1.2T 0 disk /myvolumedir vdd 253:48 0 370K 0 disk vde 253:64 0 44K 0 disk
However, the file system still sees the
vda2
partition as 99G instead of 249G.[root@docs-demo-instance ~]# df -kh Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 385M 3.5G 10% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda2 99G 1.3G 92G 2% / /dev/vda1 200M 12M 189M 6% /boot/efi /dev/vdc 1.2T 71M 1.2T 1% /myvolumedir tmpfs 783M 0 783M 0% /run/user/0
-
Resize the file system on the partition with the
resize2fs
command.[root@docs-demo-instance ~]# resize2fs /dev/vda2 resize2fs 1.42.9 (28-Dec-2013) Filesystem at /dev/vda2 is mounted on /; on-line resizing required old_desc_blocks = 13, new_desc_blocks = 32 The filesystem on /dev/vda2 is now 65484539 blocks long.
-
Verify that the file system is expanded. In the example, you can see that the size of
vda2
increased.[root@docs-demo-instance ~]# df -kh Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 385M 3.5G 10% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda2 246G 1.3G 234G 1% / /dev/vda1 200M 12M 189M 6% /boot/efi /dev/vdc 1.2T 71M 1.2T 1% /myvolumedir tmpfs 783M 0 783M 0% /run/user/0
Next steps
Create more volumes or manage your existing Block Storage volumes.
Optionally, increase the capacity of your data volumes that are attached to a virtual server instance.