Saturday, July 23, 2011

vmware, qemu & winxp

so linux now has great support for virtual machines. i use virtualbox on my macbook but for years have used vmware on my debian box. now that i don't have to rely on vmware's resource-intensive hypervisor, i started to research alternative solutions. i came across qemu; apparently xen open source and kvm use qemu under their hoods. qemu can also be utilized independently, so i decided not to bother with xen or kvm. my first problem was that i my vmware vmdk image file was distributed instead of centralized (i had multiple vmdk files).

matthew@hufflepuff:~$ ll ~/vmware/
total 11G
drwxr-xr-x 2 matthew matthew 4.0K Jun 8 14:18 .
drwxrwxrwt 3 root root 4.0K Jun 8 20:19 ..
-rw------- 1 matthew matthew 8.5K May 18 19:37 nvram
-rw-r--r-- 1 matthew matthew 43K Mar 19 2010 vmware-0.log
-rw-r--r-- 1 matthew matthew 49K Mar 18 2010 vmware-1.log
-rw-r--r-- 1 matthew matthew 49K Mar 17 2010 vmware-2.log
-rw-r--r-- 1 matthew matthew 50K May 18 19:37 vmware.log
-rw------- 1 matthew matthew 2.0G May 18 19:37 Windows XP Professional-f001.vmdk
-rw------- 1 matthew matthew 2.0G May 18 19:37 Windows XP Professional-f002.vmdk
-rw------- 1 matthew matthew 2.0G May 18 19:37 Windows XP Professional-f003.vmdk
-rw------- 1 matthew matthew 2.0G May 18 19:37 Windows XP Professional-f004.vmdk
-rw------- 1 matthew matthew 2.0G May 18 19:37 Windows XP Professional-f005.vmdk
-rw------- 1 matthew matthew 1.3M Dec 5 2007 Windows XP Professional-f006.vmdk
-rw------- 1 matthew matthew 732 May 18 19:25 Windows XP Professional.vmdk
-rw------- 1 matthew matthew 0 Dec 5 2007 Windows XP Professional.vmsd
-rwxr-xr-x 1 matthew matthew 1.4K May 18 19:37 Windows XP Professional.vmx
-rw-r--r-- 1 matthew matthew 1.7K Mar 16 2010 Windows XP Professional.vmxf


i needed to merge these files without damaging the windows' ntfs. i came across a utility called "vdiskmanager". this merged all my files into one vmdk:

matthew@hufflepuff:~/vmware$ vmware-vdiskmanager –r Windows\ XP\ Professional.vmdk –t 0 WinXP.vmdk

i then needed to convert it to a qemu raw image format:

matthew@hufflepuff:~/vmware$ qemu-img convert -f vmdk WinXP.vmdk -O raw WinXP.img

then to verify the conversion:

matthew@hufflepuff:~/vmware$ qemu-img info -f raw WinXP.img
image: WinXP.img
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: 7.4G

and double check (because i'm paranoid):

matthew@hufflepuff:~/vmware$ file WinXP.img
WinXP.img: x86 boot sector, Microsoft Windows XP MBR, Serial 0x2e682e67; partition 1: ID=0x7, active, starthead 1, startsector 63, 20948697 sectors, code offset 0xc0


i then proceeded to launch my vm:

matthew@hufflepuff:~/vmware$ qemu -hda WinXP.img -m 365 -vga std

but it blue screened ... the only reliable function in windows. so, i researched the issue, turned out it was because i didn't remove the vmware drivers before performing all this work on my image file.

http://support.microsoft.com/kb/324764

The agp440.sys service had to be disabled so that WinXP would only load basic vga drivers.

i made an image of my WinXP install cd via dd:

matthew@hufflepuff:~/vmware$ dd if=/dev/sr0 of=./XPInstall.img bs=1024

then i ran qemu, let the cdrom image boot and followed microsoft's instructions:

matthew@hufflepuff:~/vmware$ qemu -hda WinXP.img -cdrom XPInstall.img -m 365 -vga std

and after making the changes, i booted my vm as normal:

matthew@hufflepuff:~/vmware$ qemu -hda WinXP.img -m 365 -vga std

tada! we have a hypervisor running a vm and utilizing less resources than vmware.

houston, mission accomplished!

egrep an ip using a regex

i'm not the greatest at regular expressions, but with some help from a friend i finally developed a nice regex that will grab an ip address out of a log file.

i have postfix setup on my mail server to greylist new addresses automatically. i'm working on developing a plugin for that will take addresses that don't follow smtp rfc standards and automatically blacklist them. at any rate, here's the regex ... maybe it'll help someone else out there keep from pulling their hair out:

rosebud:~# egrep /var/log/your_mail_log 'client_address\=[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'

of course, client_address is relative to postfix, but you get the idea. cheers!

ffmpeg - rip the audio track from a video file

i've been toying around with ripping the audio track from a video file and mplayer just wasn't living up to the job. i have used ffmpeg in the past but hadn't recently so i took a look at the man page and found i could accomplish this task very easily in one line with a pipe to lame.

matthew@hufflepuff:~$ ffmpeg -i video.mp4 -f wav - | lame -V 3 - audio.mp3

this takes video.mp4 and dumps the audio track in wav format then pipes it to lame and creates an mp3 of the dump. sweet.

Thursday, September 11, 2008

vnc, x11vnc, and krfb

so, i got tired of sitting at the table with my macbook, or on the couch, or in my chair ... instead i wanted to sit at my desk in my REALLY comfy chair and use a keyboard and mouse ... and possibly my 17" flat panel as a second monitor. the only problem: i wouldn't be able to use my gnu/linux desktop system any more. why, you ask?

it's the computer at my desk.

alright, so i began evaluating my options; i thought of vnc first, but decided to research other applications. i found krfb, a kde remote desktop access system. i wasn't too thrilled with the fact that it only worked based on invitations and that i had to set it up physically with my monitor connected and logged in.

[at this time i already connected my flat panel as a second monitor and began using my keyboard and mouse for my macbook. the only access i had was via ssh]

i then found x11vnc, i thought i could attach a vnc session to kdm so i could log in.

negative

x11vnc kept looking for a "magic cookie" or authority file that didn't exist.

well, i guess it was time to try vnc. i hadn't had luck in the past (over a year and a half ago) when i tried it; nevertheless, i went full steam ahead.

i configured my .vncrc file, and stumbled upon an option i hadn't seen before:

$vncStartup = "/etc/X11/Xsession";

i then thought about it ... since i use kde, what if i put "/usr/bin/startkde" in there, would that work? i inserted the line and ran vncserver. i connected to the vnc session and ... BAM! yes! i had my desktop. mission accomplished. sweet.

gotta love gnu/linux.

Tuesday, August 19, 2008

FileEngine Videos

FileEngine Servers has three neat video's available on YouTube. I've included them here for your viewing pleasure.

Chris Reed, FileEngine Sales Rep. on The Buzz



Mike Beck with Maginot, Moore, and Beck; FileEngine Client



David Forsell with Keep Indianapolis Beautiful, Inc.; FileEngine Client

Wednesday, July 9, 2008

Help Bruce Perens Protect Open Source

Sign the petition showing your support at: http://techp.org/p/7

Wednesday, June 25, 2008

Entourage 2004 & MS Exchange 2003

For the longest time, Entourage would constantly synchronize and never finish updating it's folders. Entourage would then randomly fail during a synchronization and persistently ask for the users' password. After many trial and error's of deleting the profile on the Exchange server, researching synchronization issues (related to Chinese character sets or a missing update, or even a possible Exchange server setting), we discovered the issue was because Entourage would not display ALL of the Deleted Items. There were two 150MB-size e-mail's in the users' Deleted Items folder that would display in Outlook on a Windows machine, but not in Entourage or in Outlook Web Access. After emptying the users' Deleted Items folder from Outlook, we fired up Entourage and it (finally) completed synchronization without error. Whether it was an Exchange or Entourage issue, who knows. All I know is to never trust anything written by Microsoft, be it on a PC or a Mac.