'Technical' Archive | RSS

Removing a LVM Volume Group in Linux 

What if you created a volume group in LVM and no longer need it? Well, to properly clean everything up follow the steps below. First, let’s identify the target.  In this case, I made a temporary /u2 partition, that I now no longer need: # df -h /u2 Filesystem Size Used Avail Use% Mounted on […]

Sending mail from command line using Mutt 

I use this to attach reports (pdfs, etc) to emails in my scripts. Small Perl snippet: system(“/usr/bin/mutt -i $file_with_body_content -a $file_to_attach -s “Some Random Report $report_date” $mailto < /dev/null”); And since this has now bitten me twice, make sure that there are no variables with carriage returns at the end. In my case, both times […]

Useful Networker Commands 

For use with EMC (Legato) Networker… Move everything off of a specific volume onto another pool (Careful, does not take into account possible clones – add /cloneid somehow to the end. I haven’t been able to automate that yet): # for i in `/usr/sbin/mminfo -q “volume=OLDVOLUME” -r “ssid”`; do /usr/sbin/nsrstage -v -b NEWPOOL -s NETWORKERSERVERNAME […]

Random Useful Scripts 

Convert plain text to passwd crypt: #!/usr/bin/perl print “Enter the password you would like to use: “; $pass1 = <STDIN>; if ($pass1) { my $salt = join(”, (‘.’, ‘/’, 0..9, ‘A’..’Z’, ‘a’..’z’)[rand 64, rand 64]); my $cryptpw = crypt($pass1, $salt); print “The encrypted password suitable for passwd is $cryptpwn”; } Convert base64 encoded to plain […]

Add hard drive to extend existing LVM volume 

Previously I posted how to add a hard drive and create a new volume in LVM. This time we’ll add a new hard drive and then increase or extend the size of an existing volume or partition. This is an example using an RHEL 5 derivative, OEL 5. The server is really a VM inside […]