Disclaimer

Showing posts with label OS Commands. Show all posts
Showing posts with label OS Commands. Show all posts

Friday, 24 April 2026

Configure ACFS on ASM Disk Group in Oracle Grid Infrastructure

 



Step 1: Check Available Space in ASM Disk Group
Verify the free space available in the ASM disk group before creating a new volume.

[grid@b1 ~]$ asmcmd
ASMCMD> lsdg
State    Type  Rebal  Sector  Logical_Sector  Block       AU  Total_MB   Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  HIGH  N         512             512   4096  4194304  25141248  10226292                0         3408764              0             Y  DATA/
MOUNTED  HIGH  N         512             512   4096  4194304   6266880   3156732                0         1052244              0             N  RECOC2/




Step 2: Create an ASM Volume:
Using the Grid Infrastructure owner (grid user), create a new ASM volume in the DATA disk group.

[grid@b1 ~]$ 
[grid@b1 ~]$ asmcmd volcreate -G DATA -s 500G exp_vol1
[grid@b1 ~]$ 
[grid@b1 ~]$ 
[grid@b1 ~]$ df -h
Filesystem                                                                        Size  Used Avail Use% Mounted on
devtmpfs                                                                          126G     0  126G   0% /dev
tmpfs                                                                             254G  1.8G  252G   1% /dev/shm
tmpfs                                                                             126G   13M  126G   1% /run
tmpfs                                                                             126G     0  126G   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1                                                       15G  6.3G  8.7G  42% /
/dev/mapper/VGExaDb-LVDbHome                                                      4.0G   67M  3.9G   2% /home
/dev/mapper/VGExaDb-LVDbKdump                                                      20G  175M   20G   1% /crashfiles
/dev/mapper/VGExaDb-LVDbVar1                                                      5.0G  2.2G  2.8G  44% /var
/dev/mapper/VGExaDbDisk.u01.20.img-LVDBDisk                                        20G  4.7G   16G  24% /u01
/dev/mapper/VGExaDb-LVDbTmp                                                       3.0G   64M  2.9G   3% /tmp
/dev/mapper/VGExaDb-LVDbVarLog                                                     18G  1.2G   17G   7% /var/log
/dev/mapper/VGExaDbDisk.grid--klone--Linux--x86--64--19000251021.50.img-LVDBDisk   50G   13G   38G  26% /u01/app/19.0.0.0/grid
/dev/sdc1                                                                         412M  128M  285M  31% /boot
/dev/mapper/VGExaDb-LVDbVarLogAudit                                               3.0G  175M  2.8G   6% /var/log/audit
/dev/mapper/VGExaDbDisk.u02_extra.img-LVDBDisk                                    588G  171G  387G  31% /u02
tmpfs                                                                              26G     0   26G   0% /run/user/1000
/dev/asm/acfsvol01-95                                                             409G   20G  390G   5% /acfs01
tmpfs                                                                              26G     0   26G   0% /run/user/1001
tmpfs                                                                              26G     0   26G   0% /run/user/2000
tmpfs                                                                              26G     0   26G   0% /run/user/0




Step 3: Verify ASM Disk Group Space After Volume Creation
Confirm the remaining free space in the DATA disk group after the volume has been created.

[grid@b1 ~]$ asmcmd
ASMCMD> lsdg
State    Type  Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  HIGH  N         512             512   4096  4194304  25141248  8690220                0         2896740              0             Y  DATA/
MOUNTED  HIGH  N         512             512   4096  4194304   6266880  3156684                0         1052228              0             N  RECOC2/


Before - Total 25141248 free---> 10226292
After  - Total 25141248 free --> 8690220

Step 4: Create the ACFS File System:
Using the root user, create (format) the ACFS file system on the newly created ASM volume.

[root@b1 ~]# 
[root@b1 ~]# 
[root@b1 ~]# 
[root@b1 ~]# 
[root@b1 ~]# 
[root@b1 ~]# cd /dev/asm/
[root@b1 asm]# ls -lrt
total 0
brwxrwx---. 1 root asmadmin 250, 48641 Feb 27 20:45 acfsvol01-95
brwxrwx---. 1 root asmadmin 250, 48642 Apr 20 12:12 acfs_vol1-95
brwxrwx---. 1 root asmadmin 250, 48643 Apr 20 12:21 exp_vol1-95
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# pwd
/dev/asm
[root@b1 asm]# mkfs -t acfs /dev/asm/exp_vol1-95
mkfs.acfs: version                   = 19.0.0.0.0
mkfs.acfs: on-disk version           = 46.0
mkfs.acfs: volume                    = /dev/asm/exp_vol1-95
mkfs.acfs: volume size               = 536870912000  ( 500.00 GB )
mkfs.acfs: Format complete.
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# df -h
Filesystem                                                                        Size  Used Avail Use% Mounted on
devtmpfs                                                                          126G     0  126G   0% /dev
tmpfs                                                                             254G  1.8G  252G   1% /dev/shm
tmpfs                                                                             126G   13M  126G   1% /run
tmpfs                                                                             126G     0  126G   0% /sys/fs/cgroup
/dev/mapper/VGExaDb-LVDbSys1                                                       15G  6.3G  8.7G  42% /
/dev/mapper/VGExaDb-LVDbHome                                                      4.0G   67M  3.9G   2% /home
/dev/mapper/VGExaDb-LVDbKdump                                                      20G  175M   20G   1% /crashfiles
/dev/mapper/VGExaDb-LVDbVar1                                                      5.0G  2.2G  2.8G  44% /var
/dev/mapper/VGExaDbDisk.u01.20.img-LVDBDisk                                        20G  4.7G   16G  24% /u01
/dev/mapper/VGExaDb-LVDbTmp                                                       3.0G   64M  2.9G   3% /tmp
/dev/mapper/VGExaDb-LVDbVarLog                                                     18G  1.2G   17G   7% /var/log
/dev/mapper/VGExaDbDisk.grid--klone--Linux--x86--64--19000251021.50.img-LVDBDisk   50G   13G   38G  26% /u01/app/19.0.0.0/grid
/dev/sdc1                                                                         412M  128M  285M  31% /boot
/dev/mapper/VGExaDb-LVDbVarLogAudit                                               3.0G  186M  2.8G   7% /var/log/audit
/dev/mapper/VGExaDbDisk.u02_extra.img-LVDBDisk                                    588G  171G  387G  31% /u02
tmpfs                                                                              26G     0   26G   0% /run/user/1000
/dev/asm/acfsvol01-95                                                             409G   20G  390G   5% /acfs01
tmpfs                                                                              26G     0   26G   0% /run/user/1001
tmpfs                                                                              26G     0   26G   0% /run/user/2000







Step 5: Create the Mount Directory
Create the mount directory /exaexport on the operating system (as the root user).

[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# mkdir -p /exaexport
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# chown root:root /exaexport
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# chmod 755 /exaexport
[root@b1 asm]# 

Step 6: Mount the ACFS File System
Mount the ACFS file system on the directory /exaexport using the root user.

[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# mount -t acfs /dev/asm/exp_vol1-95 /exaexport
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# df -h /exaexport
Filesystem            Size  Used Avail Use% Mounted on
/dev/asm/exp_vol1-95  500G  1.4G  499G   1% /exaexport
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# 
[root@b1 asm]# mount | grep acfs
/dev/asm/acfsvol01-95 on /acfs01 type acfs (rw,nodev,relatime,seclabel,device,rootsuid,ordered)
/dev/asm/exp_vol1-95 on /exaexport type acfs (rw,relatime,seclabel,device,rootsuid,ordered)






Thursday, 29 May 2025

Creating and mounting a new LVM volume on Linux - /arch

 

  • Create a new partition.

  • Initialize it as a physical volume.

  • Create a volume group and a logical volume.

  • Format it with EXT4.

  • Mount it to /arch.

  • add it to /etc/fstab for persistent mounting.



[root@rac10-p ~]# df -h
[root@rac10-p ~]# df -hP | column -t
[root@rac10-p ~]# parted
[root@rac10-p ~]# lvs -a
[root@rac10-p ~]# df -a
[root@rac10-p ~]# lsblk
[root@rac10-p ~]# vgs
[root@rac10-p ~]# fdisk /dev/nvme0n1
[root@rac10-p ~]# lsblk
[root@rac10-p ~]# pvcreate /dev/nvme0n1p3
[root@rac10-p ~]# lsblk
[root@rac10-p ~]# vgcreate ol1 /dev/nvme0n1p3
[root@rac10-p ~]# vgs
[root@rac10-p ~]# lvcreate -L +1G -n arch_lv ol1
[root@rac10-p ~]# df -h
[root@rac10-p ~]# mkfs.ext4 /dev/ol1/arch_lv
[root@rac10-p ~]# mkdir /arch
[root@rac10-p ~]# mount /dev/ol1/arch_lv /arch
[root@rac10-p ~]# cat /etc/fstab
[root@rac10-p ~]# mount -a
[root@rac10-p ~]# cat /etc/fstab







[root@rac10-p ~]#
[root@rac10-p ~]#
[root@rac10-p ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               5.8G     0  5.8G   0% /dev
tmpfs                  5.8G  2.4G  3.4G  42% /dev/shm
tmpfs                  5.8G  9.4M  5.8G   1% /run
tmpfs                  5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root     98G  9.9G   84G  11% /
/dev/nvme0n1p2         9.8G  339M  9.0G   4% /boot
/dev/mapper/ol-data02   92G  109M   87G   1% /data02
/dev/mapper/ol-u01      92G  7.1G   80G   9% /u01
/dev/mapper/ol-data01   92G  961M   86G   2% /data01
/dev/mapper/ol-u02      92G  564K   87G   1% /u02
/dev/mapper/ol-backup  196G  200M  186G   1% /backup
tmpfs                  1.2G   12K  1.2G   1% /run/user/42
tmpfs                  1.2G     0  1.2G   0% /run/user/0
tmpfs                  1.2G  4.0K  1.2G   1% /run/user/54321
[root@rac10-p ~]#


Same as above, but with POSIX output format (-P) and neatly formatted into aligned columns using column -t.


[root@rac10-p ~]# df -hP | column -t
Filesystem             Size  Used  Avail  Use%  Mounted          on
devtmpfs               5.8G  0     5.8G   0%    /dev
tmpfs                  5.8G  2.4G  3.4G   42%   /dev/shm
tmpfs                  5.8G  9.4M  5.8G   1%    /run
tmpfs                  5.8G  0     5.8G   0%    /sys/fs/cgroup
/dev/mapper/ol-root    98G   9.9G  84G    11%   /
/dev/nvme0n1p2         9.8G  339M  9.0G   4%    /boot
/dev/mapper/ol-data02  92G   109M  87G    1%    /data02
/dev/mapper/ol-u01     92G   7.1G  80G    9%    /u01
/dev/mapper/ol-data01  92G   961M  86G    2%    /data01
/dev/mapper/ol-u02     92G   564K  87G    1%    /u02
/dev/mapper/ol-backup  196G  200M  186G   1%    /backup
tmpfs                  1.2G  12K   1.2G   1%    /run/user/42
tmpfs                  1.2G  0     1.2G   0%    /run/user/0
tmpfs                  1.2G  4.0K  1.2G   1%    /run/user/54321



parted
Opens the GNU parted interactive utility used for partitioning disks (especially GPT-based). You likely used it to create a new partition like /dev/nvme0n1p3.


[root@rac10-p ~]#
[root@rac10-p ~]# parted
GNU Parted 3.2
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted)
(parted)
(parted)
(parted) ^C

[root@rac10-p ~]#
[root@rac10-p ~]#



lvs -a
Lists all logical volumes (LVs), including hidden or inactive ones (due to -a).

 
[root@rac10-p ~]#
[root@rac10-p ~]# lvs -a
  LV     VG Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  backup ol -wi-ao---- 200.00g
  data01 ol -wi-ao---- <93.13g
  data02 ol -wi-ao---- <93.13g
  root   ol -wi-ao---- 100.00g
  swap   ol -wi-ao----  46.56g
  u01    ol -wi-ao---- <93.13g
  u02    ol -wi-ao---- <93.13g
  
  
 
df -a
Shows disk usage including filesystems with zero size or pseudo filesystems (like /proc, /sys).

[root@rac10-p ~]# df -a
Filesystem            1K-blocks     Used Available Use% Mounted on
sysfs                         0        0         0    - /sys
proc                          0        0         0    - /proc
devtmpfs                6004212        0   6004212   0% /dev
securityfs                    0        0         0    - /sys/kernel/security
tmpfs                   6035340  2506752   3528588  42% /dev/shm
devpts                        0        0         0    - /dev/pts
tmpfs                   6035340     9576   6025764   1% /run
tmpfs                   6035340        0   6035340   0% /sys/fs/cgroup
cgroup                        0        0         0    - /sys/fs/cgroup/systemd
pstore                        0        0         0    - /sys/fs/pstore
bpf                           0        0         0    - /sys/fs/bpf
cgroup                        0        0         0    - /sys/fs/cgroup/cpu,cpuacct
cgroup                        0        0         0    - /sys/fs/cgroup/blkio
cgroup                        0        0         0    - /sys/fs/cgroup/misc
cgroup                        0        0         0    - /sys/fs/cgroup/freezer
cgroup                        0        0         0    - /sys/fs/cgroup/net_cls,net_prio
cgroup                        0        0         0    - /sys/fs/cgroup/pids
cgroup                        0        0         0    - /sys/fs/cgroup/hugetlb
cgroup                        0        0         0    - /sys/fs/cgroup/rdma
cgroup                        0        0         0    - /sys/fs/cgroup/perf_event
cgroup                        0        0         0    - /sys/fs/cgroup/devices
cgroup                        0        0         0    - /sys/fs/cgroup/memory
cgroup                        0        0         0    - /sys/fs/cgroup/cpuset
none                          0        0         0    - /sys/kernel/tracing
configfs                      0        0         0    - /sys/kernel/config
/dev/mapper/ol-root   102627012 10345656  87038476  11% /
selinuxfs                     0        0         0    - /sys/fs/selinux
systemd-1                     -        -         -    - /proc/sys/fs/binfmt_misc
debugfs                       0        0         0    - /sys/kernel/debug
hugetlbfs                     0        0         0    - /dev/hugepages
mqueue                        0        0         0    - /dev/mqueue
fusectl                       0        0         0    - /sys/fs/fuse/connections
binfmt_misc                   0        0         0    - /proc/sys/fs/binfmt_misc
vmware-vmblock                0        0         0    - /run/vmblock-fuse
/dev/nvme0n1p2         10232668   346136   9362244   4% /boot
/dev/mapper/ol-data02  95533172   111516  90539020   1% /data02
/dev/mapper/ol-u01     95533172  7429996  83220540   9% /u01
/dev/mapper/ol-data01  95533172   983836  89666700   2% /data01
/dev/mapper/ol-u02     95533172      564  90649972   1% /u02
/dev/mapper/ol-backup 205315524   204528 194625236   1% /backup
sunrpc                        0        0         0    - /var/lib/nfs/rpc_pipefs
tmpfs                   1207068       12   1207056   1% /run/user/42
tmpfs                   1207068        0   1207068   0% /run/user/0
tmpfs                   1207068        4   1207064   1% /run/user/54321




[root@rac10-p ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               5.8G     0  5.8G   0% /dev
tmpfs                  5.8G  2.4G  3.4G  42% /dev/shm
tmpfs                  5.8G  9.4M  5.8G   1% /run
tmpfs                  5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root     98G  9.9G   84G  11% /
/dev/nvme0n1p2         9.8G  339M  9.0G   4% /boot
/dev/mapper/ol-data02   92G  109M   87G   1% /data02
/dev/mapper/ol-u01      92G  7.1G   80G   9% /u01
/dev/mapper/ol-data01   92G  961M   86G   2% /data01
/dev/mapper/ol-u02      92G  564K   87G   1% /u02
/dev/mapper/ol-backup  196G  200M  186G   1% /backup
tmpfs                  1.2G   12K  1.2G   1% /run/user/42
tmpfs                  1.2G     0  1.2G   0% /run/user/0
tmpfs                  1.2G  4.0K  1.2G   1% /run/user/54321





lsblk
Lists all block devices (disks, partitions, LVMs) in a tree view. Very useful to view disks, partitions, and LVM structure.

[root@rac10-p ~]# lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0            11:0    1  11.6G  0 rom
nvme0n1       259:0    0   800G  0 disk
├─nvme0n1p1   259:1    0 719.1G  0 part
│ ├─ol-root   252:0    0   100G  0 lvm  /
│ ├─ol-swap   252:1    0  46.6G  0 lvm  [SWAP]
│ ├─ol-u02    252:2    0  93.1G  0 lvm  /u02
│ ├─ol-u01    252:3    0  93.1G  0 lvm  /u01
│ ├─ol-data01 252:4    0  93.1G  0 lvm  /data01
│ ├─ol-data02 252:5    0  93.1G  0 lvm  /data02
│ └─ol-backup 252:6    0   200G  0 lvm  /backup
└─nvme0n1p2   259:2    0    10G  0 part /boot



vgs
Lists information about all Volume Groups (VGs) on the system, like size, number of LVs, etc.

[root@rac10-p ~]# vgs
  VG #PV #LV #SN Attr   VSize   VFree
  ol   1   7   0 wz--n- 719.08g 4.00m
  
  


fdisk /dev/nvme0n1
Starts fdisk utility to manage partitions on the specified disk. Used for MBR-style partitioning (non-GPT).

You likely created partition /dev/nvme0n1p3 here.

[root@rac10-p ~]# fdisk /dev/nvme0n1

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/nvme0n1: 800 GiB, 858993459200 bytes, 1677721600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x441c82c3

Device         Boot      Start        End    Sectors   Size Id Type
/dev/nvme0n1p1            2048 1508034559 1508032512 719.1G 8e Linux LVM
/dev/nvme0n1p2 *    1508034560 1529006079   20971520    10G 83 Linux

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3):
First sector (1529006080-1677721599, default 1529006080):
Last sector, +sectors or +size{K,M,G,T,P} (1529006080-1677721599, default 1677721599):

Created a new partition 3 of type 'Linux' and of size 70.9 GiB.

Command (m for help): t
Partition number (1-3, default 3):
Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): p
Disk /dev/nvme0n1: 800 GiB, 858993459200 bytes, 1677721600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x441c82c3

Device         Boot      Start        End    Sectors   Size Id Type
/dev/nvme0n1p1            2048 1508034559 1508032512 719.1G 8e Linux LVM
/dev/nvme0n1p2 *    1508034560 1529006079   20971520    10G 83 Linux
/dev/nvme0n1p3      1529006080 1677721599  148715520  70.9G 8e Linux LVM

Command (m for help): w
The partition table has been altered.
Syncing disks.


[root@rac10-p ~]# lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0            11:0    1  11.6G  0 rom
nvme0n1       259:0    0   800G  0 disk
├─nvme0n1p1   259:1    0 719.1G  0 part
│ ├─ol-root   252:0    0   100G  0 lvm  /
│ ├─ol-swap   252:1    0  46.6G  0 lvm  [SWAP]
│ ├─ol-u02    252:2    0  93.1G  0 lvm  /u02
│ ├─ol-u01    252:3    0  93.1G  0 lvm  /u01
│ ├─ol-data01 252:4    0  93.1G  0 lvm  /data01
│ ├─ol-data02 252:5    0  93.1G  0 lvm  /data02
│ └─ol-backup 252:6    0   200G  0 lvm  /backup
├─nvme0n1p2   259:2    0    10G  0 part /boot
└─nvme0n1p3   259:3    0  70.9G  0 part



pvcreate /dev/nvme0n1p3
Initializes the partition as a Physical Volume (PV) for LVM.


[root@rac10-p ~]# pvcreate /dev/nvme0n1p3
  Physical volume "/dev/nvme0n1p3" successfully created.





[root@rac10-p ~]# lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0            11:0    1  11.6G  0 rom
nvme0n1       259:0    0   800G  0 disk
├─nvme0n1p1   259:1    0 719.1G  0 part
│ ├─ol-root   252:0    0   100G  0 lvm  /
│ ├─ol-swap   252:1    0  46.6G  0 lvm  [SWAP]
│ ├─ol-u02    252:2    0  93.1G  0 lvm  /u02
│ ├─ol-u01    252:3    0  93.1G  0 lvm  /u01
│ ├─ol-data01 252:4    0  93.1G  0 lvm  /data01
│ ├─ol-data02 252:5    0  93.1G  0 lvm  /data02
│ └─ol-backup 252:6    0   200G  0 lvm  /backup
├─nvme0n1p2   259:2    0    10G  0 part /boot
└─nvme0n1p3   259:3    0  70.9G  0 part



vgcreate ol1 /dev/nvme0n1p3
Creates a Volume Group (VG) named ol1 using the physical volume /dev/nvme0n1p3.

[root@rac10-p ~]# vgcreate ol1 /dev/nvme0n1p3
  Volume group "ol1" successfully created



vgs
Verifies the volume group was created and shows its size, free space, etc.

[root@rac10-p ~]# vgs
  VG  #PV #LV #SN Attr   VSize   VFree
  ol    1   7   0 wz--n- 719.08g  4.00m
  ol1   1   0   0 wz--n-  70.91g 70.91g

[root@rac10-p ~]# lvcreate -L +1G -n arch_lv ol1
  Logical volume "arch_lv" created.
  
  
  

[root@rac10-p ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               5.8G     0  5.8G   0% /dev
tmpfs                  5.8G  2.4G  3.4G  42% /dev/shm
tmpfs                  5.8G  9.4M  5.8G   1% /run
tmpfs                  5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root     98G  9.9G   83G  11% /
/dev/nvme0n1p2         9.8G  339M  9.0G   4% /boot
/dev/mapper/ol-data02   92G  109M   87G   1% /data02
/dev/mapper/ol-u01      92G  7.1G   80G   9% /u01
/dev/mapper/ol-data01   92G  961M   86G   2% /data01
/dev/mapper/ol-u02      92G  564K   87G   1% /u02
/dev/mapper/ol-backup  196G  200M  186G   1% /backup
tmpfs                  1.2G   12K  1.2G   1% /run/user/42
tmpfs                  1.2G     0  1.2G   0% /run/user/0
tmpfs                  1.2G  4.0K  1.2G   1% /run/user/54321



[root@rac10-p ~]# df -Th
Filesystem            Type      Size  Used Avail Use% Mounted on
devtmpfs              devtmpfs  5.8G     0  5.8G   0% /dev
tmpfs                 tmpfs     5.8G  2.4G  3.4G  42% /dev/shm
tmpfs                 tmpfs     5.8G  9.4M  5.8G   1% /run
tmpfs                 tmpfs     5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root   ext3       98G  9.9G   83G  11% /
/dev/nvme0n1p2        ext3      9.8G  339M  9.0G   4% /boot
/dev/mapper/ol-data02 ext3       92G  109M   87G   1% /data02
/dev/mapper/ol-u01    ext3       92G  7.1G   80G   9% /u01
/dev/mapper/ol-data01 ext3       92G  961M   86G   2% /data01
/dev/mapper/ol-u02    ext3       92G  564K   87G   1% /u02
/dev/mapper/ol-backup ext3      196G  200M  186G   1% /backup
tmpfs                 tmpfs     1.2G   12K  1.2G   1% /run/user/42
tmpfs                 tmpfs     1.2G     0  1.2G   0% /run/user/0
tmpfs                 tmpfs     1.2G  4.0K  1.2G   1% /run/user/54321
[root@rac10-p ~]#



mkfs.ext4 /dev/ol1/arch_lv
Formats the logical volume with the EXT4 filesystem.

[root@rac10-p ~]# mkfs.ext4 /dev/ol1/arch_lv
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: eacb7ee0-cedc-483c-a0c1-cfdce6c73b06
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done



mkdir /arch
Creates a directory to use as a mount point.

[root@rac10-p ~]# mkdir /arch
[root@rac10-p ~]#
[root@rac10-p ~]# mount /dev/ol1/arch_lv /arch


[root@rac10-p ~]# df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  5.8G     0  5.8G   0% /dev
tmpfs                   tmpfs     5.8G  2.4G  3.4G  42% /dev/shm
tmpfs                   tmpfs     5.8G  9.4M  5.8G   1% /run
tmpfs                   tmpfs     5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root     ext3       98G  9.9G   83G  11% /
/dev/nvme0n1p2          ext3      9.8G  339M  9.0G   4% /boot
/dev/mapper/ol-data02   ext3       92G  109M   87G   1% /data02
/dev/mapper/ol-u01      ext3       92G  7.1G   80G   9% /u01
/dev/mapper/ol-data01   ext3       92G  961M   86G   2% /data01
/dev/mapper/ol-u02      ext3       92G  564K   87G   1% /u02
/dev/mapper/ol-backup   ext3      196G  200M  186G   1% /backup
tmpfs                   tmpfs     1.2G   12K  1.2G   1% /run/user/42
tmpfs                   tmpfs     1.2G     0  1.2G   0% /run/user/0
tmpfs                   tmpfs     1.2G  4.0K  1.2G   1% /run/user/54321
/dev/mapper/ol1-arch_lv ext4      974M   24K  907M   1% /arch





cat /etc/fstab
Displays the file that controls persistent mounts on boot. You would add an entry here to make the mount survive reboot.
[root@rac10-p ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Jul  8 05:53:07 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/ol-root     /                       ext3    defaults        1 1
/dev/mapper/ol-backup   /backup                 ext3    defaults        1 2
UUID=6f3446f6-c314-438e-ac81-6a009e92a03f /boot                   ext3    defaults        1 2
/dev/mapper/ol-data01   /data01                 ext3    defaults        1 2
/dev/mapper/ol-data02   /data02                 ext3    defaults        1 2
/dev/mapper/ol-u01      /u01                    ext3    defaults        1 2
/dev/mapper/ol-u02      /u02                    ext3    defaults        1 2
/dev/mapper/ol-swap     none                    swap    defaults        0 0



[root@rac10-p ~]# vi /etc/fstab




mount -a
Forces a re-evaluation of all entries in /etc/fstab. If your new mount entry is added there, it will be mounted now.


[root@rac10-p ~]# mount -a
[root@rac10-p ~]#
[root@rac10-p ~]#
[root@rac10-p ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Jul  8 05:53:07 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/ol-root     /                       ext3    defaults        1 1
/dev/mapper/ol-backup   /backup                 ext3    defaults        1 2
UUID=6f3446f6-c314-438e-ac81-6a009e92a03f /boot                   ext3    defaults        1 2
/dev/mapper/ol-data01   /data01                 ext3    defaults        1 2
/dev/mapper/ol-data02   /data02                 ext3    defaults        1 2
/dev/mapper/ol-u01      /u01                    ext3    defaults        1 2
/dev/mapper/ol-u02      /u02                    ext3    defaults        1 2
/dev/mapper/ol-swap     none                    swap    defaults        0 0
/dev/ol1/arch_lv        /arch                   ext4    defaults        0 0



[root@rac10-p ~]# df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  5.8G     0  5.8G   0% /dev
tmpfs                   tmpfs     5.8G  2.4G  3.4G  42% /dev/shm
tmpfs                   tmpfs     5.8G  9.4M  5.8G   1% /run
tmpfs                   tmpfs     5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root     ext3       98G  9.9G   83G  11% /
/dev/nvme0n1p2          ext3      9.8G  339M  9.0G   4% /boot
/dev/mapper/ol-data02   ext3       92G  109M   87G   1% /data02
/dev/mapper/ol-u01      ext3       92G  7.1G   80G   9% /u01
/dev/mapper/ol-data01   ext3       92G  961M   86G   2% /data01
/dev/mapper/ol-u02      ext3       92G  564K   87G   1% /u02
/dev/mapper/ol-backup   ext3      196G  200M  186G   1% /backup
tmpfs                   tmpfs     1.2G   12K  1.2G   1% /run/user/42
tmpfs                   tmpfs     1.2G     0  1.2G   0% /run/user/0
tmpfs                   tmpfs     1.2G  4.0K  1.2G   1% /run/user/54321
/dev/mapper/ol1-arch_lv ext4      974M   24K  907M   1% /arch



Wednesday, 20 November 2024

What is Load Average in the top Command in Linux?

 

What is Load Average in the top Command?

Load average is a measure of the amount of work the server is handling over time. It shows the average number of processes that are:

  1. Actively running on the CPU.
  2. Waiting to use the CPU.
  3. Waiting for I/O (like disk or network).

The load average is displayed as three numbers in the top command:


load average: 4.39, 2.90, 3.63

These numbers represent the system's average load over the past:

  • 1 minute (4.39 in this example).
  • 5 minutes (2.90).
  • 15 minutes (3.63).



How to Identify Too Much Load on the Server?

To know if your server is overloaded, compare the load average to the number of CPU cores (vCPUs) your system has.

  1. Load Average ≤ Number of CPU Cores:

    • The system is performing well; there's no overload.
    • For example, if you have 8 CPU cores and the load average is 4.39, the system is fine because the load is less than the CPU capacity.
  2. Load Average > Number of CPU Cores:

    • The system is overloaded because there are more processes waiting for CPU time than the CPUs can handle.
    • For example, if you have 4 CPU cores and the load average is 4.39, your server is at full capacity. If it climbs to 8 or higher, it means processes are queuing up.



Is There a Limit to Load Average?

There’s no fixed upper limit for load average, but practical thresholds depend on the number of CPU cores:

  • 1 core: Load average of 1.0 means full CPU utilization.
  • 4 cores: Load average of 4.0 means full CPU utilization.
  • 8 cores: Load average of 8.0 means full CPU utilization.

If the load average is consistently higher than the number of cores, the system is overburdened, and performance issues like slower response times or delays can occur.





How to Check for Too Much Load in Layman Terms

Imagine:

  • You have 4 counters at a bank (representing 4 CPU cores).
  • If 4 customers are at the counters being served, the load is 4. Everything is smooth.
  • If 8 customers are in the queue (4 being served and 4 waiting), the load average is 8, and the system is overloaded.

If the number of people (load) consistently exceeds the number of counters (CPU cores), the queue grows, and the wait time increases.





What Causes High Load Average?

  1. CPU-intensive Processes:

    • Long-running or inefficient processes consuming too much CPU.
    • Examples: complex SQL queries, large calculations, or badly tuned applications.
  2. I/O Bottlenecks:

    • Slow disks or high disk read/write activity causing processes to wait.
    • Example: database backups or logs filling up.
  3. Memory Pressure:

    • If RAM is exhausted, the system uses swap (disk), causing delays and higher load.
  4. Network Delays:

    • Processes waiting for data from external systems.



How to Identify and Reduce Load

  1. Use top or htop:

    • Look for processes with high %CPU or %MEM usage.
    • Example in top:

      PID USER %CPU COMMAND 2470184 mdatp 15.9 wdavdaemon
      • Here, the mdatp process is using 15.9% of the CPU.
  2. Check Disk I/O:

    • Use iostat or iotop to find processes causing disk bottlenecks.
    • Example:

      iostat -dx
  3. Reduce Load:

    • Terminate unnecessary processes: Kill or stop unimportant jobs.
    • Optimize applications: Tune Oracle SGA/PGA, queries, or indexes.
    • Upgrade resources: Add more CPU cores, RAM, or faster disks.


Key Points to Remember

  1. Load average represents the demand on system resources (CPU and I/O).
  2. Compare load average with the number of CPU cores:
    • Load ≤ CPU cores: System is healthy.
    • Load > CPU cores: System is overloaded.
  3. Use tools like top, htop, and iotop to identify high CPU, I/O, or memory consumers.
  4. Proactive tuning, upgrading hardware, or redistributing tasks can reduce load.



High SWAP usage in Oracle Database Server

 



    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
2470184 mdatp     20   0 1190672 221212  80108 S  12.9   0.2   5:40.22 wdavdaemon
  14213 oracle    20   0   80.7g  27.4g  27.2g S  12.6  22.4   9365:40 ora_s000_ORCL
  14215 oracle    20   0   80.6g  27.7g  27.6g S  10.9  22.6   8742:56 ora_s001_ORCL
  14139 oracle    20   0   80.5g   1.3g   1.3g S   7.6   1.1 411:54.34 ora_d013_ORCL
2288719 root      20   0 1098456  36504  16628 S   4.6   0.0  20:14.67 wdavdaemon
2288664 root      20   0 1248312 123808  28312 S   2.3   0.1  17:59.23 wdavdaemon
  14057 oracle    20   0   80.5g 234028 205176 S   1.3   0.2 622:32.42 ora_dia0_ORCL
  14161 oracle    20   0   80.5g   1.3g   1.3g S   1.3   1.1 399:43.10 ora_d024_ORCL
  14207 oracle    20   0   80.5g   1.3g   1.3g S   1.3   1.1 401:37.92 ora_d047_ORCL
  14012 oracle    -2   0   80.5g   2224   1792 S   0.7   0.0 232:48.41 ora_vktm_ORCL
  14063 oracle    20   0   80.5g 269604 268372 S   0.7   0.2 382:58.31 ora_lgwr_ORCL
  14071 oracle    20   0   80.5g 221792 221228 S   0.7   0.2 424:40.60 ora_lg00_ORCL
  14131 oracle    20   0   80.5g   1.3g   1.3g S   0.7   1.1 371:15.74 ora_d009_ORCL
  14217 oracle    20   0   80.7g  25.2g  25.0g S   0.7  20.6   5266:11 ora_s002_ORCL
    135 root       0 -20       0      0      0 I   0.3   0.0  21:40.33 kworker/3:1H-kblockd
   4333 grid      20   0 2673388  18956   6936 S   0.3   0.0 133:00.72 ohasd.bin
  10088 grid      20   0 2218372  30340      0 S   0.3   0.0  84:58.80 ocssd.bin
  11066 grid      -2   0 2390276   4552   4376 S   0.3   0.0 236:37.57 asm_vktm_+asm
  11119 grid      20   0 2407516  11688  10864 S   0.3   0.0   8:28.19 asm_gmon_+asm
  14045 oracle    20   0   80.5g   3.4g   3.4g S   0.3   2.8 142:57.89 ora_dbrm_ORCL
  14111 oracle    20   0   80.5g 221588 219068 S   0.3   0.2 127:29.07 ora_mmnl_ORCL
  14133 oracle    20   0   80.5g   1.3g   1.3g S   0.3   1.1 394:59.40 ora_d010_ORCL
  14145 oracle    20   0   80.5g   1.3g   1.3g S   0.3   1.1 399:20.58 ora_d016_ORCL
  14177 oracle    20   0   80.5g   1.3g   1.3g S   0.3   1.0 363:20.75 ora_d032_ORCL
  14195 oracle    20   0   80.5g   1.3g   1.3g S   0.3   1.1 370:11.81 ora_d041_ORCL
  14199 oracle    20   0   80.5g   1.3g   1.3g S   0.3   1.1 355:24.68 ora_d043_ORCL
  15367 oracle    20   0   80.5g 420312 415096 S   0.3   0.3  32:22.48 ora_cjq0_ORCL
1682958 grid      20   0 2173264  21684  12880 S   0.3   0.0  24:07.97 oraagent.bin
2288782 root      20   0  291972  11884   7172 S   0.3   0.0   0:39.13 telemetryd_v2 


The system you are monitoring has high swap usage, as shown in the top output. Here's the key information and analysis:

Observations:

  1. Memory Details:

    • Total Memory: 125252.5 MiB (approximately 122 GB).
    • Used Memory: 56199.0 MiB (approximately 55 GB).
    • Buffers/Cache: 68061.9 MiB (approximately 66 GB).
    • Free Memory: 991.6 MiB (less than 1 GB).
  2. Swap Usage:

    • Total Swap: 20480.0 MiB (20 GB).
    • Used Swap: 20431.7 MiB (nearly the entire swap is used).
    • Available Memory: 2470.9 MiB (combination of free memory and part of cache).
  3. Top Consumers:

    • Oracle Processes (ora_* and grid):
      • These processes are consuming a significant amount of virtual memory (e.g., ora_s000_ORCLora_s001_ORCL).
      • Processes like ora_s002_ORCL are consuming 25.2 GB RES (resident memory).
he ora_s000,01,02 process in Oracle is a shared server process


    • Wdavdaemon:
      • Several wdavdaemon processes from Microsoft Defender ATP (mdatp user) are also running, with memory footprints like 36504 KiB RES.

Likely Issues with Swap Usage:

  • Insufficient Free Physical Memory:
    • With less than 1 GB of free RAM, the system starts relying heavily on swap.
  • High Memory Buffers/Cache:
    • Buffers/cache is consuming 66 GB, which might be reclaimable, but the system is still using swap.
  • Oracle Database Memory Settings:
    • The Oracle processes have massive memory allocations. Specifically:
      • ora_s000_ORCL: 27.4 GB.
      • ora_s001_ORCL: 27.7 GB.
      • The SGA (System Global Area) or PGA (Program Global Area) configurations might be too aggressive for the available RAM.

Recommendations:

  1. Analyze Oracle Memory Settings:

    • Check the SGA and PGA settings for the database instance ORCL.
    • Reduce memory allocations if they are excessive for the workload or available hardware.
  2. Reclaim Buffers/Cache:

    • Use sync; echo 3 > /proc/sys/vm/drop_caches (as root) to clear caches temporarily and free up memory. This won’t affect Oracle performance significantly as the database manages its own caching.
  3. Investigate High Swap Users:

    • Run smem or ps aux --sort=-%mem to identify specific processes using swap excessively.
  4. Optimize Application/Daemon Usage:

    • Evaluate the necessity of wdavdaemon processes (Defender ATP). They might be using more memory than needed.
  5. Increase Physical Memory or Swap Space (if hardware allows):

    • Add more RAM to avoid excessive swapping in the long term.
    • Temporarily increase swap space (swapon utility) to handle immediate pressure.


By addressing Oracle memory configurations and evaluating the necessity of other running processes, you can alleviate memory pressure and reduce swap usage.




SQL Queries for Goldengate Replications

  set linesize 200 set pagesize 100 set trimspool on column table_owner format a25 heading 'TABLE_OWNER' column tabl...