The Oracle Cloud Infrastructure Block Volume service lets you expand the size of block volumes with offline volume resizing. For more information, see Resizing a Volume. In order to take advantage of the larger volume size, you need to extend the partition for the block volume. For boot volumes, see Extending the Partition for a Boot Volume.
Note
After a volume has been resized, the first backup on the resized volume will be a full backup. See Volume Backup Types for more information about full versus incremental volume backups.
Required IAM Policy
Extending a partition on an instance does not require a specific IAM policy. However, you may need permission to run the necessary commands on the instance's guest OS. Contact your system administrator for more information.
Extending the Partition for a Block Volume on a Linux-Based Image 🔗
On Linux-based images, use the following steps to extend the partition for a block volume.
To identify the volume that you want to extend the partition for, run the following command to list the attached block volumes:
Copy
lsblk
Run the following command to edit the volume's partition table with parted:
Copy
parted <volume_id>
<volume_id> is the volume identifier, for example /dev/sdc.
When you run parted, you may encounter the following error message:
Warning: Not all of the space available to <volume_id> appears to be used,
you can fix the GPT to use all of the space (an extra volume_size blocks)
or continue with the current setting?
You are then prompted to fix the error or ignore the error and continue with the current setting. Specify the option to fix the error.
Run the following command to change the display units to sectors so that you can see the precise start position for the volume:
Copy
(parted) unit s
Run the following command to display the current partitions in the partition table:
Copy
(parted) print
Make note of the values in the Number, Start, and File system columns for the root partition.
Run the following command to remove the existing root partition:
Copy
(parted) rm <partition_number>
<partition_number> is the value from the Number column.
Run the following command to recreate the partition:
Copy
(parted) mkpart
At the Start? prompt, specify the value from the Start column. At the File system type? prompt, specify the value from the File system column. Specify 100% for the End? prompt.
Run the following command to exit parted:
Copy
(parted) quit
This command forces a rewrite of the partition table with the new partition settings that you specified.
To verify that the root partition was extended, run the following command to list the attached block volumes:
Copy
lsblk
After you extend the root partition you need to grow the file system. Use the
steps applicable to your file system in the following procedure.
After you have confirmed that there are no more issues to repair, you need to create a mount point to run the xfs_growfs against. To do this, create a directory and mount the partition to that directory by running the following commands:
Copy
mkdir <directory_name>
mount <partition_id><directory_name> -o nouuid
<partition_id> is the partition identifier, for example /dev/sdc1, and <directory_name> is the directory name, for example data.
After you have created the mount point run one of the following commands
to grow the file system.
For XFS file systems:
Copy
xfs_growfs -d <directory_name>
<directory_name> is the name for the directory you
created in the previous step, for example data.
For ext* file systems:
Copy
resize2fs <partition_id>
<partition_id> is the partition identifier.
To verify that the file system size is correct, run the following command to display the file system details:
Copy
df -lh
Extending the Partition for a Block Volume on a Windows-Based Image 🔗
On Windows-based images, you can extend a partition using the Windows interface or from the command line using the DISKPART utility.
Windows Server 2012 and Later Versions
The steps to extend a partition for a block volume attached to an instance running Windows Server 2012, Windows Server 2016, Windows Server 2019, or Windows Server 2022 are the same, and are described in the following procedures.
Open a command prompt as administrator on the instance.
Run the following command to start the DISKPART utility:
Copy
diskpart
At the DISKPART prompt, run the following command to display the instance's volumes:
Copy
list volume
Run the following command to select the expanded block volume:
Copy
select volume <volume_number>
<volume_number> is the number associated with the block volume that you want to extend the partition for.
Run the following command to extend the partition:
Copy
extend size=<increased_size_in_MB>
<increased_size_in_MB> is the size in MB that you want to extend the partition to.
Caution
When using the DISKPART utility, do not overextend the partition beyond the current available space. Overextending the partition could result in data loss.
To confirm that the partition was extended, run the following command and verify that the block volume's partition has been extended: