Removing volume group and logical volume after physical drive has been removed

root:/ # lvs
/dev/5gbdisk_vg/5gbdisk: read failed after 0 of 4096 at 1073676288: Input/output error
/dev/5gbdisk_vg/5gbdisk: read failed after 0 of 4096 at 1073733632: Input/output error
/dev/5gbdisk_vg/5gbdisk: read failed after 0 of 4096 at 0: Input/output error
/dev/5gbdisk_vg/5gbdisk: read failed after 0 of 4096 at 4096: Input/output error
/dev/sdc: read failed after 0 of 4096 at 0: Input/output error
/dev/sdc: read failed after 0 of 4096 at 10737352704: Input/output error
/dev/sdc: read failed after 0 of 4096 at 10737410048: Input/output error
/dev/sdc: read failed after 0 of 4096 at 4096: Input/output error
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
home sp3tosp4 -wi-ao--- 4.00g
var sp3tosp4 -wi-ao--- 8.00g
root:/ #

When the disk was physically removed, the /dev/sdc and this device nodes wasn’t automatically removed. The above errors are clearly indicating that /dev/sdc and /dev/myvg/mylv can no longer be read due to the removal of the disk.
Remove the stale /dev/sdc device node and clean up the stale device-mapper nodes. In the above example, this would be accomplished by either a simple reboot, or by running the following:

root:/ # dmsetup remove –force /dev/5gbdisk_vg/5gbdisk
root:/ # echo 1 > /sys/block/sdc/device/delete

root:/ # pvs
PV VG Fmt Attr PSize PFree
/dev/sdb sp3tosp4 lvm2 a-- 16.00g 4.00g
root:/ # lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
home sp3tosp4 -wi-ao--- 4.00g
var sp3tosp4 -wi-ao--- 8.00g
root:/ #

How to install RHEL EPEL repository on Centos 7.x or RHEL 7.x

The following instruction assumes that you are running command as root user on a CentOS/RHEL 7.x system and you would like to use Fedora Epel repositories.

Install Extra Packages for Enterprise Linux repository configuration (recommended). Just type the following command on a CentOS 7 or RHEL 7:

root# yum install epel-release

or

Install the extra EPEL repositories from dl.fedoraproject.org :


root# cd /tmp
root# wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
root# ls *.rpm
root# rpm -i epel-release-7-5.noarch.rpm

Install Open VMware Tools on CentOS 7

To install CentOS 7 in a virtual machine you can use either the standard CentOS distribution CD or the boot floppy/network method. The following installation instructions are for standard distribution CD.For Minimal install and Virtualization Host environments, Open VMware Tools is not available during installation. After CentOS 7 installation, to install Open VMware Tools, using root privileges, run the command:

root# yum install open-vm-tools

Exporting and NSS Volumes for NFS Access – OES11 to Linux.

Let say that you have OES11 machine with NSS volume and you would like to export this volume to Linux machine for sharing data.
To exporting and NSS Volume from an OES11 machine to a Linux machine, add the following to /etc/export on OES11 machine:

root# cat /etc/export
/media/nss/DATA/Shared/XXHR/BNMDEV1 Linux(fsid=1,rw,no_root_squash,sync,anonuid=1000,all_squash)
root#

To mount NSS volume from an OES11 machine into a Linux machine, add the following to /etc/fstab on Linux machine:

root# cat /etc/fstab
oes11:/media/nss/DATA/Shared/XXHR/BNMDEV1 /share/Shared/XXHR/BNMDEV1 nfs defaults 0 0
root#

to verity that everything is okay type mount command on a Linux machine, and you should see something like this:

root# mount
OES11:/media/nss/DATA/Shared/XXHR/BNMDEV1 on /share/Shared/XXHR/BNMDEV1 type nfs (rw,addr=172.16.12.12)

Troubleshooting and debugging syslog-ng.

Sometimes, syslog-ng seems to be working wrong, it does not send logs, or it does not start or in an extreme case it crashes.
Is it a real syslog-ng bug or not?

First of all, syslog-ng has a lot of parameters for debugging:

root# syslog-ng –help-all

-F, –foreground Do not go into the background after initialization
-v, –verbose Be a bit more verbose
-d, –debug Enable debug messages
-t, –trace Enable trace messages
-e, –stderr Log messages to stderr
-s, --syntax-only Only read and parse config file

For example:

root# syslog-ng -F
WARNING: the match() filter without the use of the value() option is deprecated and hinders performance, please update your configuration;
Error resolving reference; content='source', name='_src', location='/etc/syslog-ng/conf.d/iptables.conf:3:7'
root#

cat /etc/syslog-ng/conf.d/iptables.conf
destination iptables { file("/var/log/iptables.log" owner("user") group("adm") perm(0644)); };
filter iptables { facility(kern) and match("IN=") and match("OUT="); };
log { source(_src); filter(iptables); destination(iptables); };

So what is missing? ‘s’ in name=’_src’ The syntax should look like this:


cat /etc/syslog-ng/conf.d/iptables.conf
destination iptables { file("/var/log/iptables.log" owner("aryps") group("adm") perm(0644)); };
filter iptables { facility(kern) and match("IN=") and match("OUT="); };
log { source(s_src); filter(iptables); destination(iptables); };

Worth to add the following and not filter(iptables) to filter f_kern and filter f_messages so the filters will look like this:


cat /etc/syslog-ng/syslog-ng.conf
...
filter f_messages { level(info,notice,warn) and not facility(auth,authpriv,cron,daemon,mail,news) and not filter(iptables); };
filter f_kern { facility(kern) and not filter(f_debug) and not filter(iptables); };
...

Send a file as a mail attachment using mail command.

The simplest way to send a file as a mail attachment is shown by the following examples:

# uuencode snoopy1.jpeg snoopy1.jpeg | mail user@dump.4network.org

If user uses a current mail reader like Mozilla, Netscape Messenger or Microsoft Exchange, she/he will see a mail containing just one file attachment: the file “snoopy1.jpeg”.

This way we can include text, too:

# (cat mailtext; uuencode snoopy1.jpeg snoopy1.jpeg) | mail user@dump.4network.org

The file called “snoopy1.jpeg” again appears twice on the uuencode command line: the first time to specify the input file name, the second time for the remote extraction file name.

or

echo -e "text in line1 ntext in line2"| mail -s "Subject of an e-mail" -r "User1<user1@dump.4network.org>" -a "/tmp/abc.zip" name@domian.com