Replacing a hard drive with Veritas Volume Manager 

1 Comment

On one of my Solaris 9 servers, I lost a hard drive on a large array that had been built with no redundancy. RAID 0 is a tempting option for some admins trying to get the most space that they can out of the capacity they have, but it is almost always the wrong choice. Anyway, a drive died and had to be replaced. This array had been built using Veritas Volume Manager, so here are the steps I used. This is all from the command line. There is also a Veritas Enterprise Administrator GUI (vea) that you can use, but it has problems occasionally. Anyway, this is what I did – keep in mind that my array was already destroyed, so I didn’t worry about any data loss. If you are trying to keep your data, don’t follow my steps! You’ve been warned.

Legend: gendg is the disk group, genlv is the logical volume, gengd04 is the bad drive, gengd07 is the good drive, genlv-01 is the failed plex. You can find most of this information with the vxprint command.

Umount the effected file system

/sbin/umount /u0

Add Disk 13 (gendg07) to gendg

/usr/sbin/vxdg -g gendg adddisk gendg07=Disk_13

Replace gendg04 with gendg07

/usr/sbin/vxdg -g gendg repldisk gendg04=gendg07

Dis-associate the failed plex

/usr/sbin/vxplex -g gendg dis genlv-01

Re-associate the plex, it will be rebuilt

/usr/sbin/vxplex -g gendg att genlv genlv-01

Recover the disk group gendg and the logical volume genlv

/usr/sbin/vxrecover -b -g gendg -sE genlv

Since this was RAID 0, recreate the file system

/usr/sbin/mkfs -F vxfs /dev/vx/rdsk/gendg/genlv

Check the file system

/usr/sbin/fsck -F vxfs /dev/vx/rdsk/gendg/genlv

Mount the file system again

/sbin/mount /u0

I will try to post a similar experience using Sun’s Solaris Volume Manager next.

Extract files from an rpm 

No Comments

If you want to extract the files from an rpm, it’s really easy. I needed to use this recently when I was going to install a printer driver in UNIX. The manufacturer had a linux rpm available for download, but I didn’t need the whole thing, just the PPD file. So, I ran this command and copied out the PPD file that I needed.

rpm2cpio package.rpm | cpio -dimv

Find large files in multiple directories 

3 Comments

I haven’t posted for awhile because I have been super busy. I don’t think I have had a chance to post anything since it was announced that the company I work for was being bought out in the beginning of May. That sale has now gone through earlier this week, but the workload has not decreased in the slightest.

Anyway, most admins know how to find the largest files inside a single directory:

du -sk * | sort -n

The other day I needed to find the largest of over 10k+ files spread across hundreds of directories. So with a little command combo magic, I used this:

for i in `find . -type f`; do du -sk $i; done | sort -n

Which runs a du -sk on every single file within the current directory and all sub-directories, pipes it to a sort, with the last files being output to the screen being the largest.

Looking at it again today, I guess I probably could have removed the for loop and just done:

du -sk `find . -type f` | sort -n

Testing it out real quick shows that it works; however, if you have as many files as I had to go through, you would have quickly exhausted du and it would have complained:

-bash: /usr/bin/du: Argument list too long

So it looks like the for loop was needed after all. Personally, I love running for loops on the command line.

Happy Father’s Day to all you fathers out there!

Author Highlighting 

1 Comment

I read this post by Matt Cutts awhile back (I recommend subscribing to his blog, some useful stuff there) and now that my blog is getting to the point where people are commenting on my posts and I am commenting back, it made sense to implement this on my blog. Going through his instructions I had a couple things to add. Instead of just adding a new line to your css file with a background color, I would recommend duplicating the .alt section of your css and then changing the color there. That way all the other formatting sticks with your comment. For example, all of my comments have rounded corners, if I just added the line he recommends, my comments are square. Enough said there.

The other section I wonder about but doesn’t really apply to my blog, is for blogs with multiple authors. His code says:

if (1 == $comment->user_id)

which only highlights the comments of the admin user – who may not even be the original author. Someday, when I’m a WordPress hacker, I’ll tell you what the correct line should be, or some other guru can add it. But there should be something like:

if ($article->user_id == $comment->user_id)

Again I don’t know what the right variable for the $article->user_id would be. If you take the time to figure it out, let us know.

Upgrading WordPress 

No Comments

Well, it’s one of the great and annoying things about open source software – frequent code changes, updates, and security releases.  Version 2.5 of WordPress came out less then a month ago.  I decided, I’d wait for the first subversion release (2.5.1), which, of course, would inevitably fix problems with all the new features introduced.  Unfortunately, one of my blogs (not this one), was “hacked” and had malware inserted into a post.  So, I went ahead and upgraded all my blogs.  Now, three days later, WordPress releases 2.5.1.  Some guys just have all the luck, maybe sometime I’ll have some!  Since 2.5.1 fixes a “very important security fix”, I installed it immediately. . . let the script kiddies hack somebody else.