Stuff I Liked or Use

Take it easy, but take it.

My .emacs file

without comments

As a seemingly eternal-beginner emacs user (there’s lots to learn), I
always appreciate seeing other .emacs files out there to get some
ideas. Here’s some of mine.

;; My .emacs
;; Time-stamp: <2008-11-28 20:14:23 brad@macbook-wireless .emacs>

;; Good .emacs references
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; http://www.emacswiki.org/emacs/InitFile

;; General Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d")   ; My lisp files
(fset 'yes-or-no-p 'y-or-n-p)           ; Tired of typing 'yes'
(setq inhibit-startup-message t)        ; No startup screen
(global-font-lock-mode t)        	; Color syntax highlighting
(setq font-lock-maximum-decoration t)   ; Color as much as possible
(auto-compression-mode t)               ; Handle compressed files easily

;; Backup/Autosave
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; (orig. from http://jaderholm.com/configs/emacs)
; This will keep all backup/autosafe files in one location - much cleaner.
(defvar backup-dir (expand-file-name "~/.emacs.d/.emacs.backup/"))
(defvar autosave-dir (expand-file-name "~/.emacs.d/.emacs.autosave/"))
(setq backup-directory-alist (list (cons ".*" backup-dir)))
(setq auto-save-list-file-prefix autosave-dir)
(setq auto-save-file-name-transforms `((".*" ,autosave-dir t)))

;; Org-mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Load my own version (instead of site version)
(add-to-list 'load-path "~/.emacs.d/org-mode/lisp")
(require 'org-install)

; Associate org-mode w/.org files
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) 

; Easily follow links (i.e. no mouse)
(setq org-return-follows-link t)

; Let me get to some org commands from anywhere
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)

; Track state changes
(setq org-log-done t)
; I like to always track, but you can set this per file,
; See docs section 6.5.2:
; Very likely you do not want this verbose tracking all the time, so
; it is probably better to configure this behavior with in-buffer
; options. For example, if you are tracking purchases, put these into
; a separate file that starts with:
;     #+SEQ_TODO: TODO ORDERED INVOICE PAYED RECEIVED SENT
;     #+Startup: lognotestate

; Set default TODO states, basic
;(setq org-todo-keywords '("TODO" "NEXT" "STARTED" "WAIT" "DONE"))   

; Set default TODO states, with fast selection and state tracking
; from http://article.gmane.org/gmane.emacs.orgmode/6082
(setq org-use-fast-todo-selection t)
(setq org-todo-keywords
       '((sequence "TODO(t!/!)" "NEXT(n)" "|" "DONE(d!/!)")
 	(sequence "WAITING(w@/!)" "|" "CANCELLED(c!/!)")
 	(sequence "SOMEDAY(S!/!)" "|")
 	(sequence "STARTED(s!/!)" "|")
 	(sequence "DELEGATED(D@/!)" "|")
 	(sequence "OPEN(O!)" "|" "CLOSED(C!)")
 	(sequence "ONGOING(o)" "|")))
; above keyword definitions requires org-log-done or similar set in
; file, see further above

; Can I set it to require a comment coming out of a state? e.g. SOMEDAY(S@!/@!)

; Pretty up my keywords
(setq org-todo-keyword-faces
      '(("TODO"  . (:foreground "red" :weight bold))
 	("NEXT"  . (:foreground "red" :weight bold))
 	("DONE"  . (:foreground "forest green" :weight bold))
 	("STARTED"  . (:foreground "purple" :weight bold))
 	("WAITING"  . (:foreground "orange" :weight bold))
 	("DELEGATED"  . (:foreground "orange" :weight bold))
 	("CANCELLED"  . (:foreground "forest green" :weight bold))
 	("SOMEDAY"  . (:foreground "blue" :weight bold))
 	("OPEN"  . (:foreground "red" :weight bold))
 	("CLOSED"  . (:foreground "forest green" :weight bold))
 	("ONGOING"  . (:foreground "orange" :weight bold))))

; Default agenda file locations
(load-library "find-lisp")
(setq org-agenda-files (find-lisp-find-files "~/org" "\.org")) 

; Misc agenda settings
(setq org-deadline-warning-days 8)      ; Don't warn me too far out
(setq org-agenda-include-diary t)       ; show diary entries

; highlight current item in agenda mode
(add-hook 'org-agenda-mode-hook '(lambda () (hl-line-mode t)))  

; Don't show done tasks in agenda
(setq org-agenda-skip-scheduled-if-done t)
(setq org-agenda-skip-deadline-if-done t)

; Exclude scheduled items from the global TODO list.
(setq org-agenda-todo-ignore-scheduled t)

; Following three functions are to switch between two org-agenda-files
; lists, so I can have home and work in separate places.  I don't
; want to have to tag everything as home/work.  Maybe someday.

(defun gohome ()
  (interactive)
;  (setq org-agenda-files (file-expand-wildcards "~/org/*.org"))
  (setq org-agenda-files (find-lisp-find-files "~/org/home" "\.org"))   ; recurse down
)

(defun gowork ()
  (interactive)
 (setq org-agenda-files (find-lisp-find-files "~/org/work" "\.org"))
)

(defun goall ()
  (interactive)
  (setq org-agenda-files (find-lisp-find-files "~/org" "\.org"))
)

; Keep clocks running across sessions
; As of Org version 6.11, clock-related data can be saved and resumed
; across Emacs sessions The data saved include the contents of
; `org-clock-history', and the running clock, if there is one. (From
; release notes)
(setq org-clock-persist t)
(setq org-clock-in-resume t)
(org-clock-persistence-insinuate)

; Make it easy to open my org files.
; plan.org just has links to frequently-used .org files.
(defun plan ()
   (interactive)
   (find-file "~/org/plan.org")
)
(global-set-key (kbd "C-c p") 'plan)   

; Tags I use (but I don't tag much), others are generally per-file.
(setq org-tag-alist '(
		      ("perl" .?p)
		      ("buy" .?b)
		      ("solaris" .?s)
		      ("unix" .?u)
		      ("emacs" .?e)
		      ("org-mode" .?o)

))

; http://www.gnu.org/software/emacs/manual/html_node/org/Remember-templates.html
; http://sachachua.com/wp/2007/12/28/emacs-getting-things-done-with-org-basic/
; http://members.optusnet.com.au/~charles57/GTD/remember.html
(setq org-remember-templates '(
	("Tasks" ?t "* TODO %?\n  %U\n" "~/org/Remember.org" "Tasks")
	("WorkTODO" ?w "* TODO %?\n  %U\n" "~/org/work/IBM.org" "Remembered Tasks")
	("Link" ?l "* %?\n  %i\n  %a" "~/org/Remember.org" "Links")
	("Stuff" ?s "* %?\n  %i\n  %U" "~/org/Remember.org" "Stuff")
        ("Appointments" ?a "* Appointment: %?\n%^T\n%i\n  %a" "~/org/Remember.org")
        ("Journal" ?j "* %U %?\n\n  %i" "~/org/Journal.org")
        ("Idea" ?i "* %^{Title}\n  %i\n  %a" "~/org/Remember.org" "New Ideas")
        ("EmacsTip" ?e "* %?\n  %i\n" "~/org/EmacsTips.org")
))

; Below to hook the templates into remember
(setq remember-annotation-functions '(org-remember-annotation))
(setq remember-handler-functions '(org-remember-handler))
(eval-after-load 'remember
  '(add-hook 'remember-mode-hook 'org-remember-apply-template))

(global-set-key (kbd "C-c r") 'remember)    ; get to remember from anywhere

; Set footnote-prefix in footnote.el to C-c F to not stomp org mode
; Had to set this in my own site footnote.el file, actually.  Gotta
; find out why I can't remap here.
;(defvar footnote-prefix [(control ?c) ?F]
;  "*When not using message mode, the prefix to bind in `mode-specific-map'")

; http://orgmode.org/worg/org-hacks.php#sec-9
; Remove time grid lines that are in an appointment

;(defun org-time-to-minutes (time)
;  "Convert an HHMM time to minutes"
;  (+ (* (/ time 100) 60) (% time 100)))
;(defun org-time-from-minutes (minutes)
;  "Convert a number of minutes to an HHMM time"
;  (+ (* (/ minutes 60) 100) (% minutes 60)))
;(defadvice org-agenda-add-time-grid-maybe (around mde-org-agenda-grid-tweakify
;                                                  (list ndays todayp))
;  (if (member 'remove-match (car org-agenda-time-grid))
;      (flet ((extract-window
;              (line)
;              (let ((start (get-text-property 1 'time-of-day line))
;                    (dur (get-text-property 1 'duration line)))
;                (cond
;                 ((and start dur)
;                  (cons start
;                        (org-time-from-minutes
;                         (+ dur (org-time-to-minutes start)))))
;                 (start start)
;                 (t nil)))))
;        (let* ((windows (delq nil (mapcar 'extract-window list)))
;               (org-agenda-time-grid
;                (list (car org-agenda-time-grid)
;                      (cadr org-agenda-time-grid)
;                      (remove-if
;                       (lambda (time)
;                         (find-if (lambda (w)
;                                    (if (numberp w)
;                                        (equal w time)
;                                      (and (>= time (car w))
;                                           (< time (cdr w)))))
;                                  windows))
;                       (caddr org-agenda-time-grid)))))
;          ad-do-it))
;    ad-do-it))
;(ad-activate 'org-agenda-add-time-grid-maybe)

;; Remember mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Make sure we have it
(add-to-list 'load-path "~/.emacs.d/remember")
(require 'remember)

;; Git
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Commit org files to git repository after save

(defun git-commit ()
  (when (or
	 (eq major-mode 'org-mode)
;	 (eq major-mode 'cperl-mode)
;	 (eq major-mode 'sh-mode)
	 (eq major-mode 'emacs-lisp-mode))
    (shell-command "git commit -a -m 'Auto commit.'")))
; Set a name for each revision, maybe just the date?

(add-hook 'after-save-hook 'git-commit)

;; Diary
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Sort my diary entries nicely while I'm at it (calendar mode, which I
; rarely use.  But it sounded cool.  :)
; http://www.emacswiki.org/cgi-bin/wiki/DiaryMode
(add-hook 'list-diary-entries-hook 'sort-diary-entries t)

;; weblogger.el, easy posting to wordpress
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/weblogger")
(require 'weblogger)

;; Misc little functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; easy-open .emacs
(defun myemacs ()
  (interactive)
  (find-file "~/.emacs.d/init.el"))
(defun doemacs ()
  (interactive)
  (load-file "~/.emacs.d/init.el"))

; I use an org remember template now, so this is lonely...
(defun journal ()
  (interactive)
  (find-file "~/Documents/books/journal.txt")
  (end-of-buffer)
  (insert "\n\n")
  (insert "*")
  (insert-time)
  (insert "\n\n"))

;; writeroom
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Just for Aquamacs at home, low-distraction style
(defun writeroom ()
  "Switches to a WriteRoom-like fullscreen style"
  (interactive)
  (when (featurep 'aquamacs)
					; switch to Garamond 36pt
    (set-frame-font "-apple-garamond-medium-r-normal--18-180-72-72-m-360-iso10646-1")
					; switch to white on black
    (color-theme-initialize)
    (color-theme-clarity)
					; switch to fullscreen mode
    (aquamacs-toggle-full-frame)))

;; fill-buffer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;http://www.dotfiles.com/files/6/409_.emacs_1
(defun fill-buffer ()
  "Fill each of the paragraphs in the buffer."
  (interactive)
  (let ((beg (point-min))
	(end (point-max)))
    (fill-region beg end)))

;; timestamper
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Really, what I want is to make this mode-sensitive.  So, if in
; emacs-lisp, do ;comment, in perl do #, in html blah blah

(defun insert-date-time ()
 (interactive)
  (insert (format-time-string "#@%Y-%m-%d %H:%M:%S "))
  (insert (user-login-name))  (insert "@")
  (insert (system-name))
)
(global-set-key "\C-ct" 'insert-date-time)  ; C-c 'time'

(defun insert-time-only ()
 (interactive)
  (insert (format-time-string "%H:%M:%S "))
)
(global-set-key "\C-cn" 'insert-time-only)   ; C-c 'now'

;; Time-stamp hook, autotimestamp files
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %u@%s %f")
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-line-limit 16)

; And insert stamp hook where I want it
(defun stamp ()
  "Insert Time-stamp hook at point."
  (interactive "*")
  (insert "Time-stamp: <>")
  (time-stamp)
  )

;; Bcrypt open file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun open-encrypted-file (fname)
  (interactive "FFind file: n")
  (let ((buf (create-file-buffer fname)))
    (shell-command
     (concat "echo " (read-passwd "Decrypt password: ") " | bcrypt -o " fname)
     buf)
    (set-buffer buf)
    (kill-line)(kill-line)
    (toggle-read-only)
    (not-modified))
  )

;; epg stuff (gpg for Emacs)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/epg")
(require 'epa-setup)
; M-x epa- to browse options

; transparent, automatic encryption
(epa-file-enable)

;; w3m
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; http://emacs-w3m.namazu.org/
(add-to-list 'load-path "~/.emacs.d/emacs-w3m")
(require 'w3m-load)
(setq w3m-use-cookies t)   

;; emacsserver
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(server-start)

Written by Brad

November 18th, 2008 at 10:26 pm

Posted in Uncategorized

Using RAID 6 on the Sun StorageTek 6140 Array

without comments

Written by Brad

October 14th, 2008 at 10:38 pm

Posted in Computing, Solaris

Tagged with , , , , , ,

Configuring Solaris MPxIO for use with SVC Vdisks

without comments

See information below:

http://www-01.ibm.com/support/docview.wss?rs=0&uid=ssg1S1002938

This basically means you can’t load balance prior to SVC 4.2

Written by Brad

October 14th, 2008 at 9:55 pm

Posted in Computing, Solaris

Tagged with , , , , ,

Posting to WordPress from Emacs

without comments

See it all here ->
http://www.tolchz.net/2008/01/06/posting-to-wordpress-with-emacs-webloggerel/

To post:weblogger-start-entry
C-x C-s to save and submit
C-c C-c to save as draft

To edit:weblogger-fetch-entries
Next: C-c C-p
Prev C-c C-n

Written by Brad

October 14th, 2008 at 9:17 pm

Oracle Coherence on Solaris 10

without comments

In the process of tracing down some performance issues with Oracle Coherence, I ran across the following other possibly-related TODOs.

Sun Alert 102712/201290 Fixed in patch 118833-30+ (sparc), 118855-30+(x86), or add set ip:dohwcksum=0 to /etc/system

Sun Alert 102714/210256 Fixed in patch 118822-21+ and without 125100-10 (sparc), 118844-21+ and without 125101-10 (x86)


General best practices for Oracle Coherence


From http://wiki.tangosol.com/display/COH34UG/Performance+Tuning

ndd -set /dev/udp udp_max_buf 2096304

Coherence expects a 1500 byte MTU, so default packet size of 1468.  Nothing scary there.


From http://wiki.tangosol.com/display/COH34UG/Deployment+Considerations+-+Sun+JVMs
Check on garbage collection in Sun JVM

Written by Brad

October 14th, 2008 at 12:52 pm

Posted in Computing, Solaris

Tagged with ,

Embedding clips from Google Books into a web page

without comments

Written by Brad

September 22nd, 2008 at 5:03 pm

Posted in Blogging, Computing

Economist Jokes

without comments

Culled largely from http://freakonomics.blogs.nytimes.com/2008/09/15/our-daily-bleg-econ-jokes-needed


The First Law of Economics:

For every economist, there is an equal and opposite economist.

The corollary:
They’re both wrong.


This was originally about a mathematician, a physicist, and an engineer but I will adapt it.

An economist, a sociologist and a psychologist were walking down the street and passed a butcher shop which had a sign in the window which said: Psychologists brains $25/lb, Sociologists brains $50/lb, Economists brains $100/lb.

The economist was elated and said to his friends, “See, I always told you economists’ brains were higher quality than yours.” He then insisted that they ask the butcher how he had reached the same conclusion.

The three then entered the shop. When the economist asked the butcher why the economist brains were so much more valuable than the others, the butcher replied, “Listen, do you realize how many economists you have to kill to get a pound of brains?”


Three economists decide that they want to go deer hunting. They do a whole slew of research, and finally come up with the perfect place and time to catch a deer while everybody they know is snickering at their efforts. So, on the appointed day, at the appointed time, they set out to the forest with their gear and walk to the appointed clearing, and sure enough, there’s a ten-point buck standing there.

The first economist takes aim at the buck and fires: BLAM! He misses just to the right of the buck. The buck lifts its head, but isn’t scared off by the noise.

Now, the second economist takes aim at the buck and fires: BLAM! He misses just to the left! Still, the buck seems untroubled by the noise.

The third economist takes aim at the buck, carefully lining up his sights, and fires: BLAM! His shot goes just over the top of the buck.

All of the economists look at eachother and yell out “Success!”


A lady sent her little boy off to Sunday School. She gave him two dimes–one for the offering and one for himself.

But along the way, he tripped and one of the dimes got away from him and rolled down a storm drain. He could not retrieve it.

After church, when he returned home, his mother asked him about his day.

“On the way to church, I lost God’s dime.”

“What? How did you know it was God’s dime?”

“‘Cause the other one was mine!”


How can you tell an extroverted economist from an introverted one? The extrovert looks at YOUR shoes when he’s talking to you.


What do you call a bus full of economists with one empty seat going over a cliff?  A lost opportunity.


This one is a Physics joke, but is easily adaptable.

There is this farmer who is having problems with his chickens. All of the sudden, they are all getting very sick and he doesn’t know what is wrong with them. After trying all conventional means, he calls a biologist, a chemist, and a physicist to see if they can figure out what is wrong. So the biologist looks at the chickens, examines them a bit, and says he has no clue what could be wrong with them. Then the chemist takes some tests and makes some measurements, but he can’t come to any conclusions either. So the physicist tries. He stands there and looks at the chickens for a long time without touching them or anything. Then all of the sudden he starts scribbling away in a notebook. Finally, after several gruesome calculations, he exclaims, ‘I’ve got it! But it only works for spherical chickens in a vacuum.’


from the preface to Paul Krugman’s book, “Peddling Prosperity: Economic Sense and Nonsense in the Age of Diminished Expectations” (1994, page xi): An Indian-born economist once explained his personal theory of reincarnation to his graduate economics class. “If you are a good economist, a virtuous economist,” he said, “you are reborn as a physicist. But if you are an evil, wicked economist, you are reborn as a sociologist.”


Two men are flying in a captive balloon. The wind is ugly and they come away from their course and they have no idea where they are. So they go down to 20 m above ground and ask a passing wanderer. “Could you tell us where we are?”

“You are in a balloon.”

So the one pilot to the other:

“The answer is perfectly right and absolutely useless. The man must be an economist”

“Then you must be businessmen”, answers the man.

“That’s right! How did you know?”

“You have such a good view from where you are and yet you don’t know where you are!”


Written by Brad

September 17th, 2008 at 7:19 am

Posted in Uncategorized

Socotra Island

without comments

Follow the link after the photo below for some more amazing photos.

null

Socotra Island photos – at Dark Roasted Blend blog

Written by Brad

September 4th, 2008 at 8:41 pm

Posted in Photography

Splitting a Sun 6140 array volume in two with Sun Cluster 3.x and samfs

without comments

The goal here is to take this:

dbnode51# df -h /global/u02
Filesystem             size   used  avail capacity  Mounted on
archives               360G   7.3G   353G     3%    /global/u02

and split it into u02 and u03, each 125G in size.

So it appears I am forced to backup the filesystem, remove the volume on the 6140, make two smaller ones, and recreate everything.

I checked with Sun to see if there’s an easier way, but reportedly there’s no way to shrink an existing volume, or to break off the mirror halves, create my new setup on the old half, and then copy data/resync.  Much like the old Raid Manager stuff.  Not sure why they think all this extra management stuff on the 6140 is worth it, but I guess it’s good for sales.

Anyway, here we go.

First, backup qfs volumes with qfsdump

Usage: qfsdump [-dHqTvD] [-b size] [-B size] [-I include_dir] [-X excluded_dir] -f dump_file [file...]

and do it again with tar, since I am not as familiar with qfsdump as I am with tar.  You know, just in case.

Take resource groups offline for anything that uses the filesystems in question.  See Sun Cluster 3.x reference page to see how to do that.  Then unmount your old filesystem.

(For me, the next issue was that I couldn’t manage the array via CAM nor sscs. Neither controller will talk to me over the network.  Nor will it respond to any pings/telnet/etc.  This has happened on and off and Sun hasn’t figured it out yet.  Reportedly there is a secret Sun reset procedure (http://forums.sun.com/thread.jspa?threadID=5301953) to reset the controllers without restarting the whole array, but it requires a ’secret’ password.  We’ll just restart the array for now and return to our story.  You can also set up in-band management – over the Fibre instead – expect a post on that once I get it working.  Thin docs on that too.)

Here’s the info on my old volume from CAM.

Name: archives
 World Wide Name: 60:0A:0B:80:00:2A:0D:FE:00:00:0B:78:48:00:85:7E
 Type: Standard
 Capacity: 408.000 GB
 Virtual Disk: 3
 Pool: Testpool
 RAID Level: 1
[snip]

So, click through CAM and delete the old, create two new ones assigned to my old vidisk (3). map to our hostgroup, and watch it get assigned lun 5 for the new smaller archives, and lun6 for the new archives3 (to be mounted on /global/u03)

Next, time for scdidadm.  From before:

# scdidadm -l
4        dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B6E48008436d0 /dev/did/rdsk/d4
5        dbnode51:/dev/rdsk/c0t0d0    /dev/did/rdsk/d5
6        dbnode51:/dev/rdsk/c5t2000001862EF4E9Cd0 /dev/did/rdsk/d6
7        dbnode51:/dev/rdsk/c5t2000001862F7F654d0 /dev/did/rdsk/d7
8        dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B784800857Ed0 /dev/did/rdsk/d8
9        dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B7548008520d0 /dev/did/rdsk/d9
10       dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B704800847Cd0 /dev/did/rdsk/d10
11       dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B6C4800838Ad0 /dev/did/rdsk/d11
12       dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B73480084BEd0 /dev/did/rdsk/d12
8186     dbnode51:/dev/rmt/2          /dev/did/rmt/6
8187     dbnode51:/dev/rmt/1          /dev/did/rmt/5
8188     dbnode51:/dev/rmt/0          /dev/did/rmt/4

Now run, on all nodes.

devfsadm && scdidadm -r && scdidadm -C
scgdevs

Depending on your exact circumstances, you may/may not need -C.  These steps, simply put, rescan devices (devfsadm), rescan and make new DID devices (scdidadm -r), clean out old DID devices (scdidadm -C), update cluster global devices (scgdevs).

If you’re not removing, don’t use -C.  If you stumbled across this looking for disk replacement commands, don’t use scdidadm -C to clear, use -R d## instead.

After running the above, you get

4        dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B6E48008436d0 /dev/did/rdsk/d4
5        dbnode51:/dev/rdsk/c0t0d0    /dev/did/rdsk/d5
7        dbnode51:/dev/rdsk/c5t2000001862F7F654d0 /dev/did/rdsk/d7
9        dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B7548008520d0 /dev/did/rdsk/d9
10       dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B704800847Cd0 /dev/did/rdsk/d10
11       dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B6C4800838Ad0 /dev/did/rdsk/d11
12       dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B73480084BEd0 /dev/did/rdsk/d12
13       dbnode51:/dev/rdsk/c5t600A0B80002A0E2A00000BE548BE67CFd0 /dev/did/rdsk/d13
14       dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000CAE48BE686Ed0 /dev/did/rdsk/d14
8186     dbnode51:/dev/rmt/2          /dev/did/rmt/6
8187     dbnode51:/dev/rmt/1          /dev/did/rmt/5
8188     dbnode51:/dev/rmt/0          /dev/did/rmt/4

DID id 6 is gone (old archives) and 13/14 are added (new archives and archives3.  Compare WWN versus CAM to see which is which versus your naming convention.)

Now that the devices are there, let’s get the filesystems ready.

First, update the master config file for samfs.

From before”

# cat /etc/opt/SUNWsamfs/mcf
archives    20    ma    archives    on     shared
/dev/did/dsk/d8s0    21    mm    archives    on
/dev/did/dsk/d8s6    22    mr    archives    on
database    40    ma    database    on    shared
/dev/did/dsk/d4s0    41    mm    database    on
/dev/did/dsk/d4s6    42    mr    database    on

It wants two devices, one for it’s database and one for the actual data.  I would imagine you can split these elsewhere, but this is how SunPS had set ours up.

So, let’s check out existing filesystem ‘database’ (one of the samfs volumes we didn’t wipe), also known as dbnode51:/dev/rdsk/c5t600A0B80002A0DFE00000B6E48008436d0 /dev/did/rdsk/d4 and see what the partition table looks like on there.

Part      Tag    Flag     First Sector         Size         Last Sector
0        usr    wm                34       40.00GB          83886113
1 unassigned    wm                 0           0               0
2 unassigned    wm                 0           0               0
3 unassigned    wm                 0           0               0
4 unassigned    wm                 0           0               0
5 unassigned    wm                 0           0               0
6        usr    wm          83886114      359.99GB          838844381
8   reserved    wm         838844382        8.00MB          838860765

So let’s slice our new d13 and d14 similarly.  Go into format, find the new devices based on the WWN from CAM.  (Or just format the ones that need labeling, those’ll be your new ones. ; )

Part      Tag    Flag     Cylinders         Size            Blocks
0       root    wm       0 -  3839       15.00GB    (3840/0/0)   31457280
1       swap    wu       0                0         (0/0/0)             0
2     backup    wu       0 - 37117      144.99GB    (37118/0/0) 304070656
3 unassigned    wm       0                0         (0/0/0)             0
4 unassigned    wm       0                0         (0/0/0)             0
5 unassigned    wm       0                0         (0/0/0)             0
6        usr    wm    3840 - 37115      129.98GB    (33276/0/0) 272596992
7 unassigned    wm   37116 - 37117        8.00MB    (2/0/0)         16384

You will notice that the old table doesn’t have slice 2, and mine does. Doesn’t appear to matter.

Now update /etc/opt/SUWsamfs/mcf as such, on all servers.  Be sure to use your own new did numbers, not mine.  Don’t re-use the sequence numbers (or whatever they’re called – the 40/41/42, etc.)  And watch your mm/mr.

archives        20      ma      archives        on      shared
/dev/did/dsk/d13s0      21      mm      archives        on
/dev/did/dsk/d13s6      22      mr      archives        on
database        40      ma      database        on      shared
/dev/did/dsk/d4s0       41      mm      database        on
/dev/did/dsk/d4s6       42      mr      database        on
archives3       30      ma      archives3       on      shared
/dev/did/dsk/d14s0      31      mm      archives3       on
/dev/did/dsk/d14s6      32      mr      archives3       on

then, on all servers, run

# samd config
# cp /etc/opt/SUNWsamfs/hosts.archives /etc/opt/SUNWsamfs/hosts.archives3

Just do these next two on one server that is mounting your filesystem.  The -S is for ’shared’.

# sammkfs -S archives
Building 'archives' will destroy the contents of devices:
                /dev/did/dsk/d13s0
                /dev/did/dsk/d13s6
Do you wish to continue? [y/N]y
total data kilobytes       = 136298496
total data kilobytes free  = 136298432
total meta kilobytes       = 15728640
total meta kilobytes free  = 15727856
# sammkfs -S archives3

and then add archives3 to vfstab on all servers.

archives3       -       /global/u03     samfs   -       no      shared

Next, make mountpoints and mount the new filesystems on all.  Watch your underlying permissions (classic error I make. ; )

# mkdir /global/u03; chmod 755 /global/u03; mount archives3

Then qfsrestore the old files to one of the new filesystems, then rearrange as desired.

Now, just create your new resources for the cluster for the new filesystem, and re-enable your resources.

See Sun Cluster 3.x reference page to see how to do that.

Written by Brad

September 3rd, 2008 at 5:51 pm

Posted in Computing, Solaris

Bike jersey with speed display

without comments

http://www.mykle.com/msl/?p=10

Very cool – wheel sensor, some electronics and glowing wire, shows your speed on the back of the shirt.

Written by Brad

August 20th, 2008 at 10:42 pm

Posted in Geeky Stuff