Growing Solaris UFS file systems

I recently needed to grow a Solaris UFS file system, and accomplished this with the growfs(1m) utility. The growfs(1m) utility takes two arguments. The first argument to growfs ( the value passed to “-M” ) is the mount point of the file system to grow. The second argument is the raw device that backs this mount point. The following example will grow “/test” to the maximum size available on the meta device d100:

$ growfs -M /test /dev/md/rdsk/d100

To see how many sectors will be available on d100 after the grow operation completes, you can run newfs with the “-N” option, and compare that with the current value of df (1m):

$ newfs -N /dev/md/dsk/d100
/dev/md/rdsk/d0: 232331520 sectors in 56944 cylinders of 16 tracks, 255 sectors
113443.1MB in 2191 cyl groups (26 c/g, 51.80MB/g, 6400 i/g)

This will report the number of sectors, cylinders and MBs that would be allocated if a new file system was created on meta device d100. As always, test everything on a non critical system prior to making changes to critical boxen.

No md5sum? Use OpenSSL!

I constantly find myself generating checksums, and for some reason each Operating System likes to implement their open message digest command ( if they provide one at all ). If your system is missing a digest command, you can use the openssl utility to generate one-time hashes. OpenSSL supports the SHA1, MD5 and RIPEMD160 algorithms, and accepts one or more files as arguments:

$ openssl md5 passwd
MD5(passwd)= eb1e5c787c3d85b9cf214c70c1095934

$ openssl sha1 passwd
SHA1(passwd)= 1163c343091756010a77f95068aca4c4e360b932

$ openssl rmd160 passwd
RIPEMD160(passwd)= c5c52bd8506740387691c4b0eb606ad0ffe778d6

$ openssl rmd160 passwd passwd /etc/services
RIPEMD160(passwd)= c5c52bd8506740387691c4b0eb606ad0ffe778d6
RIPEMD160(passwd)= c5c52bd8506740387691c4b0eb606ad0ffe778d6
RIPEMD160(/etc/services)= c5c52bd8506740387691c4b0eb606ad0ffe778d6

$ cat passwd | openssl md5
eb1e5c787c3d85b9cf214c70c1095934

The OpenSSL source code can be downloaded from the main OpenSSL website:

http://www.openssl.org/source/

Nifty Solaris fuser trick

I was reading through Planet Sun, and came across Pete Shanahan’s fuser trick. This trick can be used to get the process name of each PID accessing a file system:

$ ps -o pid,ppid,rss,args -p “$(fuser / 2>/dev/null)”

  PID  PPID  RSS COMMAND
    0     0    0 sched
    1     0  776 /etc/init -
    2     0    0 pageout
    3     0    0 fsflush
   49     1 1376 /usr/lib/sysevent/syseventd
   56     1 1904 /usr/lib/picl/picld
  127     1 1136 /usr/sbin/inetd -s
  229     1  816 /bin/sh /usr/local/mysql/bin/safe_mysqld --user=mysql --bind-address=127.0.0.1
  165     1  696 /usr/lib/utmpd
  250     1 1280 /usr/lib/ssh/sshd
18312   250 3224 /usr/lib/ssh/sshd
  255     1 1160 /usr/lib/saf/ttymon -g -h -p winnie console login:  -T sun -d /dev/console -l c
  204     1 1824 /usr/sbin/mdmonitord
  251     1 4064 /usr/local/openldap/libexec/slapd -f /usr/local/openldap-common/etc/slapd.conf
 2001     1 1736 /usr/sbin/syslogd -t

Thanks for the awesome trick Pete!

Managing OS X open source packages with fink

fink is an open source package manager for OS X. The fink command allows packages be be installed, removed, and updated relatively easily. As of this writing, there were 2048 open source packages available:

$ fink list | wc -l
2048

To get started with fink, you need to download the latest version from the sourceforge website:

http://fink.sourceforge.net/

Once you download the disk image, you need to run the fink installer. This will create the software directory hierarchy, and set a few variables in your profile. After fink is installed, you can run fink’s “selfupdate” option to grab the latest package list and binary fixes:

$ fink selfupdate

To list all of the available packges, fink can be run with the “list” option:

$ fink list | grep gnupg
gnupg 1.2.4-1 Gnu privacy guard – A Free PGP replacement
gnupg-idea 1.11-4 Gnu privacy guard (v 1.2.4) with IDEA cipher support

To install a specific package, the “install” option can be used:

$ fink install gnupg

This will download, compile and install gnupg under “/sw.” If you wish to remove an installed package, you can use the “purge” or “remove” options:

$fink remove gnupg

Further information can be obtained by running fink with the “–help” option, or by reading through the documentation on the fink website.

Speeding up firefox

As a UNIX and network guy, I try to optimize systems and networks to deliver the most bang for the buck. I recently came across the following post on the Mozilla Zine web forums:

http://forums.mozillazine.org/viewtopic.php?t=53650

This link covers several tunables for Firefox, several of which can significantly speedup page load times (especially when you have a tabbed list of news sites):

network.http.max-connections: This value controls the maximum number of outbound TCP connections. network.http.max-connections accepts an integer value and defaults to 24.

network.http.max-connections-per-server: This value controls the number of concurrent requests to a single site. For sites that contains hundreds of URIs in a single page, this should speedup page load times (barring the remote site isn’t rate limiting inbound connections). network.http.max-connections-per-server accepts an integer value and defaults to 8.

network.http.max-persistent-connections-per-server && network.http.max-persistent-connections-per-proxy: These values control the number of persistent HTTP connections that can be maintainted to a website. Both parameters accept integer values and default to 2 and 4.

network.http.pipelining && network.http.proxy.pipelining: These values control the HTTP 1.1 pipelining feature, which allows multiple HTTP requests to be requested at connection setup. Both parameters accept boolean “true”/”false” values and default to “false.”

network.http.pipelining.maxrequests: This value controls the number of requests that will be issued at connection setup. network.http.pipelining.maxrequests accepts an integer value and defaults to 4.

You can tweak these settings by typing “about:config” into the Firefox navigation toolbar, or by directly editing the user.js preferences file. I picked my current values by adjusting the current values, clearing the cache, and calculating the time it took Firefox to load 50 tabs. I was able to cut 14 seconds off my news site load time by doubling, and sometimes tripling the default values :)