Category Archives: Linux

Physical vs Logical Blocksize on ASMLib Devices

As you all may know, ASMLib is a recommended module for Oracle databases running on Linux platforms and it is an embedded module for UEK (Oracle Unbreakable Kernel) users. Oracle announced that (two years ago or so) they will no longer maintain ASMLib for Red Hat compatible kernel but this does not mean that they abandon the project, rather it is mainly related to the effort they need to put in maintaining the module for multiple kernel versions.

A while ago, Oracle added a new feature to ASMLib allowing ASM devices to choose between physical or logical block sizes in I/O operations. This should be, I believe, a fail-back mechanism for SSD devices used as ASM disks. Many SSD devices use 4K block size however Linux still uses default 512 bytes logical block size for those devices in the same way it does for motor disks. In early releases of ASMLib (oracleasm-support-2.1.7 and earlier), ASM uses physical block size (4K for SSDs). This is still the default behavior in oracleasm-support-2.1.8 but now sysadmin can choose between physical and logical blocksize by using [-b|-p] switches in oracleasm-configure.sh script.

  • -b|—logical-blocks sets logical blocksize usage
  • -p|—physical-blocks set physical blocksize usage

Those switches set /sys/module/oracleasm/parameters/use_logical_block_size which is default to be false (use physical blocksize). So that asmlib module can use the value to decide which block size to use.

Upgrade to Oracle Enterprise Linux 5.9 and/so UEK2

I have upgraded one of my Oracle Linux boxes to Oracle Linux Release 5.9 which introduces several new things (Release Notes). Just to mention three of them

Download and update yum repository file

[root@localhost yum.repos.d]$ cd /etc/yum.repos.d
[root@localhost yum.repos.d]$ wget http://public-yum.oracle.com/public-yum-el5.repo
[root@localhost yum.repos.d]$ mv public-yum-el5.repo.1 public-yum-el5.repo
[root@localhost yum.repos.d]$ grep -B 5 enabled=1 public-yum-el5.repo
[el5_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1
--
[ol5_u9_base]
name=Oracle Linux $releasever Update 9 installation media copy ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/9/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1
--
[ol5_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/UEK/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1

We are ready to upgrade

[root@localhost yum.repos.d]$ yum update

Rebounce Linux

[root@localhost yum.repos.d]$ reboot

Before

Check Oracle Linux Version

[oracle@localhost ~]$ cat /etc/oracle-release
Oracle Linux Server release 5.8

Check kernel version

[oracle@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32-300.32.2.el5uek #1 SMP Tue Aug 28 10:15:29 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

Check your memory page size

[oracle@localhost ~]$ getconf PAGESIZE
4096

After

Once you are done after reboot, check Oracle Linux Version

[oracle@localhost ~]$ cat /etc/oracle-release
Oracle Linux Server release 5.9

Check kernel version

[oracle@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.39-300.28.1.el5uek #1 SMP Tue Feb 5 10:15:29 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

Check your memory page size

[oracle@localhost ~]$ getconf PAGESIZE
4096

Ooops!!! No change ?

[root@localhost ~]$ cat /sys/kernel/mm/transparent_hugepage/enabled 
[always] madvise never

Actually transparent huge page allocation is enabled but it deserves a separate discussion

Grow Oracle Linux Root Filesystem

It is always the case that in my Linux VM installations I run out of root file system space and need to grow it (I can hear you experienced admin, I should create another filesystem for my use and not use root file system for my joy). Here are the steps to grow root filesystem for Oracle Linux running on VMware:

Click on the wrench symbol to go to your virtual machine configuration menu

Screen Shot 2012-12-31 at 1.02.46 AM

Choose Hard Disk (SCSI) menu to increase the size of an availabe virtual disk (in this case your root file system disk)

Screen Shot 2012-12-31 at 1.07.12 AMGrow your virtual disk to a proper size (In this case I grow it form 28GB to 34GB)

Screen Shot 2012-12-31 at 1.07.23 AM

Now you can start your Oracle Linux on VM*.

First step at guest OS (Oracle Linux) is to grow disk partition size using fdisk. Here are the steps assuming that your root file system is on /dev/sda2 partition

  1. fdisk /dev/sda
  2. d (to delete)
  3. 2 (to delete partition 2)
  4. n (to create a new partition)
  5. p (to create a new partition with primary type)
  6. 2 (to create a new primary partition with id 2)
  7. Accept all defaults (to create a new primary partition with default offset and fully covering virtual disk you have already provisioned)
  8. w (write partition table)

Once you are done with disk partition modification rebounce Oracle Linux to ensure partition tables are read by Linux.

Once the guest OS is back, resize physical volume using pvresize. We will add 6GB (slightly less maybe) to existing physical partition using pvresize command

pvresize --setphysicalvolumesize 31G /dev/sda2

Now we can grow logical volume by 6GB

lvresize -L +6G /dev/VolGroup00/LogVol00

Final step is to grow file system online using resize2fs

resize2fs /dev/VolGroup00/LogVol00

You are done. You can continue filling root file system  🙂

* Before starting it is a good decision to protect your existing VM guest by using VMware snapshots.

Oracle Enterprise Linux for Home User: Install Latest Firefox Version

It is a joy to use Linux for any purpose. Although Oracle Linux is mainly designed for enterprise stack, a stable operating system for a technical user is always a need.

However default configurations and program versions are not suitable for daily use always. One example of this is Firefox 3.0.6 available in Oracle Linux (or Red Hat). Here is how you can upgrade it to 17.0

Download latest Firefox release from Mozilla web page. Then unpack and install it by simply following.

tar -xjvf firefox-17.0.tar.bz2
cp -r firefox /opt/
ln -sf /opt/firefox/firefox /usr/bin/firefox

VMware Tools for Oracle UEK

If you wish to use VMware Tools with Oracle UEK as the guest OS (you should use it in order to interact guest with the host, proper screen resolution and many other functionality) you need to perform some extra steps unlike some other Linux distros. Such as Ubuntu, which can be automatically configured by VMware

Here is the list of actions you should take for installation:

  1. Configure yum on your Linux installation
  2. Using VMware Virtual Machine menu choose Install VMware Tools option which will mount a pseudo device.
  3. Copy VMwareTools-8.8.4-730257.tar.gz  into /tmp and extract it using tar -xzvf VMwareTools-8.8.4-730257.tar.gz 
  4. yum install kernel-headers kernel-uek-devel
  5. ./vmware-install.pl as root

You are done.

Ta(e)sting ZFS on Oracle Enterprise Linux 5.4 with FUSE

zfs_feature_2 ZFS (Zeta File System) is my favorite storage solution for Oracle databases (in some later post I may explain why) after ASM. Although ZFS is shipped with Solaris and Open Solaris, it is also possible to use (at least taste) it with FUSE file system in your favorite Linux distro. You can find how to use ZFS on your Ubuntu in ZED House (The ZFS on Linux with FUSE) article at Linux Pro Magazine (June 2009).

One problem for Oracle Enterprise Linux (or Red Hat if you like) distro in using ZFS was that FUSE was not shipped (and supported) until 5.4 which is the latest update. By now you can choose to install FUSE modules (development libraries, kernel & user modules, and management tools) and use any FUSE file system in your system.

oracle_unbreakable_linux_bus It might be a bit tricky to enable ZFS on OEL 5.4 if you have no experience on FUSE, ZFS and Linux stuff. I will try to explain the installation step by step. In this post I will not dive into demos of ZFS which is available in Open Solaris related page.

Ensure that you have installed the FUSE packages during the OEL 5.4 Installation

The first point is to ensure that you have FUSE related packages (rpms)  installed with your OEL 5.4. You can ensure this by choosing the following packages during your installation:

  • Development >> Development Libraries >> fuse-devel-2.7.4-8.el5.i386
  • Base System >> Base >> fuse-2.7.4-8.el5.i386
  • Base System >> Base >> fuse-libs-2.7.4-8.el5.i386

Download & Install SConS first

SCons Since it is totally out of this post’s scope, I will not explain what SCons is but you can think it as a improved,cross-platform substitute for Make utility implemented in Python. ZFS-FUSE has been packed with SCons so you need to install SCons rpm first. You can download SCons rpm by clicking here (If you have any problems, click here to go sourceforge SCons download page).

Install SCons rpm as root user:

[oracle@localhost Desktop]$ su -
Password:
[root@localhost ~]$ cd /home/oracle/Desktop
[root@localhost Desktop]$ rpm -ivh scons-1.2.0.d20090919-1.noarch.rpm
Preparing...                ############################################ [100%]
     1:scons                  ############################################ [100%]

Download & Install ZFS-FUSE

Now you are ready to download and install ZFS-FUSE to your OEL 5.4. Either click here to download 0.5.0 version of zfs-fuse or directly go to download main page by clicking here. To build and install zfs-fuse

[root@localhost Desktop]# ark --extract zfs-fuse-0.5.0.tar.bz2
[root@localhost Desktop]# cd zfs-fuse-0.5.0/src
[root@localhost src]# scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building target ...

[root@localhost src]# scons install
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building target ...

Run ZFS-FUSE

Before using any ZFS command like zfs or zpool, you should first start up zfs-fuse daemon by

[root@localhost src]# cd zfs-fuse
[root@localhost zfs-fuse]# ./run &
[1] 8796

Test ZFS

There is a detailed test module packed with zfs-fuse. To check zfs-fuse is running you can use it. Before using it please ensure that /tmp has more than 2 GB of free space

[root@localhost zfs-fuse]# cd ../cmd/ztest
[root@localhost ztest]# ./runtest -T 300
Start date: Fri Sep 25 04:13:53 EEST 2009
5 vdevs, 7 datasets, 23 threads, 300 seconds...

After completing the test, its your responsibility to clear temporary files in /tmp

[root@localhost ztest]# cd /tmp
[root@localhost tmp]# rm ztest.*

If everything is fine, you are ready to play with zfs and apply any demonstrations mentioned above or you find on internet.