All posts by bsdman

Currently working as an IT Manager. Worked for an OIT company as a Network Engineer in 2011. Worked for a Medical IT company as the Network Administrator 2009-2011. Worked as the Senior Systems Administrator at a computer reseller from 2005-2009. Worked as a Computer Consultant for several small companies from 2007-2009. Worked as a Computer Technician at a computer reseller from 2002-2004.

MS SQL 2008 Space

So we were getting alerts that our SQL server was running out of space. It was chewing through ~150GB a month.

Looking into it, we found out that our CRM (MS CRM 4.0) database was the primary culprit.

crm1
* Highlighted portion from another technician

I finally noticed something a little bit off; the Last Database Log Backup was listed as 9/24/2014.
In the SQL Server Management Studio, under Databases, I right-click and choose properties of the CRM database
I then selected the Files page (left side)
The PRIMARY rows data mdf was 56GB
The Log ldf was ~185GB

That might explain it!

So we went back and looked through the notes regarding this server. We had changed the Recovery Model to Full (same location under the Options page) in order to export a copy for our development environment. And this was never changed back.

Change this setting back to Simple and hit OK.
Then Right-click on the same database and choose Tasks, Shrink, Files
File type change to Log

In my case it showed available freespace of 99%. I clicked OK and the data usage went down to 1.25GB. Pretty big savings if you ask me.

Exchange 2010 Remove Mobile Device Error

Exchange 2010 environment fully patched. One user hit the 10 device threshold on Exchange activesync devices and IT was tasked with removing the association from that device.

Right-click on the user and manage mobile device. Attempt to remove the partnership (not remote wipe) and had an error:
The ActiveSyncDevice Cannot be Found.

Awesome.

Powershell to the rescue:
List all devices for an account
get-activesyncdevice -mailbox USERNAME | select DeviceID, Identity

List all details for those devices
get-activesyncdevicestatistics -mailbox USERNAME

Remove that activesync
Remove-ActiveSyncDevice -Identity $(Get-ActiveSyncDevice -Mailbox USERNAME | where {$_.DeviceId -like "DEVICEID"} | select Identity).identity

Apparently what happens is that when we decided to move all OU groups around (and memberships) Exchange doesn’t like that very much and forgets to update itself.
http://exchangeblog.pl/en/2013/01/exchange-2010-remove-mobile-device-error-the-activesyncdevice-cannot-be-found/

Add User Pictures to Active Directory, Exchange

Running Active Directory in 2003 mode (with 2x 2003 and 2x 2008 servers) and Exchange 2010 in DAG.

http://www.codetwo.com/blog/codetwo-active-directory-photos-1-1-2-new-fields-in-filters/

Ran through and installed the above executable, ran with my domain admin credentials, but I could not get the pictures to show up in Outlook no matter what I did.

Finally figured out it is an issue with the offline address book – rebuilt on the Exchange side and no dice. But deleted the cached folders on my local machine and it worked fine. There’s also a registry key to help out:

Close Outlook
Delete everything in C:\users\yourusername\appdata\microsoft\outlook\ofline address books\
Open Outlook
Profit

Registry key:
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Cached Mode]
“DownloadOAB”=dword:00000000
Either create the key “Cached Mode” and then the 32bit dword “DownloadOAB” as 0 or save the above as a .reg file and then run that.

Linux Fun

I’ll probably break these out, but for now this is the title and location.

We’re finally hiring a linux administrator (13 years experience) to replace me and my “hobby”. Good thing is he’s way better than I can hope to be. Bad thing is he doesn’t start for another couple weeks and I have a lot of Linux-y stuff going on.

So here are some helpful commands:
What Linux Distribution Are You Using?
cat /etc/*-release
OR
lsb_release -a

What Kernel Version Am I Running?
uname -a

What Processors Am I Using?
cat /proc/cpuinfo

What Hardware Specs Do I Have? (Motherboard Model, BIOS revision, etc)
dmidecode
OR, if installed
hwinfo

How Do I Setup No-Password-Needed SSH?
ssh-keygen
enter
enter
ssh-copy-id username@systemname
userpassword

ZFS Replace A Drive
zpool offline poolname /dev/daX
zpool replace poolname /dev/daX /dev/daY
zpool status poolname
After Rebuild
zpool detach poolname /dev/daX

LVM – Create Physical, Volume, and Logical
pvcreate /dev/sdb1
vgcreate vgpool /dev/sdb1
lvcreate -L 3G -n lvstuff vgpool

LVM – Display Current Status
pvdisplay

LVM – Add A New Disk
fdisk /dev/daX
n, p, 1, t, 8e, w
pvcreate /dev/daX1

LVM – Extend LVM Pool To New Disk
vgextend vgpool /dev/daX1

LVM – Resize File System (required for shrinking/growing)
lvextend -L+8G /dev/vgpool/lvstuff
lvextend -L50GB /dev/vgpool/lvstuff (extend to total of 50gb)
resize2fs /dev/vgpool/lvstuff

ZFS Zpool Replace Failed Drive

So I am using ZFS on my Nas4Free installation (v5000 zfs) and I had a failed drive. Background: 20x 3TB SATA mirror and then striped in the same pool, 2x 3TB hotspares (not sure if these work – maybe more information later), and a raid card level ZIL of 120GB SSDs.

One of the drives in the mirror failed out. Had a technician replace the drive, but forgot to offline it before the drive was replaced. Since this was my first time with a pure ZFS environment (usually I had the raid controller do the heavy lifting and ZFS was just sitting there), I detached the drive. Caused all sorts of issues.

so then I had:

#zpool status -v
NAME STATE READ WRITE CKSUM
zfs ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
da3 ONLINE 0 0 0
da4 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
da5 ONLINE 0 0 0
da6 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
da7 ONLINE 0 0 0
da8 ONLINE 0 0 0
mirror-3 ONLINE 0 0 0
da9 ONLINE 0 0 0
da10 ONLINE 0 0 0
mirror-4 ONLINE 0 0 0
da11 ONLINE 0 0 0
da12 ONLINE 0 0 0
da14 ONLINE 0 0 0
mirror-6 ONLINE 0 0 0
da15 ONLINE 0 0 0
da16 ONLINE 0 0 0
mirror-7 ONLINE 0 0 0
da17 ONLINE 0 0 0
da18 ONLINE 0 0 0
mirror-8 ONLINE 0 0 0
da19 ONLINE 0 0 0
da20 ONLINE 0 0 0
logs
da1p1 ONLINE 0 0 0
spares
da21 AVAIL
da22 AVAIL

We can see mirror-5 was just a single stripe disk. Awesome.

After adding in the drive and formatting via the GUI for ZFS, I then ran:
zpool attach zfs /dev/da14 /dev/da13
zpool attach YOURPOOLNAME /dev/YOURDEVICETHATSWORKING /dev/YOURNEWDEVICE

# zpool status
pool: zfs
state: ONLINE
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scan: resilver in progress since Tue Aug 19 13:51:48 2014
3.23G scanned out of 1.41T at 276M/s, 1h29m to go
322M resilvered, 0.22% done

It actually finished in 40 minutes with no errors. Resilvering is a type of scrub, so a scrub cannot be running at the same time.

Then, just to be sure, I ran the scrub to verify data integrity:
zpool scrub zfs
zpool scrub YOURPOOLNAME

To Stop a scrub
zpool scrub -s YOURPOOLNAME

Verify status with (this checks all known data to be valid):
zpool status -v

# zpool status
pool: zfs
state: ONLINE
scan: scrub in progress since Tue Aug 19 17:06:45 2014
22.8G scanned out of 1.41T at 614M/s, 0h39m to go
0 repaired, 1.57% done

Apache Forbid Direct Access

Our all company meetings are “televised” via a gotowebinar/gotomeeting type setup and are recorded for future reference. The recordings are all in wmv format. The management team wants to allow end users to view these recordings, but they have strict policies in place as to how to secure said videos.

1) the video can only be accessed while on the internal network (either local or via VPN)
2) the video cannot be downloaded, copied, or shared with others

Number 1 is very easy; just host it on a system that’s not available externally. I ended up putting it on our intranet site. Check.
Number 2, however, was a little trickier since if I just put the .wmv up on the site it would be easily downloaded with a right-click save-as.

So I converted this to a flash file. FLVs are so much nicer since it can load up in the browsers of all the end users (not ipad owners.. )
Unfortunately one could still look at the source code and see the flv, right click from there and download. I initially looked at obfuscation of the code and found some good examples, but that doesn’t work entirely well since the browser will still take and show you the file locations.

So then I looked at .htaccess and how it could help.

cd /your/web/directory/and/files
nano .htaccess

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(gif|jpg|flv)$ – [F]

apache2ctl restart

I changed the “localhost” portion to “intranet” in my case, but you can really utilize anything above.

Now you get a 403 forbidden error if you attempt to download those types of files.

Cisco Callmanager CUCM LDAP Logs

So we had a working LDAP lookup system for our callmanager 8.x system up until very recently. What changed? We moved colocations and decided to decommission a few of the older domain controllers. No big deal, just point anything that had LDAP lookups to new DCs. Right?

So we noticed the callmanager was not populating any new employees. Hard to assign phones etc to them if that’s the case.

Connect
SSH to your CUCM box (our cucmadmin account was necessary)
I used putty.

List all logs, Take note of dates
file list activelog cm/trace/dirsync/log4j/ det date
The newest file should be on the bottom, looking like “dirsync0007.log” or similar

Open the log and see the errors
file tail activelog cm/trace/dirsync/log4j/dirsync00007.log
This will view the bottom part of the log (newest) live, so run a LDAP resync from the web interface of the CUCM and see results.
Unfortunately I had to wait the 10 minute timeout period to notice that it was looking at the old LDAP server despite the changes.

If I find out why it was still pointing to the old system I will update this post accordingly.