Increasing the Size of a Storage Volume

After creating a storage volume, you can increase the size of a storage volume when the storage volume is online, even if the storage volume is already attached to an instance. The procedure to increase the storage volume varies depending on whether it has been created directly in the Storage page of the Compute Classic console or by using an orchestration.

Note:

You should always use your orchestrations to manage resources that you’ve created using orchestrations. Don’t, for example, use the web console or the CLI or REST API to update an object that you created using an orchestration. This could cause your orchestration to either attempt to re-create the object and associated resources, or to go into an error state. See Workflows for Updating Orchestrations v2.

Note:

If you increase the size of a storage volume that was created using an orchestration, then if you stop the orchestration and start it again later, the storage volume will be destroyed and re-created with the size originally specified in the orchestration.

Note:

If you increase the size of a storage volume that’s attached to an Oracle Solaris or a Windows instance, you’ll need to reboot the instance to make the additional storage available on the OS.

Prerequisites

  • To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

To increase the size of a storage volume that you have created directly in the Storage page of the Compute Classic console:

  1. Sign in to the Compute Classic console. If your domain spans multiple sites, select the appropriate site. To change the site, click the Site menu near the top of the page.
  2. Click the Storage tab.
  3. Go to the storage volume that you want to increase the size of. From the menu icon menu, select Update.
  4. In the Update Storage Volume dialog box, enter the required size in GB and the click Update.

    Note:

    You can only increase the size of the storage volume, you can’t reduce it. So you must enter a value larger than the current value.

  5. Make the increased storage available on the volume that is attached and mounted on an instance.
    • On an Oracle Linux instance, the increased size of the storage volume gets updated on the instance automatically. You can use the fdisk command to verify the updated size:
      1. Log in to the instance. See Accessing an Oracle Linux Instance Using SSH.

      2. Run sudo su.

      3. Run the ls command to list devices on your instance.

        ls /dev/xvd*

        Device names are determined by the index number that you assigned when you attached the storage volumes. For example, if you attached a storage volume at index 1, the volume gets the device name, /dev/xvdb. The storage volume at index 2 would be /dev/xvdc, the storage volume at index 3 would be /dev/xvdd, and so on.

      4. Identify the device name corresponding to the disk number of the storage volume that you’ve updated.

      5. Run the fdisk -l command to verify that the size of the storage volume has been updated. Here’s an example of the output of this command:

        Disk /dev/xvdc: 4294 MB, 4294967296 bytes
        255 heads, 63 sectors/track, 522 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
        Sector size (logical/physical): 512 bytes / 512 bytes
        I/O size (minimum/optimal): 512 bytes / 512 bytes
        Disk identifier: 0x00000000
        

        This output shows the size of /dev/xvdc as 4294 MB, which corresponds to a 4 GB storage volume.

    • On an Oracle Solaris instance: (Not available on Oracle Cloud at Customer)
      1. Log in to the instance. See Accessing an Oracle Solaris Instance Using SSH.

      2. Run su -.

      3. Run zpool status command to identify the storage pool that you want to expand. Here’s an example of the output of this command:

        opc@d7becf:~$ zpool status
          pool: mypool3
         state: ONLINE
          scan: none requested
        config:
        
                NAME      STATE     READ WRITE CKSUM
                mypool3   ONLINE       0     0     0
                  c2t2d0  ONLINE       0     0     0
        
        errors: No known data errors
        
          pool: rpool
         state: ONLINE
          scan: none requested
        config:
        
                NAME      STATE     READ WRITE CKSUM
                rpool     ONLINE       0     0     0
                  c2t1d0  ONLINE       0     0     0
        
        errors: No known data errors
        

        This output indicates that the disk c2t2d0 is in storage pool mypool3. Here the number c2t2d0, technically known as the target number, matches the index that was specified when the volume was attached to the Oracle Solaris instance. For example, c2t2d0 is the disk that’s attached to the instance at index 2.

      4. Set autoexpand to on for the ZFS storage pool.

        zpool set autoexpand=on mypool3

      5. Go to the Compute Classic web console and restart the instance. See Rebooting an Instance.

      6. Log in to the instance.

      7. Run the df -k mypool3 command to view the size of the storage volume before resizing. Here’s an example of the output of this command for the storage pool mypool3:

        Filesystem           1024-blocks        Used   Available Capacity  Mounted on
        mypool3                  6177024          32     6176880     1%    /mypool3
        

        This output shows the size of mypool3 as 6177024 blocks, which corresponds to a 6 GB storage volume.

      8. Run su -.

      9. Export and import the ZFS storage pool.

        zpool export mypool3
        zpool import mypool3
      10. Run the df -k command again to verify that the size of the storage volume has been updated. Here’s the output of this command for mypool3 after expanding the volume from 6 GB to 9 GB:

        Filesystem           1024-blocks        Used   Available Capacity  Mounted on
        mypool3                  9273600          32     9273453     1%    /mypool3
        

        This output shows the size of mypool3 as 9273600 blocks, which corresponds to a 9 GB storage volume.

    • On a Windows instance:
      1. Go to the Compute Classic web console and restart the instance. See Rebooting an Instance.

      2. Log in to the instance. See Accessing a Windows Instance Using RDP.

      3. If you have a Windows Server 2012 R2 instance, from the Start menu, select Server Manager.

        If you have a Windows Server 2008 R2 instance, from the Start menu, select All Programs and Administrative Tools, and then select Server Manager.

      4. Navigate to File and Storage Services, and from there to Volumes, and then Disks. The resized storage volume shows the updated size.


        Screenshot showing the updated size of the disk in a Windows instance

      5. To expand the volume on your Windows instance, select the volume in the Volumes pane. Click Tasks and select Extend Volume.


        Screenshot showing the Extend Volume option in the Volumes pane

      6. The Extend Volume dialog box shows the updated size of the storage volume as the maximum size. Specify the required size in the New size field and click OK.

        The volume is expanded to the specified size.


        Screenshot showing the Extend Volume dialog box with the updated size of the volume

To update a storage volume using the CLI, use the opc compute storage-volume update command. For help with that command, run the command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To update a storage volume using the API, use the PUT /storage/volume/name method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.