mount bind linux vs application reconfiguring

When configuring Linux systems one of the golden rules is to outsource the configuration and application data to another volume. This can easily be done for example by mounting /opt on another disk and performing installations on /opt.

Installations on other volumes are simple provided you do not have recourse to the repository of the distribution you’re using, in this case we will have settings and data in a few places. In such a situation we can do 2 things:

  1. Wander around all the configuration files of the application in question and modify routes logs, data, settings, etc… a lot of work.
  2. Use mount with the option –bind and not touch anything on the application.


Continue reading

Oracle database statistics, gathering, speed and activity redo log

Each new version of the optimizer is increasingly dependent on the statistics, the quality of which may be sufficient for an earlier version but not the current.

As a rule be analyzed a table (in casacada, ie including indexes) significant modifications are made upon it. For example:

  • truncates
  • Insert into .. select …
  • Any insert, update and deletion bulk (bulk means that affects more than 20% of all records)

The statistics can be obtained in many ways, some faster than others (partial estimates, complete, etc …) and more or less redologs generation.

For example if we use the DBMS_STATS package ( specifically the sub-program GATHER_TABLE_STATS (, the syntax is very similar to the sub-programs:

Continue reading

Change redo logs from filesystem to RAW

There is one thing I particularly like, but it is possible that we find people who say that if the database performance is greatly improved with raw redo in front of a filesystem (ext4 for example).

To find out for sure we can work with RAW mode redologs very easily. Let’s take an example made in Red Hat 4, with a test BDD with 3 redologs of 51 MB each:

[oracle@clu01 DBU]$ ls -l
total 1502076
-rw-r-----  1 oracle oinstall   9748480 Jun 25 20:38 control01.ctl
-rw-r-----  1 oracle oinstall   9748480 Jun 25 20:38 control02.ctl
-rw-r-----  1 oracle oinstall   7061504 Jun 12 11:36 control03.ctl
-rw-r-----  1 oracle oinstall  52429312 Jun 25 11:06 redo01.log
-rw-r-----  1 oracle oinstall  52429312 Jun 25 10:39 redo02.log
-rw-r-----  1 oracle oinstall  52429312 Jun 25 10:39 redo03.log
-rw-r-----  1 oracle oinstall 545267712 Jun 25 20:38 sysaux01.dbf
-rw-r-----  1 oracle oinstall 744497152 Jun 25 20:38 system01.dbf
-rw-r-----  1 oracle oinstall  20979712 Jun 23 21:22 temp01.dbf
-rw-r-----  1 oracle oinstall  36708352 Jun 25 20:38 undotbs01.dbf
-rw-r-----  1 oracle oinstall   5251072 Jun 25 20:38 users01.dbf

Continue reading

rescan scsi linux

If we add disks in hot (from any system virtualization) it is possible that the OS does not know until we do a rescan of the SCSI bus, this can be done with the tool:

Source -a

To install RedHat/Centos:

yum install sg3_utils

Continue reading

LVM external drive, HDD data access with LVM partition (eg a USB HD)

The LVM volumes have many advantages but when you connect a hard drive (with LVM) to an operating system (for example via USB) and want to access the data, we see that is not automatic.

To access the data directly we can mount the volume because the device simply does not exist, this can be easily solved. The sequence of actions is:

1- Connect the HD (logically)
2- Perform vgscan
3- Perform lvscan
4- Enable LVM volume desired
5- Mount the device and access the data

To extract HDD must:

Continue reading

md raid replace drive, software mdRAID

On this occasion we will see how to regenerate a software RAID in Linux.

Detected by SMART error type:

Smarctl diagnosis:

[root@simba ~]# smartctl -H /dev/sda
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-2.6.32-279.el6.x86_64] (local build)
Copyright (C) 2002-11 by Bruce Allen,
SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.
Failed Attributes:
1 Raw_Read_Error_Rate     0x002f   001   001   051    Pre-fail  Always   FAILING_NOW 330223

Continue reading

smartctl disk health check in Linux

Let’s see how to obtain the status of a HDD using SMART technology (monitoring and analyzing HD

First we need to install is the smartmontools package (in Red Hat or CentOS so, in other distributions command different):

yum install smartmontools

We can get information from a disk:

Continue reading

Linux mount disk UUID and /etc/fstab

Almost everyone knows how to add an automatic mounting /etc/fstab, perhaps not used as it should the mounting is using UUIDs.

The UUID (Universally Unique Identifier) is a unique identifier for each file system. It is very interesting because it allows use as a reference for installation, ie instead of using /dev/sdb1 (physical connection reference) may use UUID and thus could change the connections of the discs without the mount points they saw affected.

The tool to know the UUID of the discs is:

[root@test ~]# blkid
/dev/sdb1: UUID="a210f4aa-0333-4827-b4f0-4a987c3364cf" TYPE="ext4"
/dev/sdb2: UUID="2133ef48-5eb9-4413-8b42-2f5f023a765b" TYPE="ext4"
/dev/sda1: UUID="0cdd3b92-349c-407f-87d2-63242782b531" TYPE="ext4"
/dev/sda2: UUID="rNf0sI-d44o-5c3f-VJMJ-zdhk-eT4q-Lc8xXT" TYPE="LVM2_member"
/dev/mapper/vg_test-lv_root: UUID="6c9fa623-8bc4-4143-b8a5-f7d0966980c9" TYPE="ext4"
/dev/mapper/vg_test-lv_swap: UUID="b382f6a5-0a63-4ab8-aaf4-8b8c1c0b969d" TYPE="swap"

Continue reading

Linux volume encryption (LUKS, Linux Unified Key Setup) in RedHat/CentOS 6

In this post we will create an encrypted volume, which is useful if you work with a laptop and want to ensure your data against theft.

You can do interesting things, as we ask the key to start or hold the key for example in a USB. It seems to me very good choice of a USB device with the key to start.

Let the matter, the steps are:

1- make sure we have the kernel module loaded with dm_crypt :

[root@test ~]# lsmod | grep dm_crypt
dm_crypt 10848 2
dm_mod 63859 11 dm_crypt

Continue reading

Linux LVM howto, Creation, expansion and reduction of volumes

I will show how to create, expand and reduce LVM volumes, all these actions have been performed with RedHat 6 LVM directly from the console. I think it goes without saying, but it is advisable to make a backup of the original disks.

The first thing is to understand the structure that follows LVM works with 3 types of elements:

  • Volume groups, all related commands that begin with vg*, a volume group can contain one or more logical volumes. And it is composed of physical volumes.
  • Logical volumes, all related commands begin with lv*, a logical volume resides within a volume group.
  • Physical volumes, in this case all commands start with pv*, a volume group are composed of one or more physical volumes.

There are a number of commands to manage LVM volumes:

Continue reading