Adding Hard Disk by UUID in Centos

Suppose that you create a fake Time Capsule with a Centos Server

HP MicroserverAnd suppose that you get a lot of new hard disk, and one of your fears is that one day you need to remove all hard disk from the server for make a maintenance operation. Will you remember the order when you want to add it again? Probably no, and when you switch on the server the mount points has been changed and a lot of Macs are overwriting the last backup or all the time capsule users call you saying.

My time machine shows a warning message,

Where are my backups?

I need my backups now because i was editing a file and I need the version of 24 hours ago NOW.

The solution is use UUID

I added the new hard disk one by one, create the needed partitions

fdisk /dev/sdx or gdisk /dev/sdx if you want gpt

mkfs.ext4 /dev/sdx1

blkid

 

Ovirt Guest Agent on Windows XP

oVirt

On the windows machine install

Python 2.7.3 for Windows.
http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi

Add python route into the PATH variable

Install Python for Windows extension (pywin32) version 216 for Python 2.7
http://sourceforge.net/projects/pywin32/files/pywin32/Build216/pywin32-216.win32-py2.7.exe/download

Download ovirt guest agent source code
https://github.com/oVirt/ovirt-guest-agent/archive/master.zip

uncompress the code and copy the folder ovirt-guest-agent to a localitation like  C:\ovirt-guest-agent

Open the file ovirt-guest-agent.py and edit the line

AGENT_CONFIG = ‘/etc/ovirt-guest-agent.conf’

to

AGENT_CONFIG = ‘C:\ovirt-guest-agent\ovirt-guest-agent.conf’

finally

open a msdos console

cd C;\ovirt-guest-agent

python OVirtGuestService.py install

net start OVirtGuestService

Move wordpress blog to another domain

If you need to move wordpress from one domain to another you only need to make a simple search and replace.

http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

First step

move your files to the new location, through ftp sftp ftps webdav ..

Second step

backup your database and move to the new server.

third step

upload a copy of Search and Replace Script and follow instructions

Clean all Mysql Data

/etc/init.d/mysql stop
/etc/init.d/mysql start
mysql -uroot
mysql -uroot   -e “show databases” | grep -v Database | grep -v mysql| grep -v information_schema| grep -v test | grep -v OLD |gawk ‘{print “drop database ” $1 “;select sleep(0.1);”}’ | mysql -uroot
/etc/init.d/mysql stop
rm ibdata1
rm ib_logfile*
rm -rf mysql
mysql_install_db
/usr/bin/mysqld_safe
/usr/bin/mysql_secure_installation

 

Enjoy

Fedora 19 Network Bonding without networkmanager

fedora_19_bonding

If your new server has two network interfaces use both in bonding can help you to get a better performance or failover tolerance.

If you want to create a bonding device first you need to disable network manager.

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

systemctl enable network.service
systemctl start network.service

Now you need to configure your network interfaces

ip link show

is the way to get your devices list

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: p33p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether ca:fe:ca:fe:ca:fe brd ff:ff:ff:ff:ff:ff
3: p2p1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether ca:fe:ca:fe:ca:ff brd ff:ff:ff:ff:ff:ff

in my case I have two network cards p33p1 and p2p1

If i move to /etc/sysconfig/network-scripts and make a ls i will see two files

ifcfg-enp2s0 and ifcfg-enp3s0

edit both files to appear like these

BOOTPROTO=none
NAME=<device name>
UUID= <leave as is>
HWADDR=<leave as is>
NM_CONTROLLED=”no”
MASTER=”bond0″
SLAVE=”yes”

Creating bond interface

create a file /etc/modprobe.d/bonding.conf with the content

alias bond0 bonding

Create a file in /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
BOOTPROTO=dhcp
ONBOOT=yes
BONDING_OPTS=”mode=0 ”
USERCTL=no
NM_CONTROLLED=”no”

reboot your system and enjoy :-P

Acelerating openbravo Pos cash desk closing

After several years using Openbravo Pos in my family’s business,  My father  says that cash desk closing takes about 5 minutes and growing every day that was a bit annoying.

  • backup database
  • reconfigure my.conf enabling innodb_file_per_table,
  • restart mysql
  • drop database
  • restore
  • and pass a mysqlcheck with optimize option

 

didn’t show a big performance increase.

Finally the solution was adding indexes into tables.

ALTER TABLE TAXLINES ADD INDEX receipt (RECEIPT);
ALTER TABLE TAXLINES ADD INDEX taxid (TAXID);
ALTER TABLE TAXES ADD INDEX category (category);
ALTER TABLE RECEIPTS ADD INDEX money (money);

Point of sale

Acpi problems in Centos with D945GCLF

I decided upgrade my home fileserver computer a D945GCLF motherboard adding a new 10/100/1000 pci ethernet card. After configure the new ethernet controller in my centos 6 and start downloading isos and big files I saw that kacpid process uses one cpu at 100% all time. I check the syslog and hundreds of lines like these appears

ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.LPC_.SMBR] (Node ), AE_AML_INFINITE_LOOP
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.LPC_.INIT] (Node ), AE_AML_INFINITE_LOOP
ACPI Error (psparse-0537): Method parse/execution failed [\_GPE._L00] (Node ), AE_AML_INFINITE_LOOP
ACPI Exception: AE_AML_INFINITE_LOOP, while evaluating GPE method [_L00] (20090903/evgpe-568)

If I disable the acpi in grub at next reboot the system lost one core and framebuffer etc etc.

What was the solution?

simply, Just Update the bios to the latest LF94510J.86A.0278.2010.0414.2000

Now I can enjoy 4x more speed that with integrated network card :-)

new networkcard

mt-daapd Centos 6 EPEL

I was triying to install a mt-daapd service into mi home server and found this error when I was starting the service
service mt-daapd start
Starting DAAP server: mt-daapd: client.c:778: avahi_client_errno: Assertion `client’ failed.
/bin/bash: line 1: 5063 Aborted /usr/sbin/mt-daapd

The problem was that you need the AVAHI daemon running to start mt-daapd server

yum install avahi
chkconfig avahi-daemon on
/etc/init.d/avahi-daemon start

service mt-daapd start

 

 

And now MT-Daap is working

Install BackupPC on Centos 6.3

BackupPC logo

Backups are important, every hard disk, every motherboard, every piece of hardware will fail.  Remember this if you don’t have a backup system.

Step 1. Install required software

enable epel repo

yum install wget

wget http://ftp.rediris.es/mirror/fedora-epel/6/i386/epel-release-6-7.noarch.rpm
rpm -i epel-release-6-7.noarch.rpm

yum install BackupPC

Step 2:enable Apache webserver

edit apache config file

vi /etc/httpd/conf/httpd.conf

and make apache run as backuppc user

User backuppc

edit BackupPC apache config

vi /etc/httpd/conf.d/BackupPC.conf

should be like these

<IfModule !mod_authz_core.c>
# Apache 2.2
order deny,allow
allow from all
allow from 127.0.0.1
allow from ::1
require valid-user
</IfModule>

chkconfig httpd on

/etc/init.d/httpd start

Step 3: Configure Backuppc password

htpasswd -c /etc/BackupPC/apache.users backuppc

Step 4: Enable BackupPC Service

chkconfig backuppc on

/etc/init.d/backuppc start

Step 5: Verify installation

open a browser and navigate to

http://<Backupchost>/backuppc

Clean backup pc install

Aventuras y desventuras de un futuro IT