How to recover a LV after mirror failure

October 6th, 2009 fernandocosta No comments

How to recover a LV after mirror failure.

Way 1 – If you don’t have another devide to recover the mirror
*** always remember to check /etc/lvm/backup directory. ***

Try to activate all lvs:

# vgchange -ay

you’ll receive some errors like this:

Couldn’t find device with uuid ‘4bpgtD-txaN-rL2o-Mlii-0zx3-aGJB-DMTxco‘.

you can try to activate the lv in read-only mode. For example to do a backup of files into the lv:

# lvchange -ay /dev/vg00/testlv –partial
# mount /dev/vg00/testlv /mountpoint

and them you have to umount, deactivate the lv and remove missing pvs:

# umount /mountpoint

#lvchange -an /dev/vg00/testlv

#vgreduce –removemissing –force vg00

check if that errors are gone:

[root@localhost test]# pvs
PV         VG     Fmt  Attr PSize PFree
/dev/hdb   vg00   lvm2 a-   2.00G 1.96G
[root@localhost test]#

activate the lv and be happy:

# lvchange -ay /dev/vg00/testlv
# mount /dev/vg00/testlv /mountpoint

Way 2 – If you have another device to recover the mirror

find the UUID for the physical volume that are missing:

[root@localhost lvm]# pvs
Couldn’t find device with uuid ‘Bm8kJh-GJjL-aYbr-HI3K-EqnX-xOJA-wX3NbD‘.
.

.

[root@localhost lvm]#

Look into the diretory /etc/lvm/archive for the last known valid archived LVM metadata for that volume group.

Use the –uuid and –restorefile arguments of the pvcreate command to restore the physical volume:

[root@localhost lvm]# pvcreate –uuid “Bm8kJh-GJjL-aYbr-HI3K-EqnX-xOJA-wX3NbD” –restorefile /etc/lvm/archive/vg00_00017.vg /dev/hdd
Couldn’t find device with uuid ‘Bm8kJh-GJjL-aYbr-HI3K-EqnX-xOJA-wX3NbD’.
Physical volume “/dev/hdd” successfully created

[root@localhost lvm]#

Restore the VG configuration:

[root@localhost lvm]# vgcfgrestore vg00
Restored volume group vg00
[root@localhost lvm]#

Check if everything is ok:

[root@localhost test]# lvs -a -o +devices | grep testlv
testlv            vg00   mwi-ao  32.00M                        100.00         testlv_mimage_0(0),testlv_mimage_1(0)
[testlv_mimage_0] vg00   iwi-ao  32.00M                                       /dev/hdb(0)
[testlv_mimage_1] vg00   iwi-ao  32.00M                                       /dev/hdd(0)
[root@localhost test]#

Activate the volumes and mount:

[root@localhost test]# lvchange -ay /dev/vg00/testlv
[root@localhost test]# mount /dev/vg00/testlv /mountpoint

bye

Categories: Linux Tags: , , , , ,

How to increase a filesystem size on AIX 4.3

July 4th, 2009 fernandocosta No comments

On AIX 4.3 you have to calculate how many blocks it will be necessary.

If you want to increase 64M you have to do:

64 x 2048 = 131072 blocks

The final command would be:

chfs -a size=+131072 /FILESYSTEM

Very simple and useful.

Categories: AIX Tags:

How to get wwpn from Emulex HBA on RHEL 5.3

June 3rd, 2009 fernandocosta No comments

To get wwpn on RHEL (Red Hat) 5.3 just run this command:

# cat /sys/class/fc_host/host*/port_name

Output :

[root@xxxx ~]# cat /sys/class/fc_host/host*/port_name
0x10000000c985e038
0x10000000c985e03a
[root@xxxx ~]#

In this case I have 2 HBA’s. The wwpn numbers are:

10:00:00:00:c9:85:e0:38

10:00:00:00:c9:85:e0:3a

regards,

Fernando Costa

Categories: Uncategorized Tags:

Solution to the “Terminal too wide” problem on Solaris

May 22nd, 2009 fernandocosta No comments

On Solaris you sometimes get this error in vi:

Terminal too wide

One solution is to increase the number of the columns. Just run this command:

# stty columns 120

Or you can install vim (i think it’s better).

good luck!

Fernando Costa

Categories: Uncategorized Tags:

How to force the speed and duplex settings of an Ethernet card on RHEL 5

May 21st, 2009 fernandocosta No comments

A small but very usefull tip:

1 ) Get informations about the eth0:

# ethtool eth0

output:

[root@xxxx ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  Not reported
Advertised auto-negotiation: No
Speed: 100Mb/s
Duplex: Half
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Link detected: yes
[root@xxxx ~]#

Read more…

Categories: Uncategorized Tags:

Procedure to replace a mirrored disk on AIX

May 20th, 2009 fernandocosta 1 comment

Procedure to replace a mirrored disk on AIX

ps: Just for example I will use rootvg and hdisk1

1 ) Remove the disk from the mirror

# unmirrorvg -c1 rootvg hdisk1

2 ) Remove the boot area from hdisk1

# chpv -c hdisk1

3 ) Verify the unmirrored data

# lspv -l hdisk1

4 ) Move all that remained in hdisk1 to hdisk0

# migratepv hdisk1 hdisk0

Read more…

Categories: AIX Tags:

VPN entre CP FW-1 e Linux/Unix (Solução Opensource para a VPN CCEE)

December 3rd, 2007 fernandocosta No comments

Introdução:

Este tutorial apresenta uma forma de conectar a VPN Check-Point utilizando uma ferramenta Opersource. Como exemplo de conexão podemos citar a VPN solicitada pela CCEE para auditoria no mercado de energia.

Pré-requisitos:

Instale alguma distribuição Linux (ou até um UNIX) de sua preferência. Para o tutorial foi utilizado o debian etch.

Instalando os Softwares necessários:

# apt-get install racoon ipsec-tools

Read more…

Categories: VPN Tags:

Instalando e Configurando o pkg-get no Solaris

November 13th, 2007 fernandocosta No comments

Introdução:
pkg-get é um sistema de gerenciamento de pacotes bem parecido com o APT (debian) para Solaris. Seu objetivo principal é facilitar a nossa vida, tornando as tarefas de instalação, atualização e remoção de pacotes menos árdua.

Instalando o software:

Vamos baixá-lo em http://www.blastwave.org/

# pkgadd -d http://www.blastwave.org/pkg_get.pkg

Será mostrada a seguinte tela (siga os exemplos):

1 – Select package(s) you wish to process (or ‘all’ to process all packages). (default: all) [?,??,q]: all

2 – Do you want this directory created now [y,n,?,q] y

3 – Do you want to continue with the installation of <CSWpkgget> [y,n,?] y

Instale o wget

# /opt/csw/bin/pkg-get -i wget

Editanto o PATH:
Edite os arquivos /etc/default/login e /etc/default/su alterando adicionando /opt/csw/bin ao PATH.

Pronto, agora basta utilizar pkg-get -i PACOTE para instalar, de maneira simples, o que precisar.

Categories: Unix Tags:

Utilizando o Banco de Dados Firebird no GNU/Linux Debian

October 22nd, 2007 fernandocosta No comments

Bom dessa vez vou ser direto (sem introdução) pois o tempo está muito curto. :)

Instalando o Banco:

# apt-get install firebird2-super-server firebird2-utils-super firebird2-dev

Alterando a senha do sysdba:

Para alterar a senha do usuário sysdba utilizaremos um utilitário chamado gsec:

# /usr/lib/firebird2/bin/gsec -user sysdba -password masterkey

GSEC> modify sysdba -pw novasenha

GSEC> quit

Read more…

Categories: Bando de Dados Tags:

Comandos LVM

October 9th, 2007 fernandocosta No comments

Seguem alguns comandos para configuração de LVM

Instalando o LVM:

# apt-get install lvm2

Scaneando os discos, a procura de PV’s e VG’s:

# vgscan

Read more…

Categories: LVM Tags: