i needed a bigger swap, its size was 2 Gb and we needed it to grow to 16gb, so we decided to shrink /. A task anybody
would say not possible.
So we tuck in the first installation CD for oracle enterprise linux and when prompted for a kernel option we
issued
: linux recover
Once asked to mount the root partition we said yes…
it ended up in /dev/VolGroup00/LogVol00
we checked a df -k, and it was mounted as /mnt/sysimage, and had a dev, proc and other directories
mounted inside, which were not evident in the df -k, so did a
# cat /etc/mtab
and found other dirs mounted, so for each entry in mtab inside /mnt/sysimage we unmounted it, and ended
up unmounting /mnt/sysimage
#umount /mnt/sysimage/selinux
#umount /mnt/sysimage/dev
#umount /mnt/sysimage/sys
#umount /mnt/sysimage/proc
#umount /mnt/sysimage/boot
#umount /mnt/sysimage
To reduce the filesystem, after unmounted and we issued:
# e2fsck -f /dev/VolGroup00/LogVol00
# resize2fs /dev/VolGroup00/LogVol00 110G
After that we needed to resize the volume, so we issued:
# lvm
> lvreduce -L -16G /dev/VolGroup00/LogVol00
And that did the trick to reduce the / filesystem
Then we booted up the server and resized the swap volume issuing:
# lvresize -L +16G /dev/VolGroup00/LogVol01
Had to remake the swap area
190/433
# swapoff /dev/VolGroup00/LogVol01
# mkswap /dev/VolGroup00/LogVol01
And remount it
# swapon -a
You can verify the new swap size with a “top”
191/433
Author: rdircio
Add new UFS filesystem to existing zone from metadevice
You have to create it in the global zone, add it with zoneconfig, then mount it manually from the global zone bash-3.00# zonecfg -z zones004z3 zonecfg: zones004z3> add fs zonecfg: zones004z3:fs> set dir=/myzone/cpbatch zonecfg: zones004z3:fs> set special=/dev/md/dsk/d132 zonecfg: zones004z3:fs> set raw=/dev/md/rdsk/d132 zonecfg: zones004z3:fs> set type=ufs zonecfg: zones004z3:fs> end zonecfg: zones004z3> verify zonecfg: zones004z3> commit zonecfg: zones004z3> exit bash-3.00# mount /dev/md/dsk/d132 /zones/CHB/myzone/cpbatch
Configure resolution and depth in a Sun xvr-600 graphics card
I have this graphics card in a sunblade150, and thought it could be configured using m64config. I tried to, but it did not
work.
For this card, you must use “fbconfig”
# fbconfig -dev /dev/fbs/jfb0 -defdepth 24 -res 1280x1024x76 now
did the trick
282/433
Get tape drive information from NetBackup
/usr/openv/volmgr/bin/scan
will tell you detailed info about your tape drives
Thanks to Alberto Vazquez
109/433
See connections to your server
You ever wanted to see what connections are in place to your server?
I wrote a script called /usr/bin/conn with this:
netstat -na | egrep ‘tcp’ | grep -v LISTEN
and then just ran
# chmod 755 /usr/bin/conn
# watch conn
and now i’m watching the live connections!
207/433
get your top 10 list !!!
To get this week’s top ten from the web, you can first ask billboard using topten.ksh:
#!/bin/ksh
echo “—- getting bilboard’s heatseeker”
curl
158/433
“http://206.130.124.43//htmlsite/html_top.php?id=23&CALL_URL=http%3A//www.billboard.com/bbcom/charts/chart_display.jsp%3Fg%3DSingles%26f%3DHot%2 BDance%2BClub%2BPlay”
> /tmp/bb-hs.txt
cat /tmp/bb-hs.txt | sed -e ‘s/<[^>][^>]*>//g’ -e ‘/^ *$/d;s// /g;s/Featuring//g;s/ the //g’ | tr -s ‘ ‘ | grep “|”|
grep -iv billboard| cut -d ” ” -f4-9 > terms.txt
The top ten list is parsed and ends up as a text only list in “terms.txt”. We now proceed to search and
download the files both from filestube and skreemr, we use a PHP script called mysearch.php to look for files
in filestube(remembver to use your own key for filestube instead of XXXXXXXX):
#!/usr/bin/php
<?php
// Correct English grammar…
$argc > 1 x y z $plural = ‘s’ : $plural = ”;
// Display the number of arguments received
//fwrite(STDOUT, “Got $argc argument$pluraln”);
$args=””;
// Write out the contents of the $argv array
foreach ( $argv as $key => $value ) {
// fwrite(STDOUT,”$key => $valuen”);
if($key!=0){
if($key>1){
$args=”{$args}%20{$value}”;
}else{
$args=”{$value}”;
}
}
}
//print “args are:”;
159/433
//print $args;
$url=”http://api.filestube.com/? key=XXXXXXXXXXXXXXXXXXXXXXX&phrase=$args&extension=mp3&page=1″;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$result = curl_exec($ch) ;
print curl_error($ch);
curl_close($ch);
$document = new DOMDocument(‘1.0’, ‘UTF-8’);
$document->loadXML($result);
$answer = $document->getElementsByTagName(‘answer’)->item(0);
if($answer!=null) {
$hasResults = $answer->getElementsByTagName(‘hasResults’)->item(0);
if($hasResults->nodeValue == 1)
{
$hits = $answer->getElementsByTagName(‘hits’);
foreach($hits as $hit)
{
$name = $hit->getElementsByTagName(‘name’)->item(0)->nodeValue;
$extension = $hit->getElementsByTagName(‘extension’)->item(0)->nodeValue;
$desc = $hit->getElementsByTagName(‘description’)->item(0)->nodeValue;
$size = $hit->getElementsByTagName(‘size’)->item(0)->nodeValue;
$address = $hit->getElementsByTagName(‘address’)->item(0) ->nodeValue;
$details = $hit->getElementsByTagName(‘details’)->item(0) ->nodeValue;
$added = $hit->getElementsByTagName(‘added’)->item(0)->nodeValue;
$related = $hit->getElementsByTagName(‘related’)->item(0) ->nodeValue;
$counter=$hit->getAttribute(‘id’);
print “$name | “;
print ” $address nr”;
}
}
else {
print ‘0 resultsnr’;
}
}
else {
$error = $document->get ElementsByTagName(‘error’)->item (0);
if($error!=null){
$message = $error->getElementsByTagName(‘message’)->item(0)->nodeValue;
print ‘Message: ‘.$message.”nr”;
}
}
//——————————-SECOND PAGE!!!
$url=”http://api.filestube.com/? key=XXXXXXXXXXXXXXXXXXXXXXX
&phrase=$args&extension=mp3&page=2″;
$ch = curl_init();
160/433
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$result = curl_exec($ch) ;
print curl_error($ch);
curl_close($ch);
$document = new DOMDocument(‘1.0’, ‘UTF-8’);
$document->loadXML($result);
$answer = $document->getElementsByTagName(‘answer’)->item(0);
if($answer!=null) {
$hasResults = $answer->getElementsByTagName(‘hasResults’)->item(0);
if($hasResults->nodeValue == 1)
{
$hits = $answer->getElementsByTagName(‘hits’);
foreach($hits as $hit)
{
$name = $hit->getElementsByTagName(‘name’)->item(0)->nodeValue;
$extension = $hit->getElementsByTagName(‘extension’)->item(0)->nodeValue;
$desc = $hit->getElementsByTagName(‘description’)->item(0)->nodeValue;
$size = $hit->getElementsByTagName(‘size’)->item(0)->nodeValue;
$address = $hit->getElementsByTagName(‘address’)->item(0) ->nodeValue;
$details = $hit->getElementsByTagName(‘details’)->item(0) ->nodeValue;
$added = $hit->getElementsByTagName(‘added’)->item(0)->nodeValue;
$related = $hit->getElementsByTagName(‘related’)->item(0) ->nodeValue;
$counter=$hit->getAttribute(‘id’);
print “$name | “;
print ” $address nr”;
}
}
else {
print ‘0 resultsnr’;
}
}
else {
$error = $document->get ElementsByTagName(‘error’)->item (0);
if($error!=null){
$message = $error->getElementsByTagName(‘message’)->item(0)->nodeValue;
print ‘Message: ‘.$message.”nr”;
}
}
?>
Then we direct all the show with get.ksh:
#!/bin/ksh
#### Get the files from FilesTube
(cat terms.txt| while read line;do
./mysearch.php `echo $line | awk ‘{ print $1 ” ” $2 }’`| grep -i `echo $line | awk ‘{ print $3 }’` | head -1
done) >/tmp/results.txt
(cat /tmp/results.txt | while read result;do
curl “`echo $result | awk -F’|’ ‘{ print $2 }’| sed ‘s/ //g’`” | egrep ‘src.*mp3’ | awk -F”src=”” ‘{ print $2 }’ | awk ‘{
161/433
print $1 }’ | sed ‘s/”//g’
done) | while read url;do
wget -P /200gb/AUTODOWNLOADS “$url”
done
rm /tmp/results. txt
#### Or get them from skreemr
(cat terms.txt| while read line;do
st=`echo $line | awk ‘{ print $1 “+” $2 “+” $3 }’`
wget -P /200gb/AUTODOWNLOADS `curl “http://skreemr. com/results.jsp? q=$st” | egrep ‘href.*mp3’ | awk
-F”href=” ‘{ print $2 }’ | head -1 | sed ‘s/”//g’`
done)
The order of execution is: first “topten.ksh”, to get the list, then “get.ksh” to get the tracks.
Enjoy
162/433
copy only new files
To make a differential copy, so you copy all files in /a that are not in /b, you can do:
# cd /a
#/usr/local/bin/tar pcf – kraftek.html POSTS rescue rescued.html rescued.txt x y z | ( cd /b; /usr/local/bin/tar kxfp – )
The clue here is the “k” option, to keep existing files
compare directories for missing files
So you made a copy of /a into /b, but you see /b has less files, how to know which files are missing in /b x y z
# find /a | sort > as.txt
# find /b | sort > bs.txt
# comm -23 as.txt bs.txt
the last command will show the files that are in /a that are not in /b
enjoy
192/433
convert ext2 to ext3
Unmount your ext2 filesystem, then issue:
# tune2fs -j /dev/hda1
Where /dev/hda1 is the ext2 FS you want to convert.
then edit your fstab and change /dev/hda1 entry to be ext3
Easy!
210/433
get cpu and memory info in linux
to know how many cpus do you have there:
# cat /proc/cpuinfo
to know memory info
# cat /proc/meminfo
254/433
NetBackup 101 (for me)
ok, just hang with me while I learn NB.
some jobs were stalled in a machine, so we went to the media server and checked if the jobs were pending
and the tape drives were not in “TSD”:
bash-3.00# /usr/openv/volmgr/bin/vmoprcmd
PENDING REQUESTS
<NONE>
DRIVE STATUS
Drv Type Control User Label RVSN EVSN Ready Wr.Enbl. ReqId
0 dlt TSD – No – –
1 dlt TSD root Yes EBI219 EBI219 Yes Yes 1
ADDITIONAL DRIVE STATUS
Drv DriveName Multihost Assigned Comment
0 QUANTUMDLT70000 No –
1 QUANTUMDLT70001 No ebitdb1
In the “pending” section there were jobs pending on drv 1 and 0, and the tape drives were unavailable, so we
reset them:
# vmoprcmd -deny 0
# vmoprcmd -deny 1
# vmoprcmd -up 0
# vmoprcmd -up 1
We assumed the drives were recently fed with tapes, so after this jobs were running ok.
To see the active jobs…
#bpdbjobs -report |grep -i act
To see the queued jobs…
#bpdbjobs -report | grep -i que
To kill a job
#bpdbjobs -kill <job#>
To see the job summary…
#/usr/openv/netbackup/bin/bpdbjobs -summary
#bpps -a
To run an inventory on a tape library…
#bpinvent 0
259/433
Check last 24 hour’s errors
#bperror -U -backstat -hoursago 24
See available tapes
# available_media
Or go to bpadm – media mgmt – special actions – Inventory a Robot and Compare with Volume Configuration
To see if a tape is in the correct pool
#vmquery -m <mediaid>
To change a tape of pool
# vmchange -h ntxldb2 -p 1 -m NTXD53
(Where 1 is NetBackup and 2 is systems)
To see the pools
#vmpool -listall
A monitoring loop:
# while true;do clear; vmoprcmd; echo “active”; bpdbjobs -report |grep -i act;echo “queued”; bpdbjobs -report
|grep -i que;bpdbjobs -summary; bperror -U -backstat -hoursago 24| tail -15l; sleep 5; clear; done
Run bpadm for interactive actions
# bpadm
document
too
260/433