Showing posts with label Oracle compute Instance. Show all posts
Showing posts with label Oracle compute Instance. Show all posts

November 27, 2020

How to mount OCI object storage as a file system

 

In this topic I will show how to easily mount an object storage as a file system in any linux system.

In this case I am using a machine that is running on OEL 7

Step 1. Firstly, we will need to create a bucket in OCI. The steps of bucket creation is given in this post.

Step 2. Install s3fs-fuse rpm

[root@bastionhost opc]# yum install s3fs-fuse

.....

.....

Installed:

  s3fs-fuse.x86_64 0:1.86-2.el7

Dependency Installed:

  mailcap.noarch 0:2.1.41-2.el7

Complete!

[root@bastionhst opc]#



Step 3. Generate secret keys

Login to OCI console 

Click on User Settings




















Under Resources section click on Customer Secret Keys











Click on Generate Secret key to generate secret keys









Provide a name for the key.










This will generate key , it’s important to save the key as it won’t be shown again.












The S3 credentials are created by using an access key and the secret key. The access key is displayed in the Customer Secret Keys area of the Console.

 

Step 4. Enter your credentials in a ${HOME}/.passwd-s3fs file and set owner-only permissions:

Run this from root user. 
echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs

Here for  ACCESS_KEY you can get it from Generate secret key page.
For SECRET_ACCESS_KEY , we already saved it while generating it in previous step

Example:-
echo xxxxxxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyyyyyyyyy > ${HOME}/.passwd-s3fs

in this example xxxxxxxxxxxxxxxxx is access key and yyyyyyyyyyyyyyyyy is secret key.

Once password file is created assign proper permission to it 
chmod 600 ${HOME}/.passwd-s3fs

Step 5. Create a directory to mount the storage and mount the object storage
mkdir /s3bucket

To mount the object storage use the following command:-

s3fs [bucket_name] [destination directory] -o endpoint=[region] -o passwd_file=${HOME}/.passwd-s3fs -o url=https://[namespace of object storage].compat.objectstorage.[region].oraclecloud.com/ -onomultipart -o use_path_request_style

example:-
s3fs test_bucket /s3bucket -o endpoint=ap-mumbai-1 -o passwd_file=${HOME}/.passwd-s3fs -o url=https://bm626z56fa0a.compat.objectstorage.ap-mumbai-1.oraclecloud.com/  -onomultipart -o use_path_request_style


Here test_bucket is our bucket name
/s3bucket denotes the local mount point where the object storage is mounted
bm626z56fa0a – this denotes the namespace of the object storage.

Step 6. Verify the mount point

[root@s3bucket]# df -h /s3bucket/
Filesystem      Size  Used Avail Use% Mounted on
s3fs            256T     0  256T   0% /s3bucket
[root@ s3bucket]#

To mount the object storage when system reboots, add the following line in /etc/fstab file.

s3fs#test_bucket /s3bucket fuse _netdev,allow_other,use_path_request_style,passwd_file=/root/.passwd-s3fs,url=https://bm626z56fa0a.compat.objectstorage.ap-mumbai-1.oraclecloud.com 0 0

November 5, 2020

How to attach block volume in OCI instance

We often require to add additional block volume in OCI instance for different requirements. In this post I will show how to do this.


Step 1. First Login to OCI console

Step 2. Navigate to Block Storage à Block Volumes à Create Block Volume






Step 3. Fill in the required information such as 
  • Compartment name – Choose the compartment where your oci instance belongs to
  • Name – Provide a name for the volume
  • Volume size and performance- Here we have two options such as Default and Custom. By choosing default option oci would create a volume of size 1 tb .If we go for custom ,we can provide our desire size for the volume. Minimum size of a custom volume is 50GB. You can also choose the performance type for the volume as well.
  • Backup Policy- If you wish to choose a backup policy for the volume, we can select one here as per your requirement.
  • Encryption- For encryption it I choose the option "Encrypt using oracle managed keys".




Step 4. Once volume creation is done, navigate to compute instances tab and select the instance where you would like to add the volume




Under resources, click on “attached block volumes” option




Step 5. In the attach block volume window, choose volume attachment type as “iSCSI”. Also choose the block volume from block volume drop down menu. Provide a device path (optional).Provide desired Access type for the block volume.




Once attachment is done, the following message appears.




Step 6. Now on the same page , click on 3 dots on right bottom corner and click on iSCSI Commands and information. This would pop up a window with a few commands that would be used to attach the block volume with the compute instance.

Run the below commands in any ssh terminal of the compute instance to attach the block volume.

For detaching the block volume commands are also provided.




Run the below commands in any ssh terminal of the compute instance to attach the block volume.

For detaching the block volume commands are also provided.



Run the below commands from ssh terminal of the compute instance to attach the block volume.

For detaching the block volume commands are also provided in above screenshot.


So we can see from lsblk command that a 50GB volume is showing.

Step 7.  Now format the newly added volume and mount it . Commands are shown in the below screenshot. We have mounted the volume /dev/oracleoci/oraclevdb volume as /u01 mount point.



Step 8 .Add entry in /etc/fstab file 

/dev/oracleoci/oraclevdb /u01 ext4 defaults,noatime,_netdev 0 2


So this includes the activity of adding additional block volumes in OCI instance.

Oracle Database 26ai Installation Using RPM on Oracle Linux 9 (OEL 9) – Step-by-Step Guide

  In this post I will describe the installation of Oracle Database 26ai 64-bit on Oracle Linux 9 (OL8) 64-bit. The installation requires a m...