Extending the Partition for a Block Volume
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.
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.
After you have resized a volume, you need to attach it to an instance before you can extend the partition and grow the file system. See Attaching a Volume and Connecting to a Volume for more information.
Extending the Linux Partition
To identify the volume that you want to extend the partition for, run the following command to list the attached block volumes:
Run the following command to edit the volume's partition table with
<volume_id> is the volume identifier, for example
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:
(parted) unit s
Run the following command to display the current partitions in the partition table:
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:
(parted) rm <partition_number>
<partition_number> is the value from the Number column.
Run the following command to recreate the partition:
Start?prompt, specify the value from the Start column. At the
File system type?prompt, specify the value from the File system column. Specify
Run the following command to exit
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:
After you extend the root partition you need to grow the file system. The steps in the following procedure apply only to xfs file systems.
Before you grow the file system, repair any issues with the file system on the extended partition by running the following command:
<partition_id> is the partition identifier, for example
/dev/sdc1. See Checking and Repairing an XFS File System for more information.
After you have confirmed that there are no more issues to repair, you need to create a mount point to run the
xfs_growfsagainst. To do this, create a directory and mount the partition to that directory by running the following commands:
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
After you have created the mount point run the following command to grow the file system:
xfs_growfs -d <directory_name>
<directory_name> is the name for the directory you created in the previous step, for example
To verify that the file system size is correct, run the following command to display the file system details:
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, or Windows Server 2019 are the same, and are described in the following procedures.
Open the Disk Management system utility on the instance.
Right-click the expanded block volume and select Extend Volume.
Follow the instructions in the Extend Volume Wizard:
Select the disk that you want to extend, enter the size, and then click Next.
Confirm that the disk and size settings are correct, and then click Finish.
Verify that the block volume's disk has been extended in Disk Management.
Open a command prompt as administrator on the instance.
Run the following command to start the DISKPART utility:
DISKPARTprompt, run the following command to display the instance's volumes:
Run the following command to select the expanded block volume:
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:
<increased_size_in_MB> is the size in MB that you want to extend the partition to.Warning
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: