Monday, March 30, 2015

russians not employees are on my internal network sniffing around

sometimes you just want to know who looks at your internal site. you know, those ones behind the dmz. places like that. you use google analytics because it is nice.
then all of a sudden you notice hits from places like mozambique and st. lucia and russia, you get this feeling in your stomach that bad things have happened. really bad things
well. the google id you're provided with can be easily guessed. and that's what spammers do. they run through google ids to boost their sites. and it so happens that's what they're doing with your id. no worries. to figure out who really accesses your site, set up some custom ga code and a cookie.

use cookies for tracking:
google analytics
admin

property > Dd Custom Definitions | Custom Dimensions
+New Custom Dimension

Name: sitename-cookie
Scope: User
Active: checked

after creation:
My index is 1

var dimensionValue = 'SOME_DIMENSION_VALUE';
ga('set', 'dimension1', dimensionValue);

in my case:

SOME_DIMENSION_VALUE = sitename-cookie 
dimension1 = tasty-cookie


insert the following in java scriptlet:

var dimensionValue = 'sitename-cookie';
ga('set', 'tasty-cookie', dimensionValue);

google tag manager
https://www.google.com/tagmanager/
account sitename
container sitename
where to use: web pages
tags: google analytics

tag name: sitename-cookie
tag type: universal
tracking id: UA-XXXXXXXX-1 (google analytics id)

more settings | cookie configuration
cookie name sitename-cookie

more settings | custom dimensions
index 1
dimension value sitename-cookie

firing rules: all pages

create & publish

place gtm cookie as directed by google.

google analytics
admin

Filter | create new
Filer name sitename-cookie
include
Filter field sitename-cookie (custom)

Wednesday, March 25, 2015

nmap subnet scan with os details

this just churns and churns.
 #!/bin/bash  
   
 date=`date +%Y%M%d`;  
 OUTDIR=ip_audit_$date;  
   
 SUBNETS="8 9 10 11 16 20 24 28 32 128";  
   
 for net in $SUBNETS; do  
      for ip in `seq 1 254`; do  
          echo -n "192.168.$net.$ip: ";  
          ping -c 1 192.168.$net.$ip > /dev/null;  
          if [ $? == 0 ]; then  
              echo "up"; nmap -O 192.168.$net.$ip | grep 'OS details: ';  
          else  
              echo down;  
          fi;  
      done  
 done  
   

weechat log to html part deux

so. irclog2html thinks my logs are unimportant (heh i read the css). pretty no more.
cat does it.
 !/bin/bash  
 # parse logs to html  
 # remove hashes from names  
 # cat log content to html fie
 # create index from directory list  
   
 title="irc logs"  
 source=~/.weechat/logs  
 working=~/scratch  
 dest=~/public_html/logs  
   
 # copy source  
   
 cd $source  
 cp *.log $working  
   
 # rename  
   
 cd $working  
 rename -f 's/[^A-Za-z0-9._-]//g' *  
   
 # copy contents  
 cd $working  
   
 for i in * ; do  
     touch $i.html  
     echo "<html>" >> $i.html  
     echo "<title>$i</title>" >> $i.html  
     echo "<body>" >> $i.html  
     echo "<a href=index.html>$title</a><br><br>" >> $i.html  
     echo "<h3>$i</h3><pre>" >> $i.html  
     cat $i >> $i.html  
     echo "<br><br><br><br><br><br><a href=index.html>$title</a><br><br>" >> $i.html  
     echo "</pre></body></html>" >> $i.html  
     mv $i.html $dest  
 done  
   
 rm *.log  
   
 # create index  
   
 cd $dest  
   
     echo "<html>" > $dest/index.html  
     echo "<title>$title</title>" >> $dest/index.html  
     echo "<body>" >> $dest/index.html  
     echo "<h3>$title</h3>" >> $dest/index.html  
   
 ls $dest | grep -vE '(index.html|*core*)' | awk -F"." '{print "<a href=" $1 "." $2 "." $3 "." $4 ".html>" $1 "." $2 "." $3 "." $4 "</a><br>"}' \  
 >> $dest/index.html  
   
     echo "</body></html>" >> $dest/index.html  
   

weechat log to html script

and in your handy cron job you run this to convert your logs and make an index from your mosh screen weechat log thing. irclog2html doesn't like ~ by-the-by.
   
 #!/bin/bash  
 # parse logs to html  
 # remove hashes from names  
 # create prettified index from directory list  
   
 title="irc logs"  
 dest=~/public_html/logs  
   
 # parse  
 irclog2html --title=' ' --index-url='index.html' --index-title='irc logs' -o '/full/pwd/to/public_html/logs/' /full/pwd/to/.weechat/logs/*.log  
   
 # rename  
 cd $dest  
 rename -f 's/[^A-Za-z0-9._-]//g' *  
   
 # create index  
 echo "<html>" > $dest/index.html  
 echo "<title>$title</title>" >> $dest/index.html  
 echo "<body>" >> $dest/index.html  
 echo "<h3>$title</h3>" >> $dest/index.html  
   
 ls $dest | grep -vE '(index.html|irclog.css|*core*)' | awk -F"." '{print "<a href=" $1 "." $2 "." $3 "." $4 ".html>" $1 "." $2 "." $3 "." $4 "</a><br>"}' \  
 >> $dest/index.html  
   
 echo "</body></html>" >> $dest/index.html  
   

weechat & logging

a bothersome thing about weechat is that out of the box is that is plops all logs into one big file. setting a file name mask suffices for log rotation. default logging throws in all mode changes and the like. setting the level to 1 catches conversations only.

 logger.conf

 [file]  
 info_lines = off  
 mask = "%Y-%m-%d-$plugin.$name.log"  
   
 [level]  
 irc = 1  
 plugin.server.#channel = 1  

Tuesday, March 24, 2015

irc logs to intranet; or the joy of ngnix, weechat, mosh, screen and irc2html

what did i say again?
 irc logs to intranet  
   
 ngnix homedir  
   
 location ~ ^/~(.+?)(/.*)?$ {  
   alias /home/$1/www$2;  
   autoindex on;  
 }  
   
 ...  
 weechat & mosh  
   
 apt-get update  
 apt-get install weechat  
 apt-get install weechat-curses  
 apt-get install screen  
 apt-get install mosh  
 ufw allow 60000:61000/udp  
   
 logger@host mosh 127.0.0.1 -- screen -D -RR weechat weechat-curses  
     mobile ssh        screen option sessionname program  
   
 ...  
 nb:  
 detach screen session:  
 crtl+A D  
   
 reattach screen session:  
 screen -ls  
 screen -R sessionname  
   
 ex:  
   
 logger@host:~# screen -ls  
 There are screens on:  
     2171.weechat  (01/30/2015 11:21:00 AM)    (Detached)  
 1 Sockets in /var/run/screen/S-logger.  
   
 ...  
 logger@host irclog2html ~/.weechat/logs/*.log ; mv ~/.weechat/logs/*.html *.css ~/public_html/  
   
 ...  
 if ngnix autolog is off:  
   
 logger@host cd ~/public_html/logs ; tree -H . > index.html  
   
 voila.  

Monday, March 23, 2015

more ghettovcb status fun

so. i'd like to know what's there, what's stale and what's gone missing. and email myself.
 #!/bin/bash  
   
 datestamp=$(date +"%x %r %Z")  
   
 echo "virtual machines $datestamp" > /tmp/vm_report1  
 echo "..........................." >> /tmp/vm_report1  
   
 echo " " > /tmp/vm_report2  
 echo "new virtual machines $datestamp" >> /tmp/vm_report2  
 echo "..............................." >> /tmp/vm_report2  
   
 echo " " > /tmp/vm_report3  
 echo "stale repostitory backups $datestamp" >> /tmp/vm_report3  
 echo ".............................." >> /tmp/vm_report3  
   
 echo " " > /tmp/vm_report4  
 echo "repository backups $datestamp" >> /tmp/vm_report4  
 echo "............................." >> /tmp/vm_report4  
   
 ls /opt/vm-repo/vm_backups > /tmp/vm_header2  
 diff -c <(sort /tmp/vm_header1) <(sort /tmp/vm_header2) | sed '/^!/ d' > /tmp/vm_header3  
   
 find /opt/vm-repo/vm_backups -type d -mtime 0 | sort > /tmp/vm_backup2  
 diff -c <(sort /tmp/vm_backup1) <(sort /tmp/vm_backup2) | sed '/^!/ d' > /tmp/vm_backup3  
   
 cat /tmp/vm_report1 /tmp/vm_header2 /tmp/vm_report2 /tmp/vm_header3 /tmp/vm_report3 /tmp/vm_header3 /tmp/vm_report4 /tmp/vm_backup3 /tmp/vm_backup2 | mail -s "vm_backup status" me@there.com  
   
 mv /tmp/vm_backup2 /tmp/vm_backup1  
 mv /tmp/vm_header2 /tmp/vm_header1  
   

Thursday, March 19, 2015

solaris 10 zone creation script

i love you, too.
 #!/usr/bin/perl  
    
 # default values  
 $basedir="/opt/zones";  
    
 system(clear);  
    
 print "\nsol 10 zone creation script\n";  
 print "\n............................\n\n";  
 print "\nnote: base directory is $basedir \n";  
   
 print "\nenter name of new zone ";  
    
 $newzone = <STDIN>;  
   
 chomp($newzone);  
    
 print "\nenter directory name for new zone [$newzone] ";  
 $zonedir = <STDIN>;  
   
 chomp($zonedir);  
    
 if (!$zonedir) {  
  $zonedir = $newzone;  
    
 }  
    
 print "enter zone ip address ";  
 $newip = <STDIN>;  
    
 chomp($newip);  
    
 print "\nenter shared physical ethernet interface [e.g. e1000g0] ";  
 $ethint = <STDIN>;  
    
 chomp($ethint);  
    
 print "\ninherit standard directories (lib, platform, sbin, usr) from the global zone? [yN] ";  
 $inh = <STDIN>;  
    
 chomp($inh);  
 if (!$inh) {  
    
  $inh = "n";  
 }  
    
 if (($inh eq "y") || ($inh eq "Y")) {  
  $isw = "1";  
    
 } else {  
  $isw = "0";  
    
 }  
   
 print "\nadd dedicated cpu? [yN] ";  
 $dedicatedcpu = <STDIN>;  
    
 chomp($dedicatedcpu);  
 if (!$dedicatedcpu) {  
    
  $inh = "n";  
 }  
    
 if (($dedicatedcpu eq "y") || ($dedicatedcpu eq "Y")) {  
  $dedicatedcpu = "1";  
    
 } else {  
  $dedicatedcpu = "0";  
    
 }   
    
 print "\n\npsummary:\n\n";  
 print "   zone name: $newzone\n";  
    
 print "   zone directory: $zonedir\n";  
 print "   zone ip address: $newip\n";  
    
 print "   ethernet interface: $ethint\n";  
 print "   inherit directories: $inh\n";  
 print "   dedicated cpu: $dedicatedcpu\n";  
    
 print "\nare these entries correct? [Yn] ";  
    
 $yn = <STDIN>;  
 chomp($yn);  
    
 if (!$yn) { $yn = "y"; }  
 if (($yn == "y") || ($yn == "Y")) {  
    
  $of = "/tmp/zccfs10.tmp";  
    
  # create the zonecfg input file  
    
  `echo "create -b" > $of`;  
  `echo "set zonepath=$basedir/$zonedir" >> $of`;  
    
  `echo "set autoboot=true" >> $of`;  
    
  if ($isw == "1") {  
    
   `echo "add inherit-pkg-dir" >> $of`;  
   `echo "set dir=/lib" >> $of`;  
    
   `echo "end" >> $of`;  
   `echo "add inherit-pkg-dir" >> $of`;  
    
   `echo "set dir=/platform" >> $of`;  
   `echo "end" >> $of`;  
    
   `echo "add inherit-pkg-dir" >> $of`;  
   `echo "set dir=/sbin" >> $of`;  
    
   `echo "end" >> $of`;  
   `echo "add inherit-pkg-dir" >> $of`;  
    
   `echo "set dir=/usr" >> $of`;  
   `echo "end" >> $of`;  
    
  }  
    
  `echo "add net" >> $of`;  
  `echo "set address=$newip" >> $of`;  
  `echo "set physical=$ethint" >> $of`;  
  `echo "end" >> $of`;  
   
  if ($dedicatedcpu == "1") {  
    
   `echo "add dedicated-cpu" >> $of`;  
   `echo "set ncpus=1" >> $of`;  
   `echo "end" >> $of`;  
    
  }  
    
  # Make the dir that the zone will live in  
  `mkdir $basedir/$zonedir`;  
   
  # because sun is a punkass   
  `chmod 700 $basedir/$zonedir`;  
    
  # make me happy  
  print "\npatience patience \n";  
    
  `zonecfg -z $newzone -f $of`;  
  print "configuration file templatized\n";  
    
  # zone install  
  print "go get a cup of coffee \n";  
  `zoneadm -z $newzone install`;  
  print "zone installation complete\n";  
    
  # boot newly created zone  
  print "zone boot \n";  
    
  `zoneadm -z $newzone boot`;  
  print "booted\n";  
    
  # remove configuration file  
  `rm $of`;  
    
  print "\nconnect to the virtual console and complete installation \n";  
  print " -> zlogin -C -e\\@ $newzone \n";  
    
 } else {  
    
  die("ffs there is an error\n");  
 }  

add a disk to solaris 10

 i have a new/old seagate disk that i have just un-bad magic'd.  
 i want it to mount to /opt.  
   
 here's what we need to do:  
   
 detect the disk.  
 # devfsadm  
   
 see if the disk shows up.  
 # ls /dev/rdsk/*s0  
   
 format the disk.  
 # format  
   
 put a ufs fs on the disk.  
 # newfs /dev/rdsk/c1t1d0s0  
   
 check the disk.  
 # fsck /dev/rdsk/c1t1d0s0  
   
 put the disk notation in vfstab/  
 # vi /etc/vfstab  
   
 mount the disk.  
 # mount /opt  
   
 see if the disk is really as big as we think it is.  
 # df -h /opt/  
   
 [root@blackholesun /]# ls /dev/rdsk/*s0  
 /dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0 /dev/rdsk/c1t1d0s0  
   
 [root@blackholesun /]# format  
 Searching for disks...done  
   
 AVAILABLE DISK SELECTIONS:  
     0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>  
      /pci@0/pci@0/pci@2/scsi@0/sd@0,0  
     1. c1t1d0 <SEAGATE-ST9146802SS-S229-136.73GB>  
      /pci@0/pci@0/pci@2/scsi@0/sd@1,0  
 Specify disk (enter its number): 1  
 selecting c1t1d0  
 [disk formatted]  
   
 format> label  
 Ready to label disk, continue? y  
   
 format> partition  
   
 partition> print  
   
 Current partition table (original):  
 Total disk sectors available: 286733062 + 16384 (reserved sectors)  
   
 Part   Tag  Flag   First Sector     Size     Last Sector  
  0    usr  wm        34   136.72GB     286733062  
  1 unassigned  wm         0      0        0  
  2 unassigned  wm         0      0        0  
  3 unassigned  wm         0      0        0  
  4 unassigned  wm         0      0        0  
  5 unassigned  wm         0      0        0  
  6 unassigned  wm         0      0        0  
  8  reserved  wm     286733063    8.00MB     286749446  
   
 partition> 0  
 Part   Tag  Flag   First Sector     Size     Last Sector  
  0    usr  wm        34   136.72GB     286733062  
   
 Enter partition id tag[usr]:  
 Enter partition permission flags[wm]:  
 Enter new starting Sector[34]:  
 Enter partition size[286733029b, 286733062e, 140006mb, 136gb, 0tb]: 286733029b  
   
 partition> label  
 Ready to label disk, continue? y  
   
 partition> quit  
   
 format> quit  
   
 [root@blackholesun /]# newfs /dev/rdsk/c1t1d0s0  
   
 newfs: construct a new file system /dev/rdsk/c1t1d0s0: (y/n)? y  
 Warning: 1308 sector(s) in last cylinder unallocated  
 /dev/rdsk/c1t1d0s0:   286733028 sectors in 46669 cylinders of 48 tracks, 128 sectors  
     140006.4MB in 2917 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)  
 super-block backups (for fsck -F ufs -o b=#) at:  
  32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,  
 Initializing cylinder groups:  
 ..........................................................  
 super-block backups for last 10 cylinder groups at:  
  285773216, 285871648, 285970080, 286068512, 286166944, 286265376, 286363808,  
  286462240, 286560672, 286659104  
   
 [root@blackholesun /]# fsck /dev/rdsk/c1t1d0s0  
   
 ** /dev/rdsk/c1t1d0s0  
 ** Last Mounted on  
 ** Phase 1 - Check Blocks and Sizes  
 ** Phase 2 - Check Pathnames  
 ** Phase 3a - Check Connectivity  
 ** Phase 3b - Verify Shadows/ACLs  
 ** Phase 4 - Check Reference Counts  
 ** Phase 5 - Check Cylinder Groups  
 2 files, 9 used, 141196195 free (11 frags, 17649523 blocks, 0.0% fragmentation)  
   
 [root@blackholesun /]# vi /etc/vfstab  
 add this line:  
 /dev/dsk/c1t1d0s0    /dev/rdsk/c1t1d0s0   /opt  ufs   2    yes   -  
   
 "/etc/vfstab" 12 lines, 428 characters  
 #device     device     mount      FS   fsck  mount  mount  
 #to mount    to fsck     point      type  pass  at boot options  
 #  
 fd   -    /dev/fd fd   -    no   -  
 /proc  -    /proc  proc  -    no   -  
 /dev/dsk/c1t0d0s0    /dev/rdsk/c1t0d0s0   /    ufs   1    no   -  
 /dev/dsk/c1t1d0s0    /dev/rdsk/c1t1d0s0   /opt  ufs   2    yes   -  
 /devices    -    /devices    devfs  -    no   -  
 ctfs  -    /system/contract    ctfs  -    no   -  
 objfs  -    /system/object objfs  -    no   -  
 swap  -    /tmp  tmpfs  -    yes   -  
 sharefs     -    /etc/dfs/sharetab    sharefs -    no   -  
   
 [root@blackholesun /]# mount /opt  
   
 [root@blackholesun /]# df -h /opt/  
   
 Filesystem       size  used avail capacity Mounted on  
 /dev/dsk/c1t1d0s0   135G  64M  133G   1%  /opt  
   
 yay.  

Wednesday, March 18, 2015

bad magic. high five!

 it is 10 in the a.m. and you've had your coffee. it is a good day.  
 let's try that again... sigh...  
   
 scsi: WARNING: /pci@0/pci@0/pci@2/scsi@0/sd@1,0 (sd3):  
 Mar 18 10:33:06 blackholesun  Corrupt label; wrong magic number  
   
 ffs  
   
 [root@blackholesun ~]# for i in $(grep WARNING /var/adm/messages|grep scsi|awk '{ print $10 }'|sort|uniq);do ls -l /dev/dsk|grep $i;done|grep s0  
 lrwxrwxrwx  1 root   root     47 Jan 21 2011 c1t0d0s0 -> ../../devices/         pci@0/pci@0/pci@2/scsi@0/sd@0,0:a  
 lrwxrwxrwx  1 root   root     47 Jan 21 2011 c1t1d0s0 -> ../../devices/         pci@0/pci@0/pci@2/scsi@0/sd@1,0:a  
 lrwxrwxrwx  1 root   root     47 Jan 21 2011 c1t1d0s0 -> ../../devices/         pci@0/pci@0/pci@2/scsi@0/sd@1,0:a  
   
 c1t0d0s0 is my friend.  
   
 [root@blackholesun ~]# prtvtoc /dev/dsk/c1t0d0s0  
   
 * /dev/dsk/c1t0d0s0 partition map  
 *  
 * Dimensions:  
 *   512 bytes/sector  
 *   848 sectors/track  
 *   24 tracks/cylinder  
 *  20352 sectors/cylinder  
 *  14089 cylinders  
 *  14087 accessible cylinders  
 *  
 * Flags:  
 *  1: unmountable  
 * 10: read-only  
 *  
 *             First   Sector  Last  
 * Partition Tag Flags  Sector   Count  Sector Mount Directory  
     0   2  00     0 286698624 286698623  /  
   
 c1t1d0s0 is not my friend  
   
 [root@blackholesun ~]# prtvtoc /dev/rdsk/c1t1d0s0  
   
 prtvtocMar 18 10:48:34 blackholesun scsi: WARNING: /pci@0/pci@0/pci@2/scsi@0/sd@1,0 (sd3):  
 Corrupt label; wrong magic number  
 /dev/rdsk/c1t1d0s0: Unable to read Disk geometry errno = 0x16  
   
 okay  
   
 [root@blackholesun ~]# for i in $(ls -l /dev/rdsk/*|grep s0|awk '{print $9 }'); \  
 do prtvtoc $i;done|grep Unable  
   
 prtvtoc: /dev/rdsk/c0t0d0s0: Device busy  
 prtvtoc: Mar 18 10:48:14 blackholesun scsi: WARNING: /pci@0/pci@0/pci@2/scsi@0/sd@1,0 (sd3):  
 /dev/rdsk/c1t1d0s0     Mar 18 10:48:14 blackholesun     Corrupt label; wrong magic number  
 : Unable to read Disk geometry errno = 0x16  
   
 okay  
   
 [root@blackholesun ~]# format -e /dev/rdsk/c1t1d0s0  
 Mode sense page(3) reports nsect value as 771, adjusting it to 1056  
   
 /dev/rdsk/c1t1d0s0: configured with capacity of 136.62GB  
 selecting /dev/rdsk/c1t1d0s0  
 [disk formatted]  
   
 FORMAT MENU:  
     disk    - select a disk  
     type    - select (define) a disk type  
     partition - select (define) a partition table  
     current  - describe the current disk  
     format   - format and analyze the disk  
     repair   - repair a defective sector  
     label   - write label to the disk  
     analyze  - surface analysis  
     defect   - defect list management  
     backup   - search for backup labels  
     verify   - read and display labels  
     save    - save new disk/partition definitions  
     inquiry  - show vendor, product and revision  
     scsi    - independent SCSI mode selects  
     cache   - enable, disable or query SCSI disk cache  
     volname  - set 8-character volume name  
     !<cmd>   - execute <cmd>, then return  
     quit  
 format> l  
 [0] SMI Label  
 [1] EFI Label  
 Specify Label type[0]:  
 Ready to label disk, continue? y  
 format> q  
   
 c1t1d0s0 is my friend  
   
 [root@blackholesun ~]# prtvtoc /dev/rdsk/c1t1d0s0  
 * /dev/rdsk/c1t1d0s0 partition map  
 *  
 * Dimensions:  
 *   512 bytes/sector  
 *  1056 sectors/track  
 *    8 tracks/cylinder  
 *  8448 sectors/cylinder  
 *  33918 cylinders  
 *  33916 accessible cylinders  
 *  
 * Flags:  
 *  1: unmountable  
 * 10: read-only  
 *  
 *             First   Sector  Last  
 * Partition Tag Flags  Sector   Count  Sector Mount Directory  
     2   5  01     0 286522368 286522367  
     6   4  00     0 286522368 286522367  
   
 it is 10:40 in the a.m. it is a good morning.  

Friday, March 13, 2015

let us remove a raw fs from a solaris zone

removing a filesystem from zonecfg

zonecfg is used to remove a filesystem added in the zone configuration file (.xml).  in my case:
raw: /dev/vx/rdsk/zone-fs-to-remove/fs-to-remove
which is /fs-to-remove on the zone.

(global-zone:/)# zonecfg -z zone info fs | grep fs-to-remove
        dir: /fs-to-remove
        special: /dev/vx/dsk/zone-fs-to-remove/fs-to-remove
        raw: /dev/vx/rdsk/zone-fs-to-remove/fs-to-remove
(global-zone:/)# zonecfg -z zone
zonecfg:zone> remove fs dir=/fs-to-remove
zonecfg:zone> commit
zonecfg:zone> exit
(global-zone:/)# zonecfg -z zone info fs | grep fs-to-remove
(global-zone:/)#

ghettovcb status

sadly, my esx servers do not email me. that's just life.
but, one thing i really want to know is if they're doing their backups every day. well, i have them connected to an nfs server. and i can run find on the backup directory. you can, too. i like find, by the way. i really do.

find /opt/vm-repo/vm_backups -type d -mtime 0 | sort | mail -s "vm_backup dir change" me@there.com
     ^                       ^       ^          ^      ^
     |                       |       |          |      |
     dir to find in          dir     |          alpha  mail to me
                                     |
                                     modify time 24hrs
crontab it and away you go.

here's what i get:
/opt/vm-repo/vm_backups
/opt/vm-repo/vm_backups/sillyvm
/opt/vm-repo/vm_backups/sillyvm/sillyvm-2015-03-12_23-00-01
/opt/vm-repo/vm_backups/sillyvm/sillyvm-2015-03-13_05-00-01
/opt/vm-repo/vm_backups/sillyvm/sillyvm-2015-03-13_11-00-01

Thursday, March 12, 2015

vmware nfs mounts go a-asking

vmware esx servers don't pick up nfs mounts if they go away. here's how to get them going again:

overview:
/vmfs/volumes # esxcfg-nas -l
/vmfs/volumes # esxcfg-nas -d mount
/vmfs/volumes # esxcfg-nas -a -o nfsserver -s nfsexport localmount
in practice:
~ # esxcfg-nas -l
vm-crap is /opt/vm-crap from 192.168.6.66 mounted
~ # esxcfg-nas -d vm-crap
NAS volume vm-crap deleted.
~ # esxcfg-nas -a -o 192.168.6.66 -s /opt/vm-crap vm-crap
Connecting to NAS volume: vm-crap
vm-crap created and connected.
~ # exit