Andy Reitz (blog)

 

 

Hacking the Solaris partition table

It was our sysadmin's last day with EDS today, and as a result, I now have a systems administration aspect to my job. This means that lately I have noodling around with Sun hardware and software more than I usually do. What follows is the story of how I spent a good chunk of my afternoon:

Due to our local Jumpstart process not properly partitioning the two disks in the E220R that I was trying to build today, I was forced to take matters into my own hands, and fix things manually. Since I'm a hacker at heart, this didn't pose too much of a problem for me. What did pose a problem, however, is getting the E220R box into a position where I could perform surgery on the partition table. Even in single user mode, Solaris refused to unmount /var. Thus, I was forced to find some way to get a non-local version of Solaris running, so that I could perform my surgery.

To my knowledge, Sun doesn't ship any sort of Solaris recovery CD, not even on Solaris 10. Doing a quick Google, I found a few brave souls who have posted instructions for creating your own Solaris recovery CD, but I have things to do, and don't have the time necessary to craft my own CD from scratch. The trick that I know is to boot off of the Solaris install CD, and then break the install process before it gets very far. This can usually net you some sort of shell, which is usually mostly-sortof functional.

When I tried to do this today with a Solaris 10 CD, I found that once the installer started, it mucked with the TTY to the point that when I managed to break it, I couldn't see any characters that I typed, etc. In general, the shell that I got wasn't usable at all. So I tried again, and this time managed to break into the startup sequence before the installer launched, which provided a rather functional shell.

It really seems like Sun should make this easier, however, by providing some sort of bootable recovery CD. This is one of the "rough edges" that Solaris still carries with it, that the Open Source UNIXes have mostly smoothed over. Fortunately, because Sun has given Solaris the Open Source treatment, Sun doesn't necessarily have to provide such a CD -- the community could step up and do it. Another of the advantages of Open Source.

Anyways, after getting my E220R booted off of the CD, I was able to hack the partition table on the boot disk, run newfs, and have a machine with a preserved root partition, but enlarged swap and more importantly, enlarged /var. Mission accomplished, but only after considerable effort.

-Andy.