Determining Block Sizes in CentOS 5 & 6

Been a looooong time, but I felt this was worthy of continuing to build up my tips and tools library/blog with some block searching info since I ran into this today @ work.

lsblk is only available on CentOS 6+ to my best knowledge, so on CentOS 5, we’d want to run the following:

[root@deadbeef ~]# tune2fs -l /dev/disk/block/fun | grep 'Block' | tr -s ' ' | cut -f3 -d' '

471859163
4096
group:

So the first number is the amount of blocks and the second is the block size here.  Multiply them together to get your answer in bytes. The word group: is just an anomaly of the filtering and can be ignored.

In CentOS 6, we can leverage lsblk:

lsblk -o NAME,PHY-SeC

Output:
NAME   PHY-SEC 
sda        512 
├─sda1     512 
├─sda2     512 
└─sda5     512 

Advertisements

Desktop OCD (Why I switched from a 17″ Macbook Pro, to an 11″ Macbook Air)

IMG_1527Recently my employer was extremely kind enough to spoil me yet again and replace a late 2010 17″ Macbook Pro I was using with an 11″ 2013 Haswell Macbook Air.  It’s taken some time for me to define what a laptop should be, and have recently come to the conclusion that a laptop should be light, with form factor conventions that make it wieldy, convenient to take from one location to the next, and facilitate your work and entertainment on the go.

Over the years it’s taken me some time to realize what I need out a workstation, and laptop.  My original school of thought for the past 12 years was that I needed an extremely high resolution for desktop real estate whether it be a workstation or laptop. This was partly because I was battling with what some may consider mild OCD with my workspace and workflow in relation to my desktop scheme, and because I still wanted to play Blizzard and Steam games.  I believed that my desktop application placement had to be perfect, ranging from e-mail client, to terminal, and various other applications.  I was also determined to cram every regularly used application in tight order onto one screen, which is why I originally thought that a 17″ Macbook Pro for my work on the go was a good idea.

By now it should be pretty apparent that I was very slow to adopt multiple virtual desktops with what OSX implemented in Spaces (something that I was already aware of for years with Linux GUI desktop managers) some revisions of Macintosh exotic cat named operating systems ago.  When I started dealing with more Windows administration and VMWare for my job, I found that using multiple virtual desktops was a far more efficient way to work.  Finally, realization set in that it’s okay to have a “messy” desktop and in a sense was relieved by this.  After this minor technical enlightenment, I became increasingly more frustrated lugging around a 17″ Macbook Pro (#firstworldproblems).  It got to the point where I didn’t want to use it in any situation other than sitting at a desk.  Enter the Macbook Air.

Since I’ve been using the Macbook Air for the past 2 weeks, I have realized how well this ultrabook works for me and how impractical the 17″ Macbook Pro was.  I actually enjoy taking the Air to work, and meetings now, where as before I preferred to keep the 17″ Macbook Pro on my dining table, or desk and rarely traveled with it.  As for games, I found that I was hardly gaming after a while.  The other thing that I’m really impressed with is battery life.  9 hours of usage is very impressive compared to what I was seeing before with the Pro.

I guess the lesson learned here on a somewhat deeper level is to practice sensibility more often.  This is something I think I’m still struggling with and striving to be better at in my mid-30’s.

mkinitrd syntax error regarding conditional expression(s)

So working with an older CentOS 5.1 system today, I ran into a problem which I believed to be mkinitrd related when attempting to install kernel-PAE on a vmguest I upgraded to 4GB of vRAM.

I was seeing this upon yum installing kernel-PAE:

/sbin/mkinitrd: line 489: syntax error in conditional expression: unexpected token `('
/sbin/mkinitrd: line 489: syntax error near `^(d'
/sbin/mkinitrd: line 489: `        if [[ "$device" =~ ^(dm-|mapper/|mpath/) ]]; then'

So it turns out that bash was the problem here not mkinitrd.  I never thought that mkinitrd and bash would be so intertwined, but it makes perfect sense if you think about it.  I just never had to think about it ’til today.

I guess that serves us right for not keeping up with CentOS releases.  A big thanks to SmogMonkey for posting this find on http://www.howtoforge.com/software-raid1-grub-boot-fedora-8-p2#comment-33804.

Cleanly uninstalling Google Chrome in OSX

So being the big nerd I am, I enjoy playing Fantasy Football.  The other day I noticed that Chrome was having an issue rendering projections, scores, and notes from player card previews on http://football.fantasysports.yahoo.com/.

Since I wasn’t really in the mood to debug, I decided to just cleanly remove Chrome to resolve my issue.  If you do feel like debugging you can do so via Chrome.app command arguments:

In terminal.app run the following:

open /Applications/Google\ Chrome.app --args --enable-logging --v=1

At any rate, after removing the following files in terminal.app, I was back to Fantasy Football browsing insanity:

rm -r /Applications/Google\ Chrome.app/
rm -r ~/Library/Application\ Support/Google/Chrome/
rm ~/Library/Preferences/com.google.Chrome.plist
rm ~/Library/Preferences/com.google.Chrome.plist.lockfile
rm ~/Library/Preferences/Google\ Chrome.plist
rm ~/Library/Preferences/Google\ Chrome.plist.lockfile
rm ~/Library/Saved Application State/com.google.Chrome.savedState
rm ~/Library/Application\ Support/CrashReporter/Google\ Chrome*.plist
rm ~/Library/Google/GoogleSoftwareUpdate/Actives/com.google.Chrome
rm -r ~/Library/Speech/Speakable\ Items/Application\ Speakable\ Items/Google\ Chrome/

OSX & Linux Disk Benchmarking

As a SysAdmin, you’ll need to benchmark disk performance from time to time, or rather just gloat that your system’s drive is better than your buddy’s. In my particular case, I have an existing need to quantify performance metrics on my work macbook pro’s disk speed with Symantec PGP (don’t get me started on this product), without it, and with Apple FileVault in place of it.

Perusing the web I came across a good article from cultofmac.com that assisted me with my disk benchmark testing.  This can apply to OSX and most Linux systems as well.

To test a system’s write speed, I used the following command from a terminal window:

time dd if=/dev/zero bs=1024k of=speedtest count=1024

Output from my work iMac w/SSD:

1024+0 records in
1024+0 records out
1073741824 bytes transferred in 8.948791 secs (119987362 bytes/sec)

real 0m8.954s
user 0m0.001s
sys 0m0.413s

The bytes per seconds number when converted to Megabytes equates to 114.42887 Mb per second.

To test the read speed of my disk, I ran the following from terminal.app:

dd if=speedtest bs=1024k of=/dev/null count=1024

Output:

1024+0 records in
1024+0 records out
1073741824 bytes transferred in 0.145955 secs (7356659197 bytes/sec)

So this is around 7016 Mb (6.8 Gb) per second with some rounding.  Based on the above output results, my work iMac w/ SSD can write at 114 Mb/s, and read at 6.8Gb/s.

When I get around to testing on my work laptop, these commands should give me good data metrics.

As far as bytes to Mb/Gb/etc conversioning goes, you can use google conversion web tools, or the “units” command on a Linux host if available.  There are several alternatives you can use as well.

Units Linux command sample for reference:

units –terse “119987362 bytes” “MiB”

Output:

114.42887

Running logrotate Manually

So the other day at work, I needed to modify logrotate.conf for one of our groups.  To test my changes, I forced a logrotate.d run in verbose mode to ensure that my changes were applied properly.

The command I used:

logrotate -vf /etc/logrotate.conf

Since I’m predominantly administering CentOS, /etc/logrotate.conf is where my logrotate config file lives.  In Debian or Ubuntu however, one might find their logrotate configuration file under /etc/logrotate.d/<hostname>.conf.

OSX :: CPU & Core Counting

A while back ago I blogged about  rudimentary Linux cpu and core lookups.  I figured I’d follow up with how you do this in OSX via “system_profiler SPHardwareDataType” as well.

zissou:~ jrad$ system_profiler SPHardwareDataType

Hardware:
Hardware Overview:
Model Name: iMac
 Model Identifier: iMac12,2
 Processor Name: Intel Core i7
 Processor Speed: 3.4 GHz
 Number of Processors: 1
 Total Number of Cores: 4
 L2 Cache (per Core): 256 KB
 L3 Cache: 8 MB
 Memory: 8 GB
 Boot ROM Version: IM121.0047.B1F
 SMC Version (system): 1.72f2
 Serial Number (system): D25J10LPDHJW
 Hardware UUID: 813A5897-1248-5460-84F6-062AE27929A7