9 Managing Storage Volumes
Topics
- About Storage Volumes
- Creating a Storage Volume
- Creating a Bootable Storage Volume
- Backing Up and Restoring Storage Volumes Using Snapshots
- Scheduling Backups of Storage Volumes and Restoring from Backups
- Attaching a Storage Volume to an Instance
- Viewing Details of a Storage Volume
- Mounting and Unmounting a Storage Volume
- Increasing the Size of a Storage Volume
- Detaching a Storage Volume from an Instance
- Deleting a Storage Volume
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.
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, 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.
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, 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.
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.
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
Topics
- Mounting a Storage Volume on a Linux Instance
- Unmounting a Storage Volume from a Linux Instance
- Mounting a Storage Volume on an Oracle Solaris Instance
- Unmounting a Storage Volume from an Oracle Solaris Instance
- Mounting a Storage Volume on a Windows Instance
- Unmounting a Storage Volume from a Windows Instance
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
-
You have created the storage volume and attached it to your instance. See Attaching a Storage Volume to an Instance.
-
You know the disk number of the storage volume that you want to mount. See Viewing Details of a Storage Volume.
Procedure
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:
Mounting a Storage Volume on an Oracle Solaris Instance
This topic does not apply to Oracle Cloud at Customer.
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.
-
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.
- Identify and make a note of the disk number of the storage volume that you want to mount.
- Log in to the instance on which you want to mount the storage volume.
- 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. - Run the following command:
zpool import
- 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 diskc2t2d0
) andmypool3
(for diskc2t3d0
).In the disk names—that is,
c2t2d0
,c2t3d0
, and so on—look at thet1
,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. -
- 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
inmypool3
.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. - 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.
- Verify that the 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.
- Identify and make a note of the disk number of the storage volume that you want to mount.
- Log in to the instance on which you want to mount the storage volume.
- 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. - 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
andc2t3d0
.In the disk names—that is,
c2t2d0
,c2t3d0
, and so on—look at thet1
,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. - 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
. -
Kill the
format
process by pressing Ctrl+c. - 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.
- 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.
- To give the
opc
user access to the ZFS storage pool and its filesystems, make theopc
user the owner of the mount by using thechown
command, as shown in the following example:chown -R opc /mypool
- Verify that the 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.
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
-
The
rpool
entries are for theroot
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
This topic does not apply to Oracle Cloud at Customer.
To unmount a storage volume from an Oracle Solaris instance:
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:
- Exporting a ZFS Storage Pool in Managing ZFS File Systems in Oracle Solaris 11.3.
- Importing a ZFS Storage Pool in Managing ZFS File Systems in Oracle Solaris 11.3.
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:
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:
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:
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
- 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.
- Click the Storage tab.
- Go to the storage volume that you want to detach. From the 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
- 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.
- Click the Storage tab.
- Go to the storage volume that you want to delete. From the 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.