Linux

Linux - Howto recreate/restore PV/VG

Ohhhh.. I have lost the LVM metadata information on all my discs ... I lost all VG information .... vgscan , vgdisplay, pvscan, pvs, doesn't show any VG information! All disks are aviable on server and I can see It with multipath, but when I run pvscan/pvs, there's no LVM information on It.

May still have a hope of retrieving information from the PV / VG.

Run the procedure under their responsibility, the procedure described below could remove the entire contents of your VG.

Go to /etc/lvm/archiver/

cat from last copy from your vg file:

TCP/IP Access Using bash

When executing a command on a /dev/tcp/$host/$port pseudo-device file, Bash opens a TCP connection to the associated socket.

A socket is a communications node associated with a specific I/O port. (This is analogous to a hardware socket, or receptacle, for a connecting cable.) It permits data transfer between hardware devices on the same machine, between machines on the same network, between machines across different networks, and, of course, between machines at different locations on the Internet.

The following examples assume an active Internet connection.

Number of threads sorted by User

ps h -Led -o user | sort | uniq -c | sort -n

Linux - Find where inodes are being used


for i in *; do echo -e "$(find $i | wc -l)\t$i"; done | sort -n

Linux Unix Copiar contendio con redirected tar

Como copiar todo el contenido de un directorio a otro con tar como si fuera un backup restore, conservando todos los permisos y owners:

tar cvf - . | (cd /root/; tar xvf -)

Un ejemplo de copiar contenido con tar + remsh o ssh :

tar cvf - /oracle/client/11x_64/instantclient_11204 | remsh $SERVERNAME tar xvf - /oracle/client/11x_64/instantclient_11204
tar cvf - /oracle/client/11x_64/instantclient_11204 | ssh $SERVERNAME tar xvf - /oracle/client/11x_64/instantclient_11204

Linux - Eliminar scsi device

Para eliminar un scsi device directamente, primero buscamos el scsi device a eliminar. Tenemos dos posibles maneras para buscarlo:

Si tenemos lsscsi instalado, tomaríamos como referencia la referencia scsi que muestra al principio ejemplo 1:0:0:0:

[root@servidor01 ~]# lsscsi
[1:0:0:0] disk DGC LUNZ 0430 /dev/sda
[1:0:1:0] disk DGC LUNZ 0430 /dev/sdb
[1:0:2:0] disk DGC LUNZ 0430 /dev/sdc
[1:0:3:0] disk DGC LUNZ 0430 /dev/sdd

Linux - Serial Number con dmidecode

Para ver el serial number de una máquina:

dmidecode -s system-serial-number

También puedes ver el resto de información con:

dmidecode | less

Adding RedHat DVD as Repository

Create file:
/etc/yum.repos.d/rhel-dvd.repo

With the follow content:


[dvd]
name=Red Hat Enterprise Linux Installation DVD
baseurl=file:///mnt/dvd/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Create directory /mnt/dvd if not exist:

mkdir /mnt/dvd

Mount dvd :

mount /dev/dvd /mnt/dvd/

Thats all! now You're be able to install packages from dvd with yum command.

Minimal package install for X11 forwarding in Linux

Minimal package install for X11 forwarding in Linux

urw-fonts For X forwarding
xorg-x11-xauth For X forwarding

And X11Forwarding yes on file /etc/ssh/sshd_config

[root@server01 ~]# grep -i x11for /etc/ssh/sshd_config
X11Forwarding yes

Linux - Ups! he eliminado una LUN!

"Las prisas no son buenas"

Hemos creado un VolumeGroup de la siguiente forma:

export LDISK1=/dev/mapper/TEST_DATA01
export LDISK2=/dev/mapper/TEST_RESTO01
export LDISK3=/dev/mapper/TEST_REDO01

export VGNAME=VgTEST01
export LVSICE1=9G
export LVSICE2=10G
export LVSICE3=4000M
export LVSICE4=1G
export LVSICE5=23G

export LVNAME1=lvdata
export LVNAME2=lvdbexec
export LVNAME3=lvredo
export LVNAME4=lvdump
export LVNAME5=lvarch

pvcreate $LDISK1 $LDISK2 $LDISK3
read a
vgcreate $VGNAME $LDISK1 $LDISK2 $LDISK3
read a
echo "Vgcreados: " ; vgdisplay -v $VGNAME
read a

Distribuir contenido