Jamie Fargen's Weblog

Author Archive

February 5k: I Will Inspire

by on Mar.18, 2014, under Uncategorized

In January I began a fitness regime to include running and I plan on running a 5k every month. In February I enrolled in the I Will Inspire 5k. It was a little difficult because I was getting over a cold and had not run in several weeks. This 5k was a little weird and kind of disorganized. It started approximately 30 minutes later than scheduled, not sure if it was a weather issue and they just didn’t communicate that they were waiting for a squall to pass. After waiting for about 20 minutes it started to rain, fortunately the starting line was by a Fire Station, that was apparently part of the event. They let us stand in the Fire Station Garage, the rain lasted about 10 minutes. After it passed the race started.

The first mile went pretty well, but then I started to fade quickly, when I hit the ever so slightest hill it really drained my energy. About 2.5 miles in my friend took off, I guess I was going to slow for him, then I walked for about 2 minutes. After catching my breath I jogged the rest of the way, actually sprinting prett well for the last 150-200 meters, with a finishing time of 34:37.

I definitely need more work, it is 10 minutes longer than my best 5k time.

Here is a link to the I Will Inspire results.

Leave a Comment more...

Lucia: A good cause

by on Mar.18, 2014, under Uncategorized

There is a young girl that was born very ill, she requires round the clock care and medical attention. I don’t think any of us can understand how difficult this could be for a young family. If you have the resources please check out her page and consider making a donation to help with her ongoing care and assistance.

http://www.youcaring.com/medical-fundraiser/for-the-love-of-lucia/86229

Leave a Comment more...

BigBlueButton — Open Source Meeting/Teaching Tool

by on May.08, 2013, under Uncategorized

Yesterday I was invited to a meeting that was utilizing a screensharing product called the BigBlueButton. Since it is based on HTML5 all you need is a decent browser. In addition it is free and open source.

Leave a Comment more...

How to get a hard drive serial number from udev.

by on Dec.26, 2012, under Uncategorized

Some times a hard drive will fail in such a way that tools like smartctl or hdparm is unable to get the hard drive serial number or in certain circumstances will give the wrong hard drive serial.

This may work some of the time, but it won’t always work depending on the type of failure a drive is experiencing. It is definitely a better alternative to try rather than getting someone to go down to the data center and pulling your drive.

*Note that WordPress does something to the hyphens and when rendered on the webpage it is a different character. When entering the command ensure that you enter (hyphen)(hyphen) before each option passed in the command.

$ /sbin/udevadm info –query=property –name=drive| grep -i serial

Just replace drive for which physical drive you are trying to get details. In my case I use the command like so as an example.

$/sbin/udevadm info –query=property –name=sda| grep -i serial

Leave a Comment :, , , more...

KVM:Reset Linux Guest Password and/or Password Expiration

by on Dec.21, 2012, under Work and stuff

The post is from the stand point of RHEL hypervisor with a KVM CentOS Linux guest using a raw image file as a backing store and the openssl package, but it could easily be applied to different distros, backing stores, or even booting a Linux livecd as long as you can get the necessary packages. Some steps may vary depending on what kind of backing store you are using for the image and the partitions your OS is installed. This process could also be used to do many other things like increasing the time for password expirations.

 

First mount the image as a loopback device:

$ sudo losetup /dev/loop0 /var/lib/libvirt/images/virtcort011ccxra.img       # note that is a zero at the end of /dev/loop

Next add the partition mappings:

$ sudo kpartx -av /dev/loop0

In my CentOS installation I was using LVM and the next few steps are LVM specific:

Use vgscan to find the LVM volume

$ sudo vgscan

This located the new LVM volume group VolGroup00   # again note that is zero zer at the end of VolGroup. You will use this group in the next step.

Activate LVM Volume Group:

$ sudo vgchange -ay VolGroup00

You can use lvs to find the Volume where your / (root) file system is mounted:

$ sudo lvs

Next mount the volume:

$ sudo mount /dev/VolGroup00/LogVol00 /mnt/linuxrescue

You should be able to see directories in the volume:

$ ls /mnt/linuxrescue

Now generate the new password for the guest:

$ openssl passwd -1 -salt ranNum    # for the salt substitute random numbers and letters for ranNum.

Password:

$1$ranNum$N6s5hhYltlYQPnMDdxYy1   # you can see your salt + hash

Now copy this string into /etc/shadow:

$ sudo vi /mnt/linuxrescue/etc/shadow

In editing your shadow file you will see something like below your salt+hash should be  substituted as below for the user password you would like to reset.

root:$1$ranNum$N6s5hhYltlYQPnMDdxYy1:15492:1:90:7:::

If you want to change the length of time for password expirations the next step will show you how.

$ sudo vi /etc/login.defs     # find the value PASS_MAX_DAYS and edit it to your needs

Now unmount the file system:

$ sudo umount /mnt/linuxrescue

Unactivate the LVM vol group:

$ sudo vgchange -an VolGroup00

Delete the partition mappings:

$ sudo kpartx -dv /dev/loop0

Unmount the loopback device:

$ sudo kpartx -dv /dev/loop0

 

Leave a Comment :, , , , , , , more...

KVM:Reset Windows Guest Password

by on Dec.21, 2012, under Work and stuff

The post is from the stand point of RHEL hypervisor with a KVM Windows guest using a raw image file as a backing store using the package chntpw, but it could easily be applied to different distros, backing stores, or even booting a Linux livecd as long as you can install the chntpw package. Some steps may vary depending on what kind of backing store you are using for the image and where your Windows OS was installed.

First get the chntpw package:
$ sudo yum install chntpw

Print the logical loopback device:
$ sudo losetup -f
/dev/loopo

Next mount the image file as a loopback device:
$ sudo losetup /dev/loopo /var/lib/libvirt/images/windows7.raw

Add partition mappings:
$ sudo kpartx -av /dev/loop0  #That is a zero at the end of /dev/loop0

Create a directory that can be used as a mount point:
$ sudo mkdir -p /mnt/winrescue

Mount the appropriate filesystem:
$ sudo mount /dev/mapper/loop0p2 /mnt/winrescue

Change to the directory where the SAM db is located:
$ sudo cd /mnt/winrescue/Windows/System32/config/

Now run the chntpw utility:
$ sudo chntpw -I SAM

Once complete you will want to unmount the filesystem and loopback device.

Get out of the mounted filesystem:

$ cd ~

Umount the filesystem:

$ sudo umount /mnt/windowsrescue/

Delete the partition mappings:

$ sudo kpartx -dv /dev/loop0

Unmount the loopback device:

$ sudo losetup -d /dev/loop0

The process is now complete.

Leave a Comment :, , , , , , more...

Distributed Copy Util

by on Oct.29, 2012, under Work and stuff

Say you have 1 file that is 10TBytes, like a VM image, that you need to copy between say two nfs file stores (that you don’t control). Your only problem is a single host is only capable of 50MB/sec over a 1Gb/sec network connection. The good news is you have hundreds of hosts all mounting these two nfs filesystems. Maybe you can lash 10-12 hosts together to greatly the reduce the time it takes to copy the file? Then check out scp-tsunami – http://code.google.com/p/scp-tsunami.

Leave a Comment :, , , , , , , more...

VMWare / Linux: Map SCSI LUNs to sd (storage device id)

by on Oct.26, 2012, under Work and stuff

Hopefully one day you won’t come upon a server running ESX / Linux that has become unresponsive to regular management tools and view something like this completely filling your console:

sd 7:0:2:0 still retrying after 360s

I knew instantly 7:0:2:0 was a SCSI mapping for host, bus, scsi id, etc, etc. These hosts are using SATA drives and I needed to be able to us hdparm to determine the serial number of the drive for local support to replace.  After digging I came up the command sg_map matched with -x option prints after each active sg device name is displayed there are five digits: <host_number> <bus> <scsi_id> <lun> <scsi_type>.

When I ran sg_map -x this provided me with exactly what I need: /dev/sg2  7 0 2 0  0  /dev/sdc.  You can see that sdc is mapped to SCSI address 7:0:2:0. With this information I was able to use hdparm -i /dev/sdc to extract the serial number of the drive and provide it to local hands and feet support in Germany to swap out the failing hard drive.

Leave a Comment :, , , , , , , , , , , more...

How to copy sparse files faster?

by on Oct.11, 2012, under Work and stuff

A lot of people do backups with rsync and 99% of the time it works pretty well. There is one file type that rsync handles rather poorly and that is sparse files, even though rsyncs documentation indicates that sparse files are handled efficiently it is simply not true. These sparse files are becoming more prominent because they are used to store VM images, like KVM, Xen, even VMWare. So what is a good way to copy them? It turns out that tar is much better at handling sparse files than rsync, it has had support for sparse files for over two decades, and can represent the holes in sparse files more efficiently.

In my testing using Tar instead of Rsync has resulted in cutting the time to backup a sparse file by 8-10 times.

Just pipe tar over ssh and compare your results to rsync:
tar cvzSpf – sparse.file | ssh user@hostname ‘(cd /tmp; tar xzSpf -)’

 

Leave a Comment :, , , , , , , , , more...

How to find a user subscribed to a mailman list…

by on Sep.29, 2011, under Uncategorized

Recently I was tasked to determine if an email address was subscribed to any lists on the mailman server which I run. The solution came in two pieces.

1) Dump all of the list members to files named after the list, you can do that with the nifty one liner below.

root@localhost # for i in `./list_lists | awk ‘{ print $1 }’`; do ./list_members -o /root/members/$i $i; done

2) cd /root/members then simply grep for the users emails.

root@localhost # grep -r ‘users@emailaddress.com’ .

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...