What to do when a PV is missing..
April 23rd, 2012Here is a stupid command for a stupid me!
After some SAN maintenance, I figure out that I was no longer able to modify a LV on a RHEL 6.2 server, due to Cannot change VG vgname while PVs are missing..
The LV was first set as a two legs mirror, but only shows up as a single leg LV after the SAN maintenance:
lvs -a -olv_name,vg_name,devices vgname LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices lv_orabin vgname lv_orabin_mimage_0(0),lv_orabin_mimage_1(0) [lv_orabin_mimage_0] vgname /dev/mapper/360060160da612e00b879dacb1857e111(15360) [lv_orabin_mimage_1] vgname /dev/mapper/3600601602c502e00424263f91957e111(15360) lv_users vgname /dev/mapper/3600601602c502e00424263f91957e111(0)
The previous output shows that lv_users is not mirrored, but trying to mirror it leads to the missing PV error:
lvconvert -m1 -b vgname/lv_users --mirrorlog core \ /dev/mapper/360060160da612e00b879dacb1857e111 Cannot change VG vgname while PVs are missing. Consider vgreduce --removemissing.
To fix this, I probably don’t want to use the proposed solution (vgreduce), but the solution was in the following:
vgextend --restoremissing vgname /dev/mapper/360060160da612e00b879dacb1857e111
This has just made my day! ;-)
Looking for uuencode on RHEL6?
January 30th, 2012If you are used to send attachments by email using the mailx command line, you are probably used to uuencode.
I’ve just spent some time trying to figure out what happened to the sharutils package providing uuencode.
It appears that you no longer need it (for this purpose actually), as mailx now has the ability to send attachments:
SYNOPSIS
mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] \
[-b bcc-addr] [-r from-addr] [-h hops] [-A account] \
[-S variable[=value]] to-addr . . .
Enjoy!
UPDATE:
As previously stated, mailx is now able to attach files firectly to your emails, but, as a MIME attachment… And what if you want to process the email in an automated manner, let say, with procmail?
Well, in this case, you likely will use Perl and the MIME::Parser module.
Here is an example of a script saving the attachment to the /tmp directory:
#!/usr/bin/perl
use lib "/opt/my/compiled/perl-5.8.8/lib/site_perl";
use MIME::Parser;
$parser = MIME::Parser->new( );
$parser->output_dir("/tmp");
### Parse an input filehandle:
$entity = $parser->parse(\*STDIN);
exit 0;
UPDATE 2:
Things are getting better, but what if you’re not able to use Perl to extract the attachment and have to use uudecode?
Well, you can replace uuencode by using openssl to encode the attachment in base64, as shown below:
TOATTACH="/path/to/file" DEST="your@email.com" (echo; echo "begin-base64 644 $TOATTACH"; cat $TOATTACH | \ openssl base64; echo "====") | mailx -s "One human readable subject" $DEST
instead of
TOATTACH="/path/to/file" DEST="your@email.com" (echo; cat $TOATTACH | uuencode $TOATTACH) | \ mailx -s "One human readable subject" $DEST
Purge postfix mail queue
November 14th, 2011So ugly, but actually working if needed:
for mailid in
`mailq | awk -F' ' '{ if ( $1 ~ /^[A-F0-9]/ ) { print $1; } }'`; do
postsuper -d $mailid;
donemultipath, display blacklisted devices
November 11th, 2011A very simple command that can help troubleshooting a multipath configuration on linux, that you may already know about:
[root@linuxsrv ~]# multipathd -k > show devices [...] > show blacklist [...] >help
“help” is my favorite ![]()
Twitter plugin and b2evolution
September 24th, 2011If you’ve set b2evolution as your blog/cms engine a long time ago, you might have not set the short URL stuff.
By default, the twitter plugin use these short URLs to post the links to your blog… This is sad…
Here is how to fix this, getting the twitter plugin posting the whole URL to the post.
On line 148 of file plugins/twitter_plugin/_twitter.plugin.php, replace
'url' => $params['Item']->get_tinyurl(),
by
'url' => $params['Item']->get_url('public_view'),
You’re done!
