Category Archives: Sysadmin

LSI MegaRaid on XenServer Round 2 – Version 6.5

XenServer 6.5 and the latest MegaRAID software (6.8 as of this writing) introduce a few changes to the procedure in my previous post about MegaRAID on XenServer. Here is the updated procedure.

Switch the system to shadow passwords. This is required for the Storage Manager application, and it’s insane the XenServer doesn’t already run this way by default.


Next you need to install net-snmp-utils. Unfortunately, this can not be done via yum anymore in XenServer 6.5. You need to extract the rpm file (net-snmp-utils- from the XenServer-6.5.0-binpkg.iso file. The ISO file is available on the XenServer download page (it’s listed as “Development packages”). Once you have the rpm file, just install it like so:

rpm -ivh net-snmp-utils-

Next, install the required RPM files from the LSI MegaRAID storage manager download. Be sure to download the 64 bit version (as of version 6.5, XenServer now uses a 64 bit dom0).

rpm -ivh Lib_Utils2-1.00-07.noarch.rpm --nodeps
rpm -ivh MegaRAID_Storage_Manager-15.05.01-00.noarch.rpm sas_ir_snmp-15.05-0004.x86_64.rpm

Now add the firewall exceptions to /etc/sysconfig/iptables in order to allow Storage Manager and SNMP traffic. These lines should go right next to the similar lines for port 22, 80, etc.

-A RH-Firewall-1-INPUT -m conntrack --ctstate NEW -m udp -p udp --dport 161 -j ACCEPT
-A RH-Firewall-1-INPUT -m conntrack --ctstate NEW -m tcp -p tcp --dport 3071 -j ACCEPT
-A RH-Firewall-1-INPUT -m conntrack --ctstate NEW -m tcp -p tcp --dport 5571 -j ACCEPT

Apply the firewall changes

service iptables restart

Add the following line to /etc/snmp/snmpd.conf in order to permit reading LSI OIDs via the “public” community.

view    systemview    included   .

Finally enable/start all the services, and try an snmp query to make sure it works:

chkconfig vivaldiframeworkd on
chkconfig snmpd on
service vivaldiframeworkd start
service snmpd start
snmpwalk -v2c -c public .

Automated Shadow Copies in Windows 8.1

For some ridiculous reason, Microsoft decided to not include the Volume Shadow Copy GUI features in Windows 8.1. I wrote the powershell module below to use in a scheduled task. It creates a shadow copy on the specified volume, and optionally deletes any old shadow copies on that volume. You can actually still access the “Previous Versions” property tab for network volumes to retrieve files. To access the shadow copy files on the local machine, just use the admin UNC path (\\host\c$ or similar). To install the module, just save it as a .psm1 in a same-named subdirectory of your PSModulePath (such as c:\Program Files\WindowsPowerShell\Modules\ShadowCopy\ShadowCopy.psm1). You can then just use the Invoke-ShadowCopy command to run it.

function Invoke-ShadowCopy()
    Create shadow copies for a volume and optionally delete old shadow copies
	Designed to be used as a scheduled task for newer versions of
	Windows that don't have built-in support for automated shadow copies
    The drive letter or ID of the volume
	If a number of days is specified, shadow copies older than this will be deleted
    Author: Darrell Enns
    Date:   January 16, 2014    
	$ErrorActionPreference = "Stop"
	$vol=Get-WmiObject -class win32_volume | Where { $_.DriveLetter -eq $volume -or $_.DeviceID -eq $volume }
	write-host "Creating shadow copy on" $vol.DriveLetter
		write-host "Deleting shadow copies older than $PurgeDays days"
function CreateShadowCopy($vol)
	$result=$sc.create($vol.DeviceID, "ClientAccessible")
function DeleteOldShadowCopies($vol)
	Get-WmiObject -class win32_shadowcopy | Where { $_.VolumeName -eq $vol.DeviceID } | Foreach-Object `
		if(($age.TotalDays) -gt $PurgeDays) {
			write-host Deleting old shadow copy from $shadow_date
Export-ModuleMember Invoke-ShadowCopy

Here’s another approach – creating a wrapper to get the full functionality from “vssadmin”. It’s definitely a bit of a hack, but a pretty elegant one and a good read.