Mar 30 2008

A real solution to PowerShell SSH Remoting

Can’t wait for us to ship PowerShell Remoting?

Want remoting to use SSH?

Why wait for us? /N software has just announced a beta of their NetCmdlets V2.0 which provides PowerShell remoting over SSH today! They’ve had this for a while and V2 updates (and improves) the usability of the cmdlets as well as adding a bunch of new and exciting commands.

For example, chances are that you won’t ever see Microsoft ship the [get/send]-s3 cmdlets but /N software V2 does. :-)

http://blogs.msdn.com/powershell/archive/2008/03/27/powershell-remoting-using-ssh.aspx

My blog post from 2006 is currently the #1 Google Result for PowerShell SSH, but finally there is a good solution out there from /N software. It also supports S3. Very cool :)


Nov 13 2007

By the powers of two I command you to dial

Here in Alabama, USA we’ve just acquired the new area code “256″ which means that some lucky (and probably unappreciative) bastard will get

+1-256-512-1024

Which has simply got to be the coolest damn phone number I can imagine.
– David McNett

Can i dial 1-255-255-255255 and make every phone in the world ring?
– Tanuki


Oct 18 2007

Bash one liner to randomize lines in file

Discovered that the bash shell has a variable called $RANDOM, which outputs a pseudo-random number every time you call it. Sweet! Allowed me to randomize the lines in a file for a process I needed to do, thusly:

for i in `cat unusual.txt`; do echo “$RANDOM $i”; done | sort | sed -r ’s/^[0-9]+ //’ > randorder.txt

In other words, put a random number on every line, sort the file, then take off the random numbers. Worked like a charm.


Oct 5 2007

Hivearchive Downtime

Had a bit of hardware trouble, with a hard drive failing today. However, due to my sysadmin ninja skills, no data was lost and the RAID 1 is rebuilding.

[root@nexus ~]# cat /proc/mdstat

Personalities : [raid1]

md1 : active raid1 hdc1[2] hda1[0]

79360960 blocks [2/1] [U_]

[>....................] recovery = 2.2% (1809408/79360960) finish=25.9min speed=49725K/sec

md0 : active raid1 hdc2[1] hda2[0]

1052160 blocks [2/2] [UU]

unused devices:

If you need to do this:

# dd if=/dev/hda of=/dev/hdc bs=512 count=1
# mdadm –manage /dev/md0 –add /dev/hdc2
# mdadm –manage /dev/md1 –add /dev/hdc1

In other words, copy the master boot record from the good drive to the new drive so you have the same partitions, then hot add the new partitions to your array. WARNING DANGER DANGER WARNING. Backup all your data first, and test your backups work. Change the partitions and drives to match your own situation. Failure to do so will cause you to hose your system… That is all.

Now if only Linux could do all this automatically like other sane operating systems.

Update: I’m getting a little suspicious that just copying the MBR from one hard drive to another, messed up something with Linux’s software RAID. Sigh. This is exactly how I would do it in Solaris, but Linux has no great documentation on how to do it easily. Lazyweb?

Update, 2 Aug 2008:

I did this again and this time realized that copying the MBR will work fine with DD, but Linux needs to be explicitly told to rescan the partition table. I simply opened up the device with fdisk, checked the partitions looked how I wanted and then rewrote the partition table. Fdisk then calls the IOCTL to tell the kernel to rescan the partitions. Problem solved. :)


Sep 25 2007

Upgraded to WordPress 2.3

Surprisingly, the upgrade went pretty smoothly. While dinking around in the admin section, I noticed:

Akismet has protected your site from 15,874 spam comments.

Man, I hate spammers. The more popular my domains get, the more they get targeted. One of my other sites was used as a forged from address in a bunch of e-mails and I got all the bounces. Thanks for checking SPF everyone. :(

Update:

Ugh! Damn it.

WordPress database error: [Table 'wp_post2cat' doesn't exist]
SELECT cat_ID AS ID, MAX(post_modified) AS last_mod FROM `wp_posts` p LEFT JOIN `wp_post2cat` pc ON p.ID = pc.post_id LEFT JOIN `wp_categories` c ON pc.category_id = c.cat_ID WHERE post_status = ‘publish’ GROUP BY cat_ID

WordPress database error: [Table 'wp_post2cat' doesn't exist]
SELECT cat_ID AS ID, MAX(post_modified) AS last_mod FROM `wp_posts` p LEFT JOIN `wp_post2cat` pc ON p.ID = pc.post_id LEFT JOIN `wp_categories` c ON pc.category_id = c.cat_ID WHERE post_status = ‘publish’ GROUP BY cat_ID

Yes, I ran the update which supposedly updated my DB. Lovely.

Update 2:

Apparently I need to update my Google Sitemaps plugin as found in this thread: http://wordpress.org/support/topic/135564


Sep 17 2007

VMWare VProbes (dtrace for all)

Keith Adams has an intriguing post about VMWare vprobes:

VProbes attempts to provide a set of tools for answering the question, “What the heck is this computer doing?” It’s an open-ended question, so vprobes is accordingly open-ended, as well. In its current form, it provides an interactive, safe way of instrumenting a running VM at any level: from user-level processes down to the kernel, and even into VMware’s VMM and hypervisor, if need be.

First, we are aiming to provide a Dtrace-like tool for other commercially important operating systems than Solaris. Second, VProbes can combine with other virtualization-based techniques in powerful ways. For example, VProbes and deterministic replay combine to make the most potent tool that I’m aware of for debugging intermittent performance anomalies.


May 25 2007

NVidia Forcedeth Ethernet Full-Duplex

Just an FYI, the NVidia Gigabit Forcedeth Ethernet driver in Linux uses the ethtool command to get and set the duplex rate and not the mii-tool like many other web pages erroneously state.


May 23 2007

Solaris Perl CPAN

Today, I was searching Google for help installing Perl modules through CPAN using the default Solaris Perl. Sadly, my own blog was one of the search results, and it was no help. I guess this entry is going to make the situation even worse.

So I suppose I should put some useful information:

  • Solaris Perl is compiled using Sun Studio and not gcc
  • You must compile Perl modules with the same compiler Perl was compiled with
  • The Blastwave Perl is also uselessly compiled using Sun Studio and not gcc
  • Sun Studio is now free instead of thousands of dollars and free to download
  • The Sunfreeware Perl Package is compiled with gcc. Go sanity!

I’m sure if you cared enough and wanted to waste time, you could download the Sun Studio compiler just for your handful of Perl modules, or you could download the Sunfreeware package and use gcc, the compiler that God intended you to use. Your choice man. BTW, Sun, you suck.


May 21 2007

Amazon S3 Backup Solution

Although I’ve had an Amazon Simple Storage Service account for awhile, I haven’t used it. For those of you who aren’t familiar with S3, Amazon has opened up their resources for everyday people to use. In this instance, you can use their servers as a place to dump your files online. Currently they charge $0.15 per gigabyte of storage used as well as a fee for the bandwidth to transfer it back and forth.

With this setup, they take care of the administration, backup, redundancy, troubleshooting, and the storage scales to whatever you need automatically. I’ve been searching for a good backup script so I can backup all the stuff I have running on this web-host, but most of them have been beta to this point or a pain to setup. Today I finally installed Brackup through CPAN, along with all the requisite Perl modules. I’ve already tested a backup and restore and it seems it will fit my needs well.


Mar 19 2007

Convert Floppy Image to an ISO (Solaris/Linux)

Device manufacturers still haven’t caught on that floppy drives are no longer standard equipment on most modern machines. I recently came across this issue when trying to install a RAID driver on a Solaris 10 (x86) box, and solved it thusly:


# lofiadm -a /export/home/mmichie/tmp/ARCMSR.DD /dev/lofi/1
# mount -F pcfs /dev/lofi/1 /mnt/floppy/

# mkisofs -R -J -o driverdisk.iso /mnt/floppy/
Total translation table size: 0
Total rockridge attributes bytes: 2428
Total directory bytes: 16384
Path table size(bytes): 122
Max brk space used 10000
278 extents written (0 MB)

In other words, download the raw floppy image and mount it as a loopback device. Then use mkisofs to translate it to an iso. Use your favorite CD-R burning software to burn the ISO. Install your driver disk. This can be done similarly in Linux, the main difference will be mounting the floppy image:

mount -o loop driverdisk.img /mnt

The mkisofs command will be exactly the same as Solaris.