Friday, October 29, 2021

Terraform and OCI Compute Instance Provisioning.

Problem:

Error: 404-NotAuthorizedOrNotFound 

Provider version: 4.43.0, released on 2021-09-08. This provider is 7 update(s) behind to current. 

Service: Core Instance 

Error Message: Authorization failed or requested resource not found. 

OPC request ID: 4d08355655dc4bcd2f6ebc9b13fc582e/EE6FD3C4D7841A48A633023A67285401/B89D25D770B24C7D17E47E1F5EC2D9AC 

Suggestion: Either the resource has been deleted or service Core Instance need policy to access this resource. Policy reference: https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm

Cause:

The source resource and the destination resource are in different regions. for example, You planned to create compute instance in ap-sydney-1 region, but the source image is in ap-tokyo-1.

Solution:

Use the source image in the same region as the compute instance.

Saturday, October 23, 2021

Linux SWAP Operation

 # swapoff /dev/mapper/swap

swapoff: /dev/mapper/swap: swapoff failed: Cannot allocate memory


# dd if=/dev/zero of=/home/swap bs=1024 count=1024000


# swapon /home/swap


swapon: /home/swap: insecure permissions 0644, 0600 suggested.

  swapon: /home/swap: read swap header failed: Invalid argument


# mkswap /home/swap 

# swapon /home/swap


# free

              total        used        free      shared  buff/cache   available

Mem:       32782064    30765328      262560     1607488     1754176      219732

Swap:       1654776      401236     1253540

# swapon -s

Filename                                Type            Size    Used    Priority

/dev/mapper/swap                               partition       630780  0       -2

/home/swap                              file    1023996 401236  -1

# swapoff /home/swap

# swapon -s

Filename                                Type            Size    Used    Priority

/dev/mapper/swap                               partition       630780  431836  -1

# rm /home/swap 

rm: remove regular file ‘/home/swap’? y

# free -h

              total        used        free      shared  buff/cache   available

Mem:            31G         29G        222M        1.6G        1.7G        190M

Swap:          615M        421M        194M