Saturday, October 3, 2009

VMWare Notes

I've been using VMWare Server 1 & 2 for quite some time now. I've toyed around with ESXi (and am getting ready to move a clients full server base over to an ESXi system in the next couple weeks).

This post is mostly to talk about what I've just recently done in VMWare Server 2.0 though. I wanted to write down some settings that I'll hopefully use in the future (and 'upgrade' other clients to if need be), and note some concepts/scripts I used for backups of the virtual machines.

I picked up a couple T100's for my church, and before I realized that the boxes had internal USB connectors (hopefully ideal for ESXi booting in the future??), I went with my normal CentOS5 x64 base install. I generally prefer it for manageability's sake. Of course, most of that additional manageability goes out the window when the client (my church in this case) only has one public IP. I still planned on doing some weirdness in this setup, so having that full base would help make that happen.

Of course, the CentOS host ends up being cheaper, 'cause you don't have to have a hardware raid solution. I software RAID1 two partitions -- one for /boot, and one for LVM (containing swap, root, and some free space (which I forgot this time around.... DOH!)).

I've got an 'ovf' of IPCop that I put together for quick deployment of a Pro IT approved VM firewall that I put on one of the boxes. The other box was going to 'replace' their existing server. VMWare Converter's been doing a nice job lately for me, so it was a quick an painless P2V last night / this morning.

I ordered each box with an extra NIC (one needed it since it was host to the IPCop vm) so that they'd be the same. My thought was that if I could get a backup of each VM to the other host's drive on a periodic basis, I could have stupid-short down times in case of a hardware failure. Boot up the copied vm on the still running hardware, and either rsync changes (slap one of the drives from the failed system on the still working system via USB) or restore from backup to get 'em up and going, still in RAID. I wonder if one day I should look into DRBD for this "two identical box" scenario....

Anyway -- the concept I tested and mostly verified was to create a snapshot, rsync the original vmdk's (a snapshot creates a bunch of new small vmdk's to hold the differences), and remove the snapshot. I say "mostly" because a regular rsync hosed IPCop. 'Er -- I had a test P2V on vm2, tried to rsync it to vm1 (hosting IPCop), and IPCop ... stopped responding. I could ping it, and I could start to ssh to it, but it'd time out.... When I got on site, I couldn't open the console to it... Very odd. I _think_ it had to do with memory tweaks that I hadn't implemented...

I think it had to do with memory because you could watch 'top' on vm1 (rsync initiated from vm2) and see memory usage climb... At the time of the test, I _did_ have vmware's 'tmpDirectory' config variable pointing to '/dev/shm', but '/dev/shm' was only 3.75GB in size, compared to the 4GB of memory in the system... And the IPCop VM was only using 264MB of '/dev/shm'.... I dunno... Anyway -- it was rsync doing it's normal 'delta' differences between these 2GB files. The 'fix' was to add the '-W' switch to rsync to tell it, "hey -- if there's a difference in the file size/mod time, don't waste your effort trying to find out where in the file the change is -- just transfer the whole file!" I tested both ways, and though the 'delta' based ended up being quicker, it killed IPCop, so it wasn't a viable solution ;)

I've since made some more memory tweaks... Of course, I don't fully understand the 'tweaks' that I implemented, nor have I re-tested the delta based rsync.

Anyway -- here's all the notes of things regarding vmware performance on these boxes that I'm noting to myself:
  • 'noatime' on fs's hosting vm's
  • in /etc/vmware/config:
# I normally add this next line in the VM's... does this central config preclude that addition?
mainMem.useNamedFile = "FALSE"
# always seen a big improvement using this.... of course, you've gotta make /dev/shm [almost] as big as your installed memory via /etc/fstab
# next two lines really get set via the web interface by saying "fit all the vm's memory in physical memory", and how much memory to allocate to VMWare
prefvmx.minVmMemPct = "100"
prefvmx.allVMMemoryLimit = "3072"
# no idea what this is
prefvmx.useRecommendedLockedMemSize = "TRUE"
  • in /etc/sysctl.conf:
# I've never really used these before... Supposedly helps with the host's normal desire to swap a bunch (which leads to more i/o, conflicting with vm's need)
vm.swappiness = 0
vm.overcommit_memory = 1
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
vm.dirty_expire_centisecs = 1000
dev.rtc.max-user-freq = 1024
  • Append "nohz=off" to the kernel options in grub.conf
  • Lastly, in the VM's:
mainMem.useNamedFile = "FALSE"
MemAllowAutoScaleDown = "FALSE"
MemTrimRate = "0"
  • Now for the rsync backup script (set to run via a file in /etc/cron.d):

# Get name and num's from `vmware-vim-cmd -U jolly vmsvc/getallvms`

# Sync ipcop's (16)'s vmx file


pushd ${SOURCEROOT}/${SOURCENAME} >/dev/null
vmware-vim-cmd vmsvc/snapshot.create ${SOURCENUM}
rsync -aW --exclude=*0001* *.vmdk ${DESTHOST}:${DESTROOT}/${SOURCENAME}
vmware-vim-cmd vmsvc/snapshot.remove ${SOURCENUM}
popd >/dev/null

Wednesday, January 7, 2009

Excel Macro / VBA Craziness

A client got me to do some weird work in Excel last year to format a horrid output from their main software they use. Seems the "excel file" that was output from the software for their price list was none-to-user-friendly... So, I created a couple macros that renamed some stuff, deleted some unnecessary rows and columns, and voila.

Today, the same client asked for another bit-o-code. 8 hours later, I've got soem decent stuff. I learned about NumberFormat, text alignment, borders. and a couple other neat tidbits this time around. If I was really cool, I'd probably re-write the older stuff to make it a little cleaner, but........

Now I just have to figure out if I should charge for the work ;)


Labels: , ,

Tuesday, December 2, 2008

Silly Microsoft....

Turns out that with Exchange 2007 and Server 2008 there's not a native way to backup exchange and truncate your log files...........

Silly.... Silly Microsoft...

Labels: ,

Tuesday, November 25, 2008

Outlook Spelling Troubleshooting

says his spell checker when doing an email in Outlook isnt catching mispelled items? any clues?

Depends on what he means:

- "It used to make the little red squiggles under a misspelled word like in Word"
- It'll only do that if Word is the e-mail editor. "Tools" -> "Options" -> "Mail Format" -> "Use Microsoft Office Word to edit e-mail messages". Note - I'm not a fan of this personally... It makes e-mail slower ;)

- "It doesn't automagically check spelling when I send the message"
- "Tools" -> "Options" -> "Spelling" -> "Always check spelling before sending"

- "It's not catching this word..."
- "Tools" -> "Options" -> "Spelling" -> "Edit" under 'Edit custom dictionary'

- "It's just flat out not working!"
- Something else is broken ;)

Labels: ,

Friday, November 21, 2008

XP's Offline Files...

Ever have problems with XP's offline file functionality? I know I have. It always seems to take forever, it's slow to decide when you're offline (making apps lock 'till you're offline), it's slow to realize you're back online (I always ended up just forcing a sync), and it doesn't play nice with 3rd party VPNs. Regarding that last note, I use OpenVPN ( ; It's been a while since I looked, but there may be some configuration options you can use to call a local batch file on connecting/disconnecting where you can then call 'mobsync' with some command line options, but..... That's just too much hassle ;)

Instead, I've been liking a 3rd party product for syncing my data. It's called GoodSync. I set up a few jobs -- one for each separate location, and tell each to run at startup and every 2 hours. Seems to do the job quite nicely.


Thursday, November 20, 2008

A quick Exchange 2007 rant

Ardent and I were chatting yesterday and as I had just finished trying to figure out some recipient address policies, I ranted a little... It turned out funny, so I figured I'd share:

(11:13:08 PM) Me: now all you need to do is explain to my why exchange 2007's moved to a more scripted approach vs gui
(11:13:22 PM) ardent: for what
(11:13:31 PM) Me: it's like they decided to do everything via scripting, then made the [limited] gui after the fact
(11:13:34 PM) Me: everything
(11:13:44 PM) ardent: because real coders hate gui
(11:13:48 PM) ardent: its more 'stable'
(11:13:49 PM) ardent: :-)
(11:14:16 PM) Me: take recipient address policies -- in 2k3, you had a text field to type in what you wanted an address template to be
(11:14:40 PM) Me: in 2007, you've got about 6 radio boxes to choose from. If that's not what you want, you've gotta use the undocumented powershell commands
(11:14:55 PM) Me: and real coders don't administer exchange ;)
(11:15:01 PM) ardent: hahahaha

In case you're wondering how I ended up setting an address template to get .@domain.tld, via powershell I ran "get-emailaddresspolicy fl". That showed me where the not quite right template that I had added via the gui was. After trying a couple things and getting errors, the final command I ran to update the default policy was 'Set-EmailAddressPolicy -Identity "Default Policy" -EnabledPrimarySMTPAddressTemplate %1g.%s@domain.tld'

Labels: ,

Monday, November 17, 2008

Rise of Nations Military Notes (with some sporadic other notes)

This page is mostly written to talk about how I deal with military in Rise of Nations / Thrones and Patriots. As you'll see, most everything about military stuff in Rise of Nations comes down to paper, rock, scissors for me. Especially ground and sea battles. Since the majority of my military engagements are ground battles, I'm gonna spend the most time talking about those, the units involved, and the groupings.

I should note that I don't play against human opponents. If I did, I'd surely die ;) Besides, I probably won't do it 'till ardent and I can beat six 'toughest' opponents. When we can, I'll know I rock... And I probably won't be using these strategies anymore ;)

I guess I need to first talk a little about where I place military buildings and when... Assuming I haven't been attacked yet (I know -- I'm _so_ due to get killed up front), I generally don't build military buildings 'till around the Medieval Age (III). That's when the Terra Cotta Army (TCA) becomes available anyway ;) At that point, I'll build a barracks, two sets of stables, a siege factory, and TCA if I can afford it. I'll build all of those buildings in my forward most city. I build out there so that reinforcements get to the battle quicker ;) I build 'em all in the same city so I can see the city name in the information panel in case I build more military buildings later.

"Information panel?" The little area in the bottom right that shows a city's economic radius, hit points, etc... You'll note that buildings will say their city name (assuming they're in a city's economic radius) in the title area of that box -- ie "Market -- Korea". With that in mind, if my military city is Korea, I'll assign my first stable there to control group F7. If I want to access the other stable there, I hit "F7, s". That'll select that first stable, then go to my next stable on the map. I should see "Stable -- Korea" in the information panel. If I've built stables in other cities, I'll see their name in the information panel and know it wasn't the stable I was looking for. Maybe I could put my alternate stables (and barracks if I don't get TCA) in a second city, but I'd probably need to rename that 2nd city to remember what the building's role is ;)

Speaking of control groups, if you didn't know, you can assign buildings, units, or even an area on the map to what I call "control groups". Select what you want to assign, and while holding 'Ctrl', press 1-0 or F1-F8. F9-F12 apparently have other functions defined within the game, so they're not used for control groups (I wonder if you can change that...).

Not only are control groups useful for selecting a particular group of units, selecting a building, or going to an area on the map, but they can be used as a destination for rally points or can be 'double-clicked' to center your map on the subject. If you set a building's rally point to be a control group, units built from that building join all the groups that the rally point'd unit is a member of. The produced unit will also walk a straight line to the area of the map that the control group is currently located.

Here's my normal control group layout:
  • 1 - Light Infantry
  • 2 - Heavy Infantry
  • 3 - Ranged Calvary
  • 4 - Heavy Calvary
  • 5 - Support
  • 6 - Main Army
  • 7 - Helicopters
  • 8 - Main Navy
  • 9 - Silo 1
  • 0 - Silo 2
  • F1 - Capitol (default)
  • F2 - First Library
  • F3 - First Market
  • F4 - University
  • F5 - First Dock
  • F6 - Current Main Barracks
  • F7 - Current Main Stable
  • F8 - Current Main Factory

Expanded Notes About My Control Groups

Group 1 - Light Infantry
I'll pop out a couple of these up front and assign them to control group 1. Once I hit the Medieval age and can afford it, I'll build the Terra Cotta Army and assign its rally point to this group. If someone else already grabbed TCA, I'll build a second barracks in my military city and assign that barracks' rally point to the group.

I'll try to keep at least six of these. If my TCA runs out of control, I've ended up with so many of these guys that groupings start not working correctly... If that's the case, I set TCA's rally point to some semi-forward area on the map and kill off a few guys from the group (and re-assign group 6).

6 - 25 (TCA)
6 - 10

Primary Uses (paper, rock, scissors):
- Ranged Calvary

Secondary uses (ie - I use someone else, but if there's more work to go around, I'll use these guys too):
- Ranged Infantry (heavy calvary is the primary killer of ranged infantry)
- Heavy Infantry (ranged calvary is primary)

Note that since light/ranged infantry is good at beating ranged calvary, you shouldn't try to use ranged calvary to beat light/ranged infantry. That's why I call it paper, rock, scissors ;)

Another note here is that according to their description, you should use light infantry to kill ranged infantry. If you click on an enemy unit, it'll tell you what two units should be used to kill the selected unit type. Light calvary's in that list for ranged infantry, and barring a little bit less speed, heavy calvary does the job nicely ;)

Group 2 - Heavy Infantry
6 - 10 (early)
4 - 8 (modern age+)

Primary Uses:
- Heavy Calvary
- Light Calvary

Secondary uses:
- Buildings (artillery is primary)

Group 3 - Ranged Calvary
4 - 8

Primary Uses:
- Heavy Infantry
- Scouts
- Supply Wagons
- Generals

Secondary uses:
- None that I remember ;)

Group 4 - Heavy Calvary
6 - 10

Primary Uses:
- Light Infantry
- Ranged Infantry

Secondary uses:
- Artillery (Spies are primary)

Group 5 - Support
This is the group that has my generals (1 or 2), artillery (3-6), supply wagons (2), spies (3-10), scouts (2-4), and machine guns (2-4).

Group 6 - Main Army
This group is a combination of groups 1-5 (ie - I press 1, shift+2, shift+3, shift+4, shift+5, ctrl+6).

Group 7 - Helicopters
5 - 10

Primary Uses:
- Heavy Calvary

Secondary uses:
- Submarines (Light Ships are primary)

Group 8 - Navy
For the most part, just know this - light ships beat fire ships, fire ships beat heavy ships, and heavy ships beat light ships.

Until fire ships get upgraded to subs, I try to keep twice as many fire ships as either light or heavy's. IE - 5 heavy ships, 5 light ships, and 10 fire ships. Once I get subs, that number goes down to about equal.

Fire ships / subs do good against other fire ships / subs, but it's generally a 1:1 trade. If you shoot first with your sub, you'll win, but that applies in reverse too ;) Fire ships have an explosion radius, so they damage adjacent ships when they blow up, so they _could_ have a better ratio if the enemy's stupid and you're awesome and manuevering ;)

Of course, there's also carriers and bombardment ships... I mostly use those for ground attacks though... A pair of each is generally sufficient.

Group 9 and 0 - Silo's
I like having these assigned to hot keys so I can send a couple missles to a bunker quick. 9, right click target, 0, right click target, 9, hotkey to build new missle (g or v... I don't remember off hand), 0, hotkey for build new missle.
Works even better when you have that "units produced instantly" technology.

Group F1 - Capitol / First City
This key is defaulted to your first city - assuming you didn't start nomad style ;) I use this key early in the game to pop out citizens (hotkey - 'v') as needed.

Group F2 - Library
I'll assing F2 to my first library so I can use hotkeys to research. I've been using the little bar up top lately though...

Group F3 - Market
I guess I don't really need this anymore, as I can just use the 'n' hotkey to cycle between markets.

Group F4 - University
I'll usually assign this to the university that still needs filling up. I fill 'em up one at a time, so this is the 'working' one.

As with F3, I don't _really_ need this, as I can just hit the 'u' hotkey to cycle between 'em 'till I see an empty one and then hit 'v'. In fact, that's probably a better option... If I have three empty universities, it's better to have each producing one scholar than one producing three...

Group F5 - Dock
I build a dock ASAP and use this hotkey to go fishing! F5, left click a flashing spot on the mini-map, right click the fish/whale to set the rally point, 't' (hotkey for building a fisherman).
Later in the game if I need a navy, I'll build a second dock (hopefully in a city's economic radius as to have it named) and do the "F5, d" series of hotkeys to get to it. That dock's rally point will be set on a unit in control group 8.

Group F6 - Current Main Barracks
Rally point set to group 2 (heavy infantry). If I don't have TCA, I'll build a second barracks and have its rally point set to group 1 (light infantry).

Group F7 - Current Main Stable
Rally point set to group 4 (heavy calvary). Alternate stable's rally point set on group 3 (ranged calvary).

Group F8 - Current Main Factory
Rally point set to group 5.

Other Notes:

  • Ranged InfantryYou'll probably note that I don't build ranged infantry. There's two main reasons imho. Their main purpose of killing heavy infantry is filled by ranged calvary, and their advancement tree merges with light infantry in the enlightenment age (V). I have been known to build a couple in a pinch before though... You'll notice that the majority of a computer's rushing army is heavy infantry. If I get rushed and haven't really started on my army yet, I'll rush to get a barracks and stable in a nearby city and pop a few of these guys out parallel to some ranged calvary and heavy calvary. When the battle's over, any remaining ranged calvary become control group 1.

  • Light CalvaryLike ranged infantry, their role is covered by someone else - heavy calvary.

  • BribingSpies are teh bomb! With my control groups though, there's a little extra work involved. For example, if I bribe a knight, the process I go through is -- select it, press shift+4 (to select it plus group 4), press ctrl+4 (to thus assign the new selection including the new knight to group 4), press shift+6 (to expand the selection (including the new knight) to my whole army), and finally press ctrl+6. Sometimes I do that process after my army's moved on and I see some apparently bribed units left behind ;)

Labels: ,