Block volumes provide a networked storage solution for your Oracle Cloud Infrastructure instances. Once you have created, connected, and mounted a volume to your instance, you can use it as if it were a physical hard disk on your computer. You can only attach a volume to one instance at a time, but you can detach it from one instance and connect it to another while your data remains intact and undamaged.
This tutorial will show you how to create a volume, connect it to an instance, and then attach the volume to the instance.
Open the navigation menu and click Storage. Under Block Storage, click Block Volumes.
Click Create Block Volume.
In the Create Block Volume dialog box, enter the following:
Create in Department: This field defaults to your current department. If not preselected, select the department in which you want to create the volume.
Name: Enter a user-friendly name. Avoid entering confidential information.
Availability Domain: Select the same availability domain as your instance. If you follow the tutorial instructions to launch an instance, this will be the first ad in the list. The volume and instance must be in the same availability domain.
Size: Enter 50 to create a 50 GB block storage volume.
Backup Policy: Do not select a backup policy.
Label: Keep the label field empty.
Click Create Block Volume. A 50 GB block volume will appear in the configured state. When the volume is no longer in the configured state, you can connect it to your instance.
Next, you will connect the volume to your instance via an iSCSI network connection:
Find your instance: Open the navigation menu and click Calculate. Under Calculations, click Instances.
Click on your instance name to view its details.
In the Resources section, click the attached block volume.
Click Attach Block Volume.
Enter the following:
Storage Volume: Select the Select Storage Volume option.
If you need to change the department, click Change Department, and then select the department for which you want to create the block volume.
Storage volumes in the departmental compartment>: Select a block volume from the list.
Connection Type: Select iSCSI.
CHAP credentialsCHAP credentials: Keep unchecked.
Tip: CHAP is a security protocol. In this tutorial, you can keep this box unchecked. When setting up your production environment, Oracle recommends that you require CHAP credentials.
Device paths: If your instance supports consistent device paths, you'll see a list of device paths. Select one from the list.
Access Permissions: Select Read and Write.
1.Click Connectattach。The connection process takes about a minute. When the storage volume is attachedattachment stateWhen it shows as connected, you know the volume is ready.
After the storage volume is attached, you can configure the iSCSI connection. useiscsiadm
The command-line tool is connected to the storage volume. The commands required for configuration, authentication, and login are provided by the console, so you can easily copy and paste them into the instance session window. Once the connection configuration is complete, you can mount the storage volume on the instance and use it as if it were a physical hard disk.
Connected to your storage volume:
Follow the instructions in "Connect to your instance" to sign in to your instance.
Open the navigation menu and click Calculate. Under Calculations, click Instances.
Click on your instance name to view its details.
In the Resources section, click the attached block volume.
Click the Actions menu (..) next to the volume you just connectedThen click on iSCSI Commands & Messages.
The iSCSI Command & Info dialog box is displayed. Note that the dialog box displays specific identifying information about your storage volume, such as IP address and port, as well as the iSCSI command you need to use. These commands are ready to use, and the appropriate information is already included in each command.
Connect command to configure the iSCSI connection and log in to iSCSI. Copy and paste each command in the Connections list into the instance session window.
Make sure to paste and run each command one by one. There are three additional commands. Each command starts with sudo iscsiadm.
Once you have entered the last command to log in to iSCSI, you are ready to format (if needed) and mount the storage volume. To get the list of iSCSI devices that can be mounted on the instance, run the following command:
sudo fdisk -l
If your disk is successfully connected, you will see the following in the returned list: Disk dev sdb:500 GB, 50010783744 bytes, 97677312 sectors Units = 1 * 512 = 512 bytes per sector Sector size (logical, physical): 512 bytes 512 bytes i o size (minimum optimum): 4096 bytes 1048576 bytes.
disk /dev/sdb: 50.0 gb, 50010783744 bytes, 97677312 sectors units = sectors of 1 * 512 = 512 bytes sector size (logical/physical): 512 bytes / 512 bytes i/o size (minimum/optimal): 4096 bytes / 1048576 bytes
Important
Connect to the volume on the Linux instance.
When connecting to volumes on a Linux instance, if you want to automatically mount those volumes when the instance starts, you need to use some specific options in the etc fstab file, otherwise the instance may not be launched. For more information, see Traditional FSTAB Options and FSTAB Options for Block Volumes Using Consistent Device Paths.
After you finish the resources created in this tutorial, clean up by terminating the instance and deleting the resources that you don't plan to continue using.
Detach and delete the block volume
Open the navigation menu and click Calculate. Under Calculations, click Instances.
Find your instance in the list of instances and click its name to display its details.
On the instance details page, in the Resources section, click the connected block volume.
Locate your storage volume and click on the Actions menu (..).Then click Detach.
Click Continue separation, and then click OK.
You can delete a storage volume when the console shows that the storage volume status is detached. Open the navigation menu and click Storage. Under Block Storage, click Block Volumes.
Locate your storage volume and click on the Actions menu (..).Then click Terminate. Follow the prompts to confirm.
Terminate the instance
Open the navigation menu and click Calculate. Under Calculations, click Instances.
In the list of instances, find the instance that you created in the tutorial.
Click on the Actions menu (..)Then click Terminate.
Select the Permanently delete attached launch volume check box, and then click Terminate Instance.
Delete the virtual cloud network
Open the navigation menu, tap Network, and then tap Virtual Cloud Network.
In the list of VCNs, find the one you created in the tutorial.
Click on the Actions menu (..)Then click Terminate.
Click Terminate All to delete all the underlying resources of your VCN.
When all the resources are successfully deleted, you can close the dialog box.
As an Oracle Premier Partner, Agilewing has revolutionized the way users experience Oracle Cloud Services. Agilewing provides a simplified account opening process and first-class technical support, so that users do not need to have a complicated and cumbersome account opening process, as well as complex operations. One-stop service, quickly complete the opening and activation of cloud services, and you can easily obtain various services of Oracle Cloud.
AgileWing's AgileCDN integrated CDN service is perfectly combined with OCI cloud basic services to provide global content acceleration solutions for business internationalization. Customers can enjoy network efficiency and stability from more than 2,800 global POP nodes and more than 7,000 direct connection points. This means that no matter where your business is located in the world, Agilewing ensures that it runs efficiently.
Agilewing leverages the advantages of Oracle Cloud to help build cloud services, migrate clouds, and expand your business overseas, eliminating the need for the complex process of researching and exploring Oracle Cloud Services on your own. This partnership model provides customers with a cost-effective solution that allows them to focus on their core business while enjoying the high performance and security of Oracle Cloud.
Oracle Cloud Services is an area of potential, with high performance, security, and globally consistent service standards that offer endless possibilities. With Agilewing's professional services, users and enterprises alike can easily enter this new world and take advantage of all the benefits of Oracle Cloud. Start your Oracle Cloud Services journey now with Agilewing and explore this new era of innovation and performance.