Thursday 28 May 2015

Quick-Tip: DIA with docked Toolbox

This week I was asked to create a component-diagram  at my new customer. They use DIA as an alternative for Visio. Funny thing is that it apparently orginated from Linux/Gnome, since the file-explorer resembles the File-browser of Gnome. But it has also a Windows installer.

When you start the tool from the windows menu, it's started with the toolbox docked or attached to the canvas. But when you use either dia.exe or diaw.exe from the command line, or as I wanted to do from the toolbar from TotalCommander, you get two seperate windows. One for the toolbox and one for the canvas. So how to start it with a docked toolbox? With a little trial&error I found the following command:
dia-win-remote.exe diaw.exe --integrated
In the bin folder of the Dia-installation-home, there is also a dia-win-remote.exe. It takes one of the other exe's (dia.exe or diaw.exe) as an input. If you add the option "--integrated" it will show the combined window.

Wednesday 13 May 2015

Expand swap using SSM

The mere reason that I dug into SSM yeasterday was that I wanted to install the Oracle Database 12c.

(Did you know yesterday came from the word 'yeast'? So actually yeasterday: because one used the yeast of the day before to bake the bread of today. Also in Dutch  the word for yeast: 'gist', still sounds in the word for yeasterday: 'gisteren'.)

I ran however against the prerequisite check on the swap space that was only 2GB because of my default OL7 install. And the Universal Installer required 8GB at least. So I needed to expand it. There are several ways to do it. But since I was into SSM, it was a good practice to use that. And it turns out very simple to do. It shows how easy it is to add a new device to a pool and an existing volume.

So I created a new disk of 8GB to my VM (I only need 8GB, but I thought I'd simply add it to the existing 2GB, to be certain to have enough with 10GB).


So, after booting up, verify existence of non assigned device (/dev/sdc):
[root@darlin-vce-db ~]# ssm list
--------------------------------------------------------------
Device         Free       Used      Total  Pool    Mount point
--------------------------------------------------------------
/dev/sda                         20.00 GB          PARTITIONED
/dev/sda1                       500.00 MB          /boot      
/dev/sda2  40.00 MB   19.47 GB   19.51 GB  ol                 
/dev/sdb    0.00 KB  100.00 GB  100.00 GB  pool01             
/dev/sdc                          8.00 GB                     
--------------------------------------------------------------
-----------------------------------------------------
Pool    Type  Devices      Free       Used      Total  
-----------------------------------------------------
ol      lvm   1        40.00 MB   19.47 GB   19.51 GB  
pool01  lvm   1         0.00 KB  100.00 GB  100.00 GB  
-----------------------------------------------------
---------------------------------------------------------------------------
Volume  Pool    Volume size  FS     FS size       Free  Type    Mount point
---------------------------------------------------------------------------
/dev/ol/root
        ol         17.47 GB  xfs   17.46 GB   12.29 GB  linear  /          
/dev/ol/swap
        ol          2.00 GB                             linear             
/dev/pool01/disk01
        pool01    100.00 GB  xfs   99.95 GB   99.95 GB  linear  /u01       
/dev/sda1
                  500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
---------------------------------------------------------------------------

Then add the device to the 'ol'-pool:
[root@darlin-vce-db ~]# ssm add -p ol /dev/sdc
  Physical volume "/dev/sdc" successfully created
  Volume group "ol" successfully extended

And verify again:
[root@darlin-vce-db ~]# ssm list
--------------------------------------------------------------
Device         Free       Used      Total  Pool    Mount point
--------------------------------------------------------------
/dev/sda                         20.00 GB          PARTITIONED
/dev/sda1                       500.00 MB          /boot      
/dev/sda2  40.00 MB   19.47 GB   19.51 GB  ol                 
/dev/sdb    0.00 KB  100.00 GB  100.00 GB  pool01             
/dev/sdc    8.00 GB    0.00 KB    8.00 GB  ol                 
--------------------------------------------------------------
----------------------------------------------------
Pool    Type  Devices     Free       Used      Total  
----------------------------------------------------
ol      lvm   2        8.04 GB   19.47 GB   27.50 GB  
pool01  lvm   1        0.00 KB  100.00 GB  100.00 GB  
----------------------------------------------------
---------------------------------------------------------------------------------------
Volume              Pool    Volume size  FS     FS size       Free  Type    Mount point
---------------------------------------------------------------------------------------
/dev/ol/root        ol         17.47 GB  xfs   17.46 GB   12.29 GB  linear  /          
/dev/ol/swap        ol          2.00 GB                             linear             
/dev/pool01/disk01  pool01    100.00 GB  xfs   99.95 GB   99.95 GB  linear  /u01       
/dev/sda1                     500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
---------------------------------------------------------------------------------------

Now resize the swap volume:
[root@darlin-vce-db ~]# ssm resize -s+8GB /dev/ol/swap
  Size of logical volume ol/swap changed from 2.00 GiB (512 extents) to 10.00 GiB (2560 extents).
  Logical volume swap successfully resized

And, again, verify:
[root@darlin-vce-db ~]# ssm list
--------------------------------------------------------------
Device         Free       Used      Total  Pool    Mount point
--------------------------------------------------------------
/dev/sda                         20.00 GB          PARTITIONED
/dev/sda1                       500.00 MB          /boot      
/dev/sda2   0.00 KB   19.51 GB   19.51 GB  ol                 
/dev/sdb    0.00 KB  100.00 GB  100.00 GB  pool01             
/dev/sdc   36.00 MB    7.96 GB    8.00 GB  ol                 
--------------------------------------------------------------
-----------------------------------------------------
Pool    Type  Devices      Free       Used      Total  
-----------------------------------------------------
ol      lvm   2        36.00 MB   27.47 GB   27.50 GB  
pool01  lvm   1         0.00 KB  100.00 GB  100.00 GB  
-----------------------------------------------------
---------------------------------------------------------------------------------------
Volume              Pool    Volume size  FS     FS size       Free  Type    Mount point
---------------------------------------------------------------------------------------
/dev/ol/root        ol         17.47 GB  xfs   17.46 GB   12.29 GB  linear  /          
/dev/ol/swap        ol         10.00 GB                             linear             
/dev/pool01/disk01  pool01    100.00 GB  xfs   99.95 GB   99.95 GB  linear  /u01       
/dev/sda1                     500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
---------------------------------------------------------------------------------------

Now check the swap space:
[root@darlin-vce-db ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1

Hey, it's still 2GB!

Let's check fstab to get the swap mount-definitions: 
[root@darlin-vce-db ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon May 11 20:20:14 2015
#
# 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
#
/dev/mapper/ol-root         /                       xfs     defaults        0 0
UUID=7a285d9f-1812-4d72-9bd2-12e50eddc855 /boot                   xfs     defaults        0 0
/dev/mapper/ol-swap     swap                    swap    defaults        0 0
/dev/mapper/pool01-disk01    /u01                       xfs     defaults        0 0


Turn off swap:
[root@darlin-vce-db ~]# swapoff /dev/mapper/ol-swap

And (re-)create new swap:
[root@darlin-vce-db ~]# mkswap -c /dev/mapper/ol-swap
0 bad pages
mkswap: /dev/mapper/ol-swap: warning: wiping old swap signature.
Setting up swapspace version 1, size = 10485756 KiB
no label, UUID=843463de-7552-4a73-84a6-761f261d9e9f

Then enable swap again:
[root@darlin-vce-db ~]# swapon /dev/mapper/ol-swap

And check swap again:
[root@darlin-vce-db ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    10485756    0    -1

Yes!!! That did the job. Easy does it...

Tuesday 12 May 2015

LVM with SSM on OL7

Or how to  encrypt your title with acronyms...

Today I wanted to create a VM with an Oracle SOA/BPM Suite 12c installation, since I'm to give a workshop on the installation of it. I used Oracle Linux 6 for my installations and the last few years I did play around quite a lot with it (for someone who is not a core systems administrator), to upgrade all my VM's to the latest update, remove obsolete kernels, add volumes to do installations, etc. I used Oracle database 11g, that in the last few monts I upgraded to the latest patch set of 11gR2 11.2.0.4.

I could do with a OL6U6 VM with that upgraded 11gR2 database, I did a upgrade of a quite clean VM only yesterday. But since OL7 is in the field already, and DB12c even for a few years. So I thought to try my luck with that.

However, I found that OL7 behaves quite different compared to OL6. Gnome is different, but tools like Logical Volume Manager are absent.  I found that there is no graphical LVM available in OL7 apparently. Since I'm not the only one that sought for it in vain, I assume it's really not there. By the way: there is a disks tool, but that only allows you to format a bare disk, not to create LV's.

Luckily I found this great article on a new tool from Red Hat: the system storage manager (ssm). Apparently it is open source, since you can find it on sourceforge, and it is available for Oracle Linux as well.

Install ssm 

Yep, you need to install it first:
$ sudo yum install system-storage-manager
Or do it as root (I'm didn't setup sudo for my one-user-virtual-course-environments):
[root@darlin-vce-db ~]# yum install system-storage-manager
By the way: system-config-lvm, the LVM in previous OL's, is apparently deprecated.

List volumes

First list the current devices and volumes using 'ssm list':
[root@darlin-vce-db ~]# ssm list
-----------------------------------------------------------
Device         Free      Used      Total  Pool  Mount point
-----------------------------------------------------------
/dev/sda                        20.00 GB        PARTITIONED
/dev/sda1                      500.00 MB        /boot      
/dev/sda2  40.00 MB  19.47 GB   19.51 GB  ol               
/dev/sdb                       100.00 GB                   
-----------------------------------------------------------
-------------------------------------------------
Pool  Type  Devices      Free      Used     Total  
-------------------------------------------------
ol    lvm   1        40.00 MB  19.47 GB  19.51 GB  
-------------------------------------------------
-------------------------------------------------------------------------------
Volume        Pool  Volume size  FS     FS size       Free  Type    Mount point
-------------------------------------------------------------------------------
/dev/ol/root  ol       17.47 GB  xfs   17.46 GB   12.81 GB  linear  /          
/dev/ol/swap  ol        2.00 GB                             linear             
/dev/sda1             500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
-------------------------------------------------------------------------------
As you can see, I added a new disk to my VM, that is listed as /dev/sdb.  And you can't find it in the volumes, because I didn't do anything with it yet.
 

Add new LV mounted on /u01 

In the past, you needed to perform quite some steps to create a volume: you had to prepare a disk, create a volume group, add a volume to it, assign space to the volume, make a filesystem on it, and mount it.

Now, here's where ssm pays off. Let's first create a folder to use as a mount point.
[root@darlin-vce-db ~]# mkdir /u01
I picked up the name of this mountpoint  during my Oracle days, with my first steps on Linux. But I can't remember what the story or rationale is behind 'u01'. However, it works for me, and it shows up in the Oracle doc, so I stick with it.

Now, lets create a volume called disk01, on a pool called pool01 with /dev/sdb assigned to it, and let's create the new default filesystem xfs on it. Oh, and my SDB was created with a size of 100GB:
[root@darlin-vce-db ~]# ssm create -s 100GB -n disk01 --fstype xfs -p pool01 /dev/sdb /u01
Not enough space (104853504.0 KB) in the pool 'pool01' to create volume! Adjust (N/y/q) ? Y
  Logical volume "disk01" created.
meta-data=/dev/pool01/disk01     isize=256    agcount=4, agsize=6553344 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=26213376, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=12799, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Apparently this could be done in one go. Since the 100GB of the disk does not match exactly the 100GB asked for the volume, it asked to adjust it.

Now do a list again
[root@darlin-vce-db ~]# ssm list
--------------------------------------------------------------
Device         Free       Used      Total  Pool    Mount point
--------------------------------------------------------------
/dev/sda                         20.00 GB          PARTITIONED
/dev/sda1                       500.00 MB          /boot      
/dev/sda2  40.00 MB   19.47 GB   19.51 GB  ol                 
/dev/sdb    0.00 KB  100.00 GB  100.00 GB  pool01             
--------------------------------------------------------------
-----------------------------------------------------
Pool    Type  Devices      Free       Used      Total  
-----------------------------------------------------
ol      lvm   1        40.00 MB   19.47 GB   19.51 GB  
pool01  lvm   1         0.00 KB  100.00 GB  100.00 GB  
-----------------------------------------------------
---------------------------------------------------------------------------------------
Volume              Pool    Volume size  FS     FS size       Free  Type    Mount point
---------------------------------------------------------------------------------------
/dev/ol/root        ol         17.47 GB  xfs   17.46 GB   12.81 GB  linear  /          
/dev/ol/swap        ol          2.00 GB                             linear             
/dev/pool01/disk01  pool01    100.00 GB  xfs   99.95 GB   99.95 GB  linear  /u01       
/dev/sda1                     500.00 MB  xfs  496.67 MB  305.97 MB  part    /boot      
---------------------------------------------------------------------------------------

Here you find that there is now a pool called 'pool01', with a volume  named 'disk01', mounted on /u01.

To List filesystem on '/u01' issue the command 'df /u01':
[root@darlin-vce-db ~]# df /u01
Filesystem                1K-blocks  Used Available Use% Mounted on
/dev/mapper/pool01-disk01 104802308 32928 104769380   1% /u01

 I want to have it added to the /etc/fstab, to have it auto mounted. So edit the file as follows:
[root@darlin-vce-db u01]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon May 11 20:20:14 2015
#
# 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
#
/dev/mapper/ol-root      /                       xfs     defaults        0 0
UUID=7a285d9f-1812-4d72-9bd2-12e50eddc855 /boot                   xfs     defaults        0 0
/dev/mapper/ol-swap     swap                    swap    defaults        0 0
/dev/mapper/pool01-disk01 /u01                       xfs     defaults        0 0


I duplicated the first line, with /dev/mapper/ol-root, to the end of the file, and renamed the device according to the filesystem listing of /u01 above. And the mountpoint to /u01 of course.

Create group oinstall and add it to oracle 

I want to use the new volume for my Oracle installations. So first lets create the group oinstall and add it to oracle:
[root@darlin-vce-db u01]# groupadd oinstall
[root@darlin-vce-db u01]# usermod oracle -G oinstall --a
[root@darlin-vce-db u01]# groups oracle
oracle : oracle oinstall
Then add an app folder and make oracle owner of it
[root@darlin-vce-db ~]# cd /u01
[root@darlin-vce-db u01]# mkdir app
[root@darlin-vce-db u01]# chown oracle:oinstall app

Conclusion

That wasn't too hard, was it? Following the article mentioned earlier, you can add disks to a volume about as easy. Now, I'll be off to try to install DB12c...

Wednesday 6 May 2015

No space left on device...

Today I ran into something curious, that I saw a few weeks ago on a training that I gave: the root filesystem  ran full (Oracle Linux 6). At first I did not find anything that caused the problem, but the command 'df -k' indeed suggested a full root filesystem. Using 'du -sh /home/oracle' we found that that folder consumed an unreasonable amount of space. In my case today I found the same. It turns out that there are 2 hidden files that were the problem:

[oracle@darlin-vce-soa ~]$ ls -al
...
-rw-------.  1 oracle oinstall 4488290304 May  6 16:09 .xsession-errors
-rw-------.  1 oracle oinstall      19752 May  4 16:47 .xsession-errors.old
[oracle@darlin-vce-soa ~]$ rm -rf .xsession-errors
[oracle@darlin-vce-soa ~]$ rm -rf .xsession-errors.old 
 
As you can see the .xsession-errors file is terribly large, in the training we found that it was the .old file. Actually it turns out that these files are rolling errors-logs of the output of applications that use a graphical interface. In this case it logs amongst others the output of JDeveloper, and my grow very large due to java-exceptions. So in case of a regular exception raised by JDeveloper, you might want to keep these files 'in the eye'.

You can savely remove those files, to save up space. But if they have grown that big, you might want to tail those to see what causes the problems.

Another tip might be to remove old kernels: when upgrading to a new kernel, Oracle Linux keeps the old kernel files. You can find a description to remove those here.