Thursday, October 11, 2007

Swap Space

So, today I am building a machine to use as a test box for ensuring that our various databases can survive application upgrades, database upgrades, and OS patches that have been accumulating for the last couple of months. A fairly routine install of Solaris 10 on a 280R went well until it came to the swap space.

I never allow Solaris to automatically lay out my filesystems as having a 600MB / slice and a 70GB /export slice is entirely useless in my environment. So, I went ahead and chopped it up as I saw fit and let the installer work its magic.

The came the time to set up the swap slice. I generally install the swap area at slice 0 and use the beginning cylinders of the disk for the space for the sake of speed. Especially on a database machine, that can be important. So, the first thing I do is go into format and add my swap slice. Then I attempt to add the newly made slice to my running swap config:

# swap -a /dev/rdsk/c0t0d0s0
/dev/rdsk/c0t0d0s0: No such file or directory

oops...I should not be using the raw device. I try again, this time using the actual device path:

# swap -a /dev/dsk/c0t0d0s0
/dev/dsk/c0t0d0s0: No such file or directory

What the hell? OK, time for a sanity check:

# man swap
Reformatting page. Please wait.... done

Before reading a word, I realize that I failed to make a filesystem on the newly created slice.

# newfs -v /dev/rdsk/c0t0d0s0
newfs: /dev/rdsk/c0t0d0s0: No such file or directory

Well, this is NO good. Maybe I forgot to write the label when I formatted the disk? A simple check with format shows that the slice is, indeed, still there. Did I use the raw device when attempting the newfs? Let's try again, just to be sure:

# newfs -v /dev/rdsk/c0t0d0s0
newfs: /dev/rdsk/c0t0d0s0: No such file or directory

Damn. What the hell do I do now?

To make it short, I spend the next 45 minutes reading various man pages and web pages to try to figure out what my problem is. I even had an abortive experiment with mkfs, which is not useful in this situation. Then during my umpteenth view of the output from format I see a small detail that I missed. See if you can catch it:

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
0. c1t0d0
1. c1t1d0

Specify disk (enter its number):

Give up?

I tried:

# swap -a /dev/dsk/c0t0d0s0
/dev/dsk/c0t0d0s0: No such file or directory

I was using the wrong damn controller number. The lesson here, ladies and gentlemen, is to PAY ATTENTION to what you are doing so that a 1 minute effort doesn't end up taking a whole hour of your life from you.

Incidentally, if you wanted to make the new swap space permanent across reboots, you would need to add the following line to /etc/vfstab:

/dev/dsk/c1t0d0s0 - - swap - no -

You do not NEED to reboot at this point, but this is a test machine and a new build so I did so anyway.

-TheDave

No comments: