9 Managing Storage Volumes

About Storage Volumes

A storage volume is a virtual disk that provides persistent block storage space for instances in Compute Classic.

You can use storage volumes to store data and applications.

You can also associate a storage volume with a machine image and then, while creating an instance, you can specify that volume as a persistent boot disk for the instance.

  • When you create a storage volume, you can specify the capacity that you need. The allowed range is from 1 GB to 2 TB, in increments of 1 GB.

  • You can attach one or more storage volumes to an instance either while creating the instance or later, while the instance is running.

  • After creating an instance, you can easily scale up or scale down the block storage capacity for the instance by attaching or detaching storage volumes. However, you can’t detach a storage volume that was attached during instance creation. Note that, when a storage volume is detached from an instance, data stored on the storage volume isn’t lost.

There are certain limitations in using storage volumes with your instances:

  • Each storage volume can be up to 2 TB in capacity and you can attach up to 10 storage volumes to each instance. So there is an upper limit on the capacity of block storage that you can add to an instance.

  • A storage volume can be attached in read-only mode to only one instance. So multiple instances can’t write to a volume.

To provide highly scalable and shared storage in the cloud over NFSv4 for your instances, consider using Oracle Cloud Infrastructure Storage Software Appliance – Cloud Distribution. This appliance is provisioned on a Compute Classic instance and plays the role of a file server in the cloud. It provides shared, highly scalable, low-cost, and reliable storage capacity in Oracle Cloud Infrastructure Object Storage Classic for your Compute Classic instances running Oracle Linux. For information about the use cases that the appliance is best suited for, see About Oracle Cloud Infrastructure Storage Software Appliance– Cloud Distribution in Using Oracle Cloud Infrastructure Storage Software Appliance.

Creating a Storage Volume

A storage volume is a virtual disk that provides persistent block storage space for instances in Compute Classic. You can create storage volumes and attach them to instances to provide block storage capacity for storing data and applications. You can also associate a storage volume with a machine image, and then use the storage volume as the boot disk for an instance.

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.

Note:

When an instance is deleted and re-created or shut down and restarted, storage volumes that were attached manually (that is, not attached automatically through the orchestration that was used to create the instance) must be attached again.

Tip:

Before you begin, read the storage-related recommendations in Best Practices for Using Compute Classic.

  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. Click Create Storage Volume.
  4. Select or enter the required information:
    • Enter a name for the storage volume. Note this name. You’ll need it later to search for the storage volume on the Storage page.

      Pick a name that you can use later to quickly identify the key characteristics of the storage volume.

    • To make this storage volume a boot disk, select a machine image in the Boot Image field. Later, while creating an instance, you can specify this volume as the boot disk for the instance.

      If you select a machine image with a large disk size, it may take a while for the storage volume to be created.

    • Enter the size, in GB, of the storage volume. The allowed range is 1 GB to 2 TB.

      Consider the storage capacity needs of the applications that you plan to deploy on the instance, and leave some room for attaching more storage volumes in the future. This approach helps you use the available block storage capacity efficiently in the long run.

      If you intend to use this storage volume as a boot disk, then the size must be at least 5% higher than the boot image disk size.

      Note:

      You can increase the size of a storage volume after creating it, even if the storage volume is attached to an instance. See Increasing the Size of a Storage Volume. However, you can’t reduce the size of a storage volume after you’ve created it. So ensure that you don’t overestimate your storage requirement.

    • Select a storage property.

      Based on your latency and IOPS requirements, select one of the following storage properties.
      Storage Property Latency Throughput
      storage/default Standard Standard
      storage/latency Low High
      storage/ssd/gpl Lowest Highest

      If you select the storage property storage/latency, an SSD write cache is provided. When you hit this cache, you experience very high performance. When you miss the cache, you experience the same performance as you would if you had selected the storage/default property.

      If you select the storage property storage/ssd/gpl, you experience consistent high performance at all times, because the SSD cache is always used. This means that under high load conditions, a storage volume created with the property storage/ssd/gpl performs better than a storage volume created with the property storage/latency.

      Note:

      SSD storage volumes aren’t available in all sites.

      The web console might show other storage properties. Don’t select any of them.

    • Enter a description for the storage volume.
  5. Click Create.

    The Storage page is displayed.

While the new storage volume is being created, the Status field for the storage volume shows Initializing.

When the storage volume is ready, the Status field changes to Online.

To view details of the new storage volume, search for it by using the name that you noted earlier. From the menu icon menu, select View.

To create a storage volume using the CLI, use the opc compute storage-volume add command. To attach a storage volume to an instance, you must add a storage attachment object, by using the opc compute storage-attachment add command. For help with these commands, run each 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 create a storage volume using the API, use the POST /storage/volume/ method. To attach a storage volume to an instance, you must add a storage attachment object, by using the POST /storage/attachment/ method. For more information about these API methods, see REST API for Oracle Cloud Infrastructure Compute Classic.

After creating a storage volume, you must attach the storage volume to an instance and then mount the storage volume on the instance. See Attaching a Storage Volume to an Instance and Mounting and Unmounting a Storage Volume.

Creating a Bootable Storage Volume

A storage volume is a virtual disk that provides persistent block storage space for instances in Compute Classic. While creating a storage volume, you can associate it with a machine image and later use this storage volume as the boot disk for an instance. When you boot an instance from such a storage volume, any changes you make to the boot disk aren’t lost when the instance is deleted and re-created..

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.

  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. Click Create Storage Volume.
  4. Select or enter the required information:
    • Enter a name for the storage volume. Note this name. You’ll need it later to search for the storage volume on the Storage page.

      Pick a name that you can use later to quickly identify the key characteristics of the storage volume. For example, consider a name such as boot-OL66-20G for a bootable storage volume with an Oracle Linux 6.6 machine image on a 20-GB disk).

    • Select a machine image in the Boot Image field.

      If you select a machine image with a large disk size, it may take a while for the storage volume to be created.

    • Enter the size, in GB, of the storage volume. The allowed range is 1 GB to 2 TB.

      The size you enter must be at least 5% higher than the boot image disk size.

      Note:

      You can increase the size of a storage volume after creating it, even if the storage volume is attached to an instance. See Increasing the Size of a Storage Volume. However, you can’t reduce the size of a storage volume after you’ve created it. So ensure that you don’t overestimate your storage requirement.

    • Select a storage property.

      Based on your latency and IOPS requirements, select one of the following storage properties.
      Storage Property Latency Throughput
      storage/default Standard Standard
      storage/latency Low High
      storage/ssd/gpl Lowest Highest

      Note:

      SSD storage volumes aren’t available in all sites.

      The web console might show other storage properties. Don’t select any of them.

    • Enter a description for the storage volume.
  5. Click Create.

    The Storage page is displayed.

While the new storage volume is being created, the Status field for the storage volume shows Initializing.

When the storage volume is ready, the Status field changes to Online. You can then specify this storage volume as the boot disk while creating an instance.

To view details of the new storage volume, search for it using the name you noted earlier. From the menu icon menu, select View.

To create a storage volume using the CLI, use the opc compute storage-volume add command. To attach a storage volume to an instance, you must add a storage attachment object, by using the opc compute storage-attachment add command. For help with these commands, run each 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 create a storage volume using the API, use the POST /storage/volume/ method. To attach a storage volume to an instance, you must add a storage attachment object, by using the POST /storage/attachment/ method. For more information about these API methods, see REST API for Oracle Cloud Infrastructure Compute Classic.

Attaching a Storage Volume to an Instance

You can provide or increase block storage capacity for an instance by attaching storage volumes.

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.

  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. Identify the storage volume that you want to attach. From the menu icon menu, select Attach Instance.
  4. Select the instance to which you want to attach the volume.
  5. The Attach as Disk # field is filled automatically with the next available index at which the volume can be attached. You can leave this field at the automatically selected disk number or enter a higher number up to 10.

    The disk number that you specify here determines the device name. The disk attached at index 1 is named /dev/xvdb, the disk at index 2 is /dev/xvdc, the disk at index 3 is /dev/xvdd, and so on.

    Make a note of the disk number. You’ll need it later when you mount the storage volume on the instance.

  6. Click Attach.

You can also attach a storage volume to a running instance from the Instances page. See Attaching a Storage Volume to an Instance.

To attach a storage volume to a running instance using the CLI, use the opc compute storage-attachment add 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 attach a storage volume to a running instance using the API, use the POST /storage/attachment/ method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.

After attaching a storage volume to an instance, to access the block storage, you must mount the storage volume on your instance. See Mounting and Unmounting a Storage Volume.

Viewing Details of a Storage Volume

You can use the web console to view details of a storage volume, such as the status, size, and the instance to which it is attached.

To complete this task, you must have the Compute_Monitor or 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.

  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.

    All storage volumes are displayed, along with information about each storage volume.

    Tip:

    You can filter the list of storage volumes according to their category or status. To view storage volumes with a specific status (such as online, offline, or attached), click the Show menu and select the appropriate filter. To view storage volumes of a specific category (such as IaaS, PaaS, or Personal), click the Category menu and select the appropriate filter.

  3. Go to the storage volume that you want to view. From the menu icon menu, select View.

To view the details of a storage volume using the CLI, use the opc compute storage-volume get 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 view the details of a storage volume using the API, use the GET /storage/volume/name method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.

Mounting and Unmounting a Storage Volume

Mounting a Storage Volume on a Linux Instance

To access a storage volume, you must attach it to your instance and mount it.

For the steps to mount a volume on a Windows instance, see Mounting a Storage Volume on a Windows Instance.

For the steps to mount a volume on an Oracle Solaris instance, see Mounting a Storage Volume on an Oracle Solaris Instance.

Note:

When an instance is deleted and re-created or shut down and restarted, storage volumes that were attached manually (that is, not attached automatically through the orchestration that was used to create the instance) must be attached again.

When an instance that’s set up to boot from a nonpersistent boot disk is re-created, all the storage volumes attached to the instance must be mounted again.

Prerequisites

Procedure

  1. Log in to the instance.
  2. List the devices available on your instance:
    ls /dev/xvd*
    Device names start from /dev/xvdb and 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.
  3. Identify the device name corresponding to the disk number that you want to mount.

    For example, if you want to mount the storage volume that you had attached at index 3, the device name would be /dev/xvdd.

  4. When mounting a storage volume for the first time, after formatting the storage volume, use a tool such as mkfs to create a file system on the storage volume. For example, to create an ext3 file system on /dev/xvdd, run the following command:
    sudo mkfs -t ext3 /dev/xvdd

    Note:

    If the Extended File System utilities aren’t available on your instance, a message such as the following is displayed:

    mkfs.ext3: No such file or directory

    To install the Extended File System utilities, run the following command:

    sudo yum install e4fsprogs

  5. Create a mount point on your instance. For example, to create the mount point /mnt/store, run the following command:
    sudo mkdir /mnt/store
  6. Mount the storage volume on the mount point that you created on your instance. For example, to mount the device /dev/xvdd at the /mnt/store directory, run the following command:
    sudo mount /dev/xvdd /mnt/store

    If you prefer, you can specify the disk UUID instead of the device name in the mount command. To find out the UUID of the disks attached to your instance, run the blkid command.

  7. To make the mount persistent across instance restarts, edit the /etc/fstab file and add the mount as an entry in that file.

    Note:

    When an instance that’s set up to boot from a nonpersistent boot disk is deleted and re-created, any mount points that you defined are lost. You must create the mount points again.

Unmounting a Storage Volume from a Linux Instance

To detach a storage volume from your instance, or to delete the instance that a storage volume is attached to, you must first unmount the storage volume.

Note:

For the steps to unmount a volume from a Windows instance, see Unmounting a Storage Volume from a Windows Instance.

For the steps to unmount a volume from an Oracle Solaris instance, see Unmounting a Storage Volume from an Oracle Solaris Instance.

To unmount a storage volume from a Linux instance:

  1. Identify the disk number of the storage volume that you want to unmount. See Viewing Details of a Storage Volume.
  2. Log in to the instance. See Accessing an Oracle Linux Instance Using SSH.
  3. List the devices available on your instance and their mount points:
    sudo df -hT
       Filesystem    Type    Size  Used Avail Use% Mounted on
       /dev/xvdb2    ext4     16G  2.9G   12G  20% /
       tmpfs        tmpfs    3.7G     0  3.7G   0% /dev/shm
       /dev/xvdb1    ext4    194M   90M   94M  49% /boot
       /dev/mapper/vg_binaries-lv_tools
                     ext4    9.9G  156M  9.2G   2% /u01/app/oracle/tools
       /dev/mapper/vg_backup-lv_backup
                     ext4     20G  4.0G   15G  21% /u01/data/backup
       /dev/mapper/vg_domains-lv_domains
                     ext4    9.9G  1.2G  8.3G  12% /u01/data/domains
       /dev/mapper/vg_binaries-lv_mw
                     ext4    9.9G  2.0G  7.4G  21% /u01/app/oracle/middleware
       /dev/mapper/vg_binaries-lv_jdk
                     ext4    2.0G  334M  1.6G  18% /u01/jdk
    
    Device names start from /dev/xvdb and 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, then 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.

    Note:

    For an instance that’s set up to boot from a nonpersistent boot disk, /dev/xvda is used for the boot disk.

  4. Identify the device name corresponding to the disk number that you want to unmount, and note the mount point for that device.

    For example, to unmount the storage volume that is attached at index 3, you must unmount /dev/xvdd.

  5. Run the umount command.

    sudo umount mount_point

    For example, to unmount the device mounted at /mnt/store, run the following command:

    sudo umount /mnt/store
  6. If you had defined this mount point in /etc/fstab file, then edit /etc/fstab and remove the mount.
If you no longer need the volume that you just unmounted, then you can detach it from the instance and delete it. See Detaching a Storage Volume from an Instance and Deleting a Storage Volume.

Mounting a Storage Volume on an Oracle Solaris Instance

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

After attaching a storage volume to your Oracle Solaris instance, to be able to access the new disk, you must mount it. You do this by creating a ZFS storage pool using the disk that you want to mount.

Note:

When an instance is deleted and re-created or shut down and restarted, storage volumes that were attached manually (that is, not attached automatically through the orchestration that was used to create the instance) must be attached again.

When an instance that’s set up to boot from a nonpersistent boot disk is re-created, all the storage volumes attached to the instance must be mounted again.

The steps to mount a storage volume on an Oracle Solaris instance vary depending on whether a ZFS storage pool exists for the volume.
  • If the storage volume that you want to mount was attached previously to any Oracle Solaris instance, or if you’re not sure about this, then start with the steps in Importing a ZFS Storage Pool.

  • If the storage volume that you want to mount has just been created, or if you’re sure that it has never been attached previously to any Oracle Solaris instance, then proceed to Creating a ZFS Pool.

Importing a ZFS Storage Pool

Complete the steps in this section if the storage volume that you want to mount was attached previously to any Oracle Solaris instance or if you’re not sure about that. Otherwise, go to Creating a ZFS Pool.

  1. Identify and make a note of the disk number of the storage volume that you want to mount.

    See Viewing Details of a Storage Volume.

  2. Log in to the instance on which you want to mount the storage volume.

    See Accessing an Oracle Solaris Instance Using SSH.

  3. Assume the root role, by running the following command:

    su -

    When prompted, enter the root password.

    Note:

    If this is the first time that you’re assuming the root role on the instance, then a prompt to change the password is displayed. Change the password as prompted and then proceed.

  4. Run the following command:

    zpool import

  5. Examine the output of the command:
    • If the command returns the message no pools available to import, then proceed to Creating a ZFS Pool.

    • If the command lists one or more pools, then pick the pool that you want to import.
      Here’s an example of the output of the zpool import command:
        pool: mypool2
          id: 14352758040898370875
       state: ONLINE
      action: The pool can be imported using its name or numeric identifier.
      config:
      
              mypool2    ONLINE
                c2t2d0  ONLINE
      
        pool: mypool3
          id: 1124470769081803325
       state: ONLINE
      action: The pool can be imported using its name or numeric identifier.
      config:
      
              mypool3    ONLINE
                c2t3d0  ONLINE
      

    In this example, two pools are available for importing: mypool2 (for disk c2t2d0) and mypool3 (for disk c2t3d0).

    In the disk names—that is, c2t2d0, c2t3d0, and so on—look at the t1, t2, t3, ... number. This number, technically known as the target number, matches the index that was specified when the volume was attached to the Oracle Solaris instance. For example, c2t3d0 is the disk that’s attached to the instance at index 3.

  6. Identify the disk that you want to mount, and note its pool name.

    For example, if you want to mount the storage volume that’s attached to the instance at index 3, then the disk in this example would be c2t3d0 in mypool3.

    Note:

    If the index number of the storage volume that you want to mount doesn’t match the target number of any of the disks listed by the zpool import command, then you must create a ZFS storage pool. See Creating a ZFS Pool.

  7. Import the ZFS pool that you noted earlier, by running the zpool import command, as shown in the following example:

    zpool import mypool3

    The storage volume and the ZFS file systems defined in it, if any, are now mounted on the instance.

  8. Verify that the volume is mounted.

    See Verifying that the Storage Volume is Mounted.

Creating a ZFS Pool

Complete the steps in this section if the storage volume that you want to mount has just been created, or if you’re sure that it has never been attached previously to any Oracle Solaris instance. Otherwise, see Importing a ZFS Storage Pool.

  1. Identify and make a note of the disk number of the storage volume that you want to mount.

    See Viewing Details of a Storage Volume.

  2. Log in to the instance on which you want to mount the storage volume.

    See Accessing an Oracle Solaris Instance Using SSH.

  3. Assume the root role, by running the following command: su -

    When prompted, enter the root password.

    Note:

    If this is the first time that you’re assuming the root role on the instance, then a prompt to change the password is displayed. Change the password as prompted and then proceed.

  4. Find out the names of the disks attached to your instance, by running the format command:

    format

    The following is an example of the output of this command:
    Searching for disks...done
    
    AVAILABLE DISK SELECTIONS:
           0. c2t1d0 <Unknown-Unknown-0001-34.00GB>
              /xpvd/xdf@51728
           1. c2t2d0 <Unknown-Unknown-0001-10.00GB>
              /xpvd/xdf@51744
           2. c2t3d0 <Unknown-Unknown-0001 cyl 1024 alt 0 hd 64 sec 32>
              /xpvd/xdf@51872
    Specify disk (enter its number):

    In this example, three disks are attached to the instance: c2t1d0, c2t2d0 and c2t3d0.

    In the disk names—that is, c2t2d0, c2t3d0, and so on—look at the t1, t2, t3, ... number. This number, technically known as the target number, matches the index that was specified when the volume was attached to the Oracle Solaris instance. For example, c2t3d0 is the disk that’s attached to the instance at index 3.

  5. Using the storage volume index number that you noted earlier, identify and make a note of the disk name of the storage volume that you want to mount.

    For example, if you want to mount the storage volume that was attached at index 3, then the disk name in this example would be c2t3d0.

  6. Kill the format process by pressing Ctrl+c.

  7. Create a ZFS storage pool for the disk that you want to mount:

    Command syntax: zpool create pool_name disk_file_name

    Command example: zpool create mypool3 c2t3d0

    The storage volume is now mounted on the instance. By default, the mount point is the name of the pool.

  8. If required, create ZFS file systems in the new ZFS storage pool.

    Command syntax: zfs create pool_name/filesystem_name

    Command example: zfs create mypool3/myfs1

    The ZFS file systems are mounted automatically. By default, the mount point of each file system is its name.

  9. To give the opc user access to the ZFS storage pool and its filesystems, make the opc user the owner of the mount by using the chown command, as shown in the following example:

    chown -R opc /mypool

  10. Verify that the volume is mounted.

    See Verifying that the Storage Volume is Mounted.

Verifying that the Storage Volume is Mounted

To verify that the ZFS pool and file systems are mounted, run the zfs mount command on the instance.

The following is an example of the output of the zfs mount command:
rpool/ROOT/solaris               /
rpool/ROOT/solaris/var           /var
rpool/VARSHARE                   /var/share
rpool/export                     /export
rpool/export/home                /export/home
rpool/export/home/opc            /export/home/opc
rpool                            /rpool
rpool/VARSHARE/zones             /system/zones
rpool/VARSHARE/pkg               /var/share/pkg
rpool/VARSHARE/pkg/repositories  /var/share/pkg/repositories
mypool3                           /mypool3
mypool3/myfs1                     /mypool3/myfs1
In this example,
  • The rpool entries are for the root pool that contains the boot disk of the instance.

  • mypool3 is the ZFS storage pool of the storage volume that you mounted. It is mounted at /mypool3.

  • mypool3/myfs1 is a filesystem in the ZFS storage pool, and it’s mounted at /mypool3/myfs1.

Unmounting a Storage Volume from an Oracle Solaris Instance

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

To detach a storage volume from your instance, or to delete the instance that a storage volume is attached to, you must first unmount the storage volume.

To unmount a storage volume from an Oracle Solaris instance:

  1. Identify and make a note of the disk number of the storage volume that you want to unmount. See Viewing Details of a Storage Volume.
  2. Log in to the instance. See Accessing an Oracle Solaris Instance Using SSH.
  3. Assume the root role, by running the following command:
    su -
    When prompted, enter the root password.
  4. Find out the names of the disks mounted on your instance and the ZFS pool to which each disk belongs, by running the following command:
    zpool status
    The following is an example of the output of this command:
      pool: mypool
     state: ONLINE
      scan: none requested
    config:
    
            NAME      STATE     READ WRITE CKSUM
            mypool    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
    
    In this example, two disks are mounted on the instance: c2t1d0 (in rpool) and c2t2d0 (in mypool)
    Focus on the t1, t2, ... number in the disk file names. This number corresponds to the index that was specified while attaching the storage volume to the instance.
  5. Identify and make a note of the disk file name of the storage volume that you want to unmount.

    For example, if you want to unmount the storage volume that was attached at index 2, then the disk file name in this example would be c2t2d0.

    Caution:

    rpool is the pool that contains the boot disk. Do NOT unmount it.

  6. Export the ZFS pool that contains the disk that you want to unmount:
    Command syntax: zpool export pool_name
    Command example: zpool export mypool
This command unmounts the ZFS pool and any file systems in it. To verify that the pool has been exported, run the zpool import command. The output shows that the pool that you exported is available for importing, as shown in the following example:
  pool: mypool
    id: 1124470769081803325
 state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

        mypool    ONLINE
          c2t2d0  ONLINE

If you no longer need the volume that you just unmounted, then you can detach it from the instance and delete it. See Detaching a Storage Volume from an Instance and Deleting a Storage Volume.

To mount the volume again, run the zpool import command, as shown in the following example:

zpool import mypool

See Also:

Mounting a Storage Volume on a Windows Instance

To access a storage volume from a Windows instance, you must attach the volume to the instance and mount it.

Note:

When an instance is deleted and re-created or shut down and restarted, storage volumes that were attached manually (that is, not attached automatically through the orchestration that was used to create the instance) must be attached again.

When an instance that’s set up to boot from a nonpersistent boot disk is re-created, all the storage volumes attached to the instance must be mounted again.

After attaching a storage volume to a Windows instance (see Attaching a Storage Volume to an Instance), mount it as follows:

  1. Log in to the Windows instance.
  2. From the Start menu, select Server Manager.
  3. Navigate to File and Storage Services, and from there to Volumes, and then Disks.
    The storage volumes that are attached to the instance are listed as disks.

    For newly attached disks, the Partition type would be Unknown and the Unallocated capacity would be equal to the total size of the disks.

    See the following example:
    Screenshot showing the Partition type and the Unallocated capacity of the disk

  4. Select the disk that you want to mount.
  5. If the Status of the disk is Offline, right-click and select Bring Online.
  6. At the confirmation prompt, click Yes.
  7. Wait until the status changes to Online.
    Refresh the page after a few seconds.

    You can now create partitions, format them, and assign each partition to a drive letter or folder.

  8. In the Volumes pane, click Tasks and select New Volume, as shown in the following example:
    Screenshot showing the New Volume option under Tasks in the Volumes pane

    Note:

    Don’t confuse the term volume that you see in Windows with the concept of storage volumes in Compute Classic.

    A storage volume in Compute Classic is a virtual disk that you can attach to an instance. In the context of Windows, a volume is essentially a partition on a disk that’s attached to a server. You can create multiple partitions on each storage volume that you attach to your Windows instance.

  9. Follow the instructions in the New Volume Wizard to complete creation of the partition.
    After the partition is created, it's displayed in the Volumes pane.
  10. Create more partitions, if required.
The new partitions are now available at the drive letters that you assigned while partitioning the disk, as shown in the following example:
Screenshot showing the new partitions

In this example, on a 1-GB storage volume attached to a Windows Server 2012 Standard instance, two 400-MB partitions were created, formatted, and assigned to the drives D and E.

For detailed instructions for managing disks & partitions (changing the drive assignment, changing the file system type, extending the partition or deleting it), see the Windows Server documentation.

Unmounting a Storage Volume from a Windows Instance

When you no longer need a storage volume for a Windows instance, you can take the disk offline and detach it from the instance.

To unmount a storage volume from a Windows instance:

  1. Log in to the Windows instance.
  2. From the Start menu, select Server Manager.
  3. Navigate to File and Storage Services, and from there to Volumes, and then Disks.
    The storage volumes that are attached to the instance are listed as disks.
  4. Select the disk that you want to unmount.
  5. Right-click and select Take Offline.
    Wait for a few seconds, until the Status of the disk changes to Offline.

    Note:

    The partitions and data on the disk are intact. You can either bring the disk online later on the same instance, or detach it from this instance and attach it to another instance.

For detailed instructions for managing disks and partitions, see the Windows Server documentation.

If you no longer need the volume that you just unmounted, then you can detach it from the instance and delete it. See Detaching a Storage Volume from an Instance and Deleting a Storage Volume.

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.

Detaching a Storage Volume from an Instance

A storage volume is a virtual disk that provides persistent block storage space for instances in Compute Classic. When you no longer require access to a storage volume, you can unmount it and detach it from your instance.

After you detach a storage volume from an instance, you can no longer read from or write data to the storage volume, unless you attach it to any instance.

Note:

You can’t detach or delete a storage volume that was attached while creating an instance.

If you’re sure that a storage volume is no longer required, then back up the data elsewhere and delete the storage volume.

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.

  • Ensure that you’ve unmounted the storage volume that you want to detach. See Unmounting a Storage Volume from a Linux Instance.

Procedure

  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 detach. From the menu icon menu, select Detach Instance.

You can also detach a storage volume from the Instances page. See Detaching a Storage Volume from an Instance.

To detach a storage volume from an instance using the CLI, you must remove a storage attachment object by using the opc compute storage-attachment delete 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 detach a storage volume from an instance using the API, you must remove a storage attachment object, by using the DELETE /storage/attachment/name method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.

Deleting a Storage Volume

If you delete a storage volume, all the data and applications that were saved on that storage volume are lost. Delete a storage volume only when you’re sure that you no longer need any of the data that’s stored on that volume.

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.

  • Ensure that the storage volume that you want to delete isn’t attached to any instance. See Detaching a Storage Volume from an Instance.

  • Ensure that there are no colocated snapshots of the storage volume that you want to delete. See Listing Storage Volume Snapshots.

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 delete 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.

If you created the object using orchestration v1, then you can delete the object by terminating the orchestration. See Terminating an Orchestration v1.

If you created the object using an orchestration v2, then you can delete the object by suspending, terminating, or updating the orchestration. See Suspending an Orchestration v2, Terminating an Orchestration v2, or Updating an Orchestration v2.

Procedure

  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 delete. From the menu icon menu, select Delete.

To delete a storage volume using the CLI, use the opc compute storage-volume delete 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 delete a storage volume using the API, use the DELETE /storage/volume/name method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.