Extend Oracle Instance Root Volume Size

There is an option to extend the Root volume size and Block volume size in Oracle cloud infrastructures. Use below steps to increased the Oracle cloud Instance Root Volume size in Linux.

Oracle Instance boot volume

Oracle Instance boot volume

 

How to Increase the Oracle Cloud Instance root volume size

Step1:

  • Login your Oracle Cloud console.
  • Stop the instance
  • Detach the boot volume
  • Open the navigation menu. Under Core Infrastructure, go to Compute and click Boot Volumes.
  • In the Boot Volumes list, click the boot volume you want to resize.
  • Click Resize.
Oracle Instance root volume resize

Oracle Instance root volume resize

 

  • Specify the new size and click Resize.
    – You must specify a larger value than the boot volume’s current size.

Step2:

This is required to attach the volume to the new instance as an additional disk and Extending the partition size. Attach the boot volume to a second instance as an additional data volume.

  • Extend the partition and grow the file system.

How to Extending the Root Partition on a Linux Instance.

After attaching the boot volume as an additional data volume to the second instance, connect to this instance and perform the following steps to extend the partition.

Run the following command to list the attached block volumes to identify the volume you want to extend the partition.

# lsblk

Run the following command to edit the volume’s partition table with parted

parted <volume_id>
<volume_id> is the volume identifier, for example /dev/sdc.

When you run parted, you may encounter the following error message:

Warning: Not all of the space available to <volume_id> appears to be used,
you can fix the GPT to use all of the space (an extra volume_size blocks)
or continue with the current setting?
You are then prompted to fix the error or ignore the error and continue with the current setting. Specify the option to fix the error.

Run the following command to change the display units to sectors so you can see the precise start position for the volume:

(parted) unit s

Run the following command to display the current partitions in the partition table:

(parted) print

Make note of the values in the Number, Start, and File system columns for the root partition.

Run the following command to remove the existing root partition:

(parted) rm <partition_number>

<partition_number> is the value from the Number column.

Run the following command to recreate the partition:

(parted) mkpart
At the Start? prompt, specify the value from the Start column. At the File system type? prompt, specify the value from the File system column. Specify 100% for the End? prompt.

Run the following command to exit parted:

(parted) quit

This command forces a rewrite of the partition table with the new partition settings you specified.

Run the following command to list the attached block volumes to verify that the root partition was extended:

# lsblk

After you extend the root partition you need to grow the file system.

The steps in the following procedure apply only to xfs file systems.

# xfs_repair <partition_id>
<partition_id> is the partition identifier, for example /dev/sdc3. See Checking and Repairing an XFS File System for more information.
# xfs_growfs -d <partition_id>
<partition_id> is the partition identifier, for example /dev/sdc3.

Run the following command to display the file system details to verify that the file system size.

# df -lh

Step3:

Once you have extended the partition and grown the file system, you can restart the original instance with the boot volume.

  • Disconnect the volume from the second instance.
  • Detach the volume from the second instance.
  • Attach the volume to the original instance as a boot volume.
  • Restart the instance.

 

Errors :

If you are getting the following error and unable to increase partition size, use growpart, fdisk to increase it.

Partition number? 3
Error: Partition /dev/sda3 is being used. You must unmount it before you modify it with Parted.

Fix:

Method1: Use growpart to increase.

# sudo growpart /dev/sda 3

# sudo xfs_growfs /dev/sda3

Method2: Use fdisk to increase.

[[email protected]_cloud ~]# fdisk /dev/sda
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1-3, default 3):
Partition 3 is deleted

Command (m for help): n
Partition number (3-128, default 3):
First sector (34-419430366, default 17827840):
Last sector, +sectors or +size{K,M,G,T,P} (17827840-419430366, default 419430366):
Created partition 3


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[[email protected]_cloud ~]# sudo xfs_growfs /dev/sda3
meta-data=/dev/sda3 isize=512 agcount=4, agsize=2495232 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=9980928, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=4873, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 9980928 to 50200315

 

 

Install and Configure GNOME with VNC server on CentOS and RHEL

By default, CentOS 7 installed as the minimal server, and user intervention is required to change the installation type. VNC (Virtual Network Computing) Server allows the remote Desktop sharing using VNC viewer. In CentOS 7 & RHEL 7 package named “tigervnc-server” needs to be installed in order to set up the VNC server.

These are the steps to Install and Configure GNOME with VNC server on CentOS 7 / RHEL 7.

Configure the YUM repository on CentOS 7 / RHEL 7.

Run the following command to list available yum repository to install GNOME.

# yum group list

Make sure “GNOME Desktop” is available on this list.

Install Gnome GUI packages using the YUM command.

CentOS 7:

# yum groupinstall "GNOME Desktop"

RHEL 7:

# yum groupinstall "Server with GUI"

 

Install TigerVNC Packages

# yum install tigervnc-server xorg-x11-fonts-Type1

Create VNC user account

# adduser vncuser
# passwd vncuser

Always use a strong password for the user account.

Setup VNC Server Configuration File

Copy the VNC config file “/lib/systemd/system/[email protected]” to the “/etc/systemd/system/[email protected]:<Port_Number>.service“.

Here we are using 3 which will VNC listen on “5903“. So while Connecting to the VNC server you can specify port number as <IP_Address_VNC_Server:3> or <IP_Address_VNC_Server:5903>

# cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:3.serv

Once you copy, modify the VNC server configuration file and update user account.

# vi /etc/systemd/system/[email protected]:3.serv
GNOME with VNC

GNOME with VNC

Replace the “<USER>” user with a user account. In my case “vncuser” user will able to control and manage its desktop session using remote VNC clients.

Set the VNC password for the User Account.

Switch to the user “vncuser” and run vncserver command to set the password as shown below

# su - vncuser
[[email protected] ~] # vncserver 
You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth: file /home/vncuser/.Xauthority does not exist

New 'centos7-test1:1 (vncuser)' desktop is centos7-test1:1

Creating default startup script /home/vncuser/.vnc/xstartup
Creating default config /home/vncuser/.vnc/config
Starting applications specified in /home/vncuser/.vnc/xstartup
Log file is /home/vncuser/.vnc/centos7-test1:1.log
Start and Enable the VNC Service
# systemctl daemon-reload
# systemctl start [email protected]:3.service
# systemctl enable [email protected]:3.service
Created symlink from /etc/systemd/system/multi-user.target.wants/[email protected]:3.service to /etc/systemd/system/[email protected]:3.service.
Enable Firewall Rule
# firewall-cmd --permanent --zone=public --add-port=5903/tcp
# firewall-cmd --reload

Connect Remote Desktop Session

Here we have installed VNCviewer and connected.

<ipaddress>:5903

 

 

Create Client Id and Client Secret for Azure Active Directory

Developers and software-as-a-service (SaaS) providers can develop cloud services, that can be integrated with Azure Active Directory to provide secure sign-in and authorization for their services. To integrate an application or service with Azure AD, a developer must first register the application with Azure Active Directory with Client ID and Client Secret. Creating a service principal, try using Azure Active Directory Managed Service Identity for your application identity.

Any application that wants to use the capabilities of Azure Active Directory must be registered in an Azure. The app registration will give the Client ID which is App ID and Client Secret, Sign-On URL.

How to Create Client Id and Client Secret for Azure

1) Log in to the Azure portal.

You must have sufficient permissions to register an application with your Azure Active Directory tenant and assign the application to a role in your Azure subscription.

2) On the top search bar, type “Azure Active Directory” and click the Active directory or Click on More Services on the left-hand side, and choose the Azure Active Directory.

3) Click on App registrations and Click “New application registration

  • Make sure App registration is allowed for the user account through the Azure Active Directory -> select User settings and “App registrations” selected as “Yes
azure-client-id-secret-key-generate

azure-client-id-secret-key-generate

 

4) Provide a name and URL for the application.

  • Select Web app / API for the type of application and Click Create.
azure-app-registration

azure-app-registration

 

You have created your application.

 

How to Get application ID and authentication key

To get the application Client Id and Key details.

1) From the App registrations in Azure Active Directory, select your application.

azure-app-registration-step2

azure-app-registration-step2

 

 

 

 

 

 

 

2) Copy the Application ID

3) Click Settings on the same window.

azure-app-registration-step3

azure-app-registration-step3

4) To generate an authentication key, Click Keys.

azure-app-registration-step4

azure-app-registration-step4

5) Update a description of the key, and a duration and value which is your password, select Save.

azure-app-registration-step5

azure-app-registration-step5

Now the Client ID and Client Secret will be used for your configurations or any other rest clients.

How to Get Azure tenant ID

It is required to pass the tenant ID with your authentication request.

1) Select the Azure Active Directory.

2) To get the Azure tenant ID, select Properties for your Azure AD tenant.

 

azure-get-tenent-id

azure-get-tenent-id

 

How to Assign Role to application

To access the subscription, you must assign the application to a role. Decide which role represents the right permissions for the application.

1) Select your Subscriptions (On the top search bar, type “Subscriptions“).

2) Click Access Control (IAM)

3) Select Add

4) Select the role you wish to assign to the application.

azure-update-role

azure-update-role

5) Select Save to finish assigning the role. You see your application in the list of users assigned to a role for that scope.

 

How to create an Azure Client ID and Client Secret using AZ command line

1) Login with Azure account.

  • It will ask you the confirmation and update an auth configuration to local. Make sure you are having a valid subscription.
# az login

1) Create Service Principle

  • You will get the tenant id, appid and auth password.
# az ad sp create-for-rbac --name <app_name> --password <passwd>
{
"appId": "8334373-0dd9-438c-b563-2a6dbd8248c9",
"displayName": "my-test",
"name": "http://my-test",
"password": "password",
"tenant": "9a562b46-a92e-2113-4r33-7ca4c3598479"
}

2) Assign Role

# az role assignment list --assignee <app_id>
[
{
"id": "/subscriptions/<su_id>/providers/Microsoft.Authorization/roleAssignments/efccd2ae-236o-41de-ba22-58d2e6146164",
"name": "efccd2ae-4e20-41de-b022-58d2e6046164",
"properties": {
"principalId": "367a4295-5oo5-4162-ae71-248534k463a2",
"principalName": "http://my-test",
"roleDefinitionId": "/subscriptions/<su_id>/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c",
"roleDefinitionName": "Contributor",
"scope": "/subscriptions/<su_id>"
},
"type": "Microsoft.Authorization/roleAssignments"
}
]