Monday, August 2, 2010

Solaris 10 mirror root

I wonder how many out there have been handed a Solaris 10 system with no free slice for the metadb’s. Sure on older versions of Solaris is easy… disable swap and re-slice it into a smaller swap, and a metadb slice. Well it doesn’t quite work that smoothly in the latest Solaris 10, update 3 as I wrote this, Thanks to there safety code that protects you from re-labeling a mounted drive. Well I’m sure someone is going to mention about “NOINUSE_CHECK=1” environment variable, okay it sounds like its going to work, well in update 3 apparently they wrote a few more checks, and it doesn’t work. So my next thought was pull out an install disk and fix it that way, of course the client hadn’t located his null modem cable and I’m 8000 miles away, and here I am stuck on a ssh login to the machine, and he wants root mirrored with SVM, of course it’s the first thing he drops in my lap and I’m trying to prove I’m not just a over rated quack, I know most of the consultants out their reading this have been there.







So here is what I tried, and the actual solution that everyone can use I’m not going to give the commands and error messages along the way because I didn’t think to save it,.







So first idea is to resize /export/home rather than swap, who knows he may need all his swap, so I disable swap and then told the system not to mount /export/home via the vfstab and then rebooted. Ran format and it bitched about slices being in use, so then I tried with the ‘NOINUSE_CHECK=1 format’ okay started it and it didn’t complain as much so I know the environment variable is doing something so I modify the slices, and try again to write the label, no luck.. I asked on #solaris, and they came up with prtvtoc that gives me a print out of the current partition table in sector format and then you can modify it and write it out using fmthard with the new slices, since I’m a bit under pressure and have never had to resort to editing slices in sectors I tried it a couple times but just couldn’t get the math right for fmthard it kept complaining that the slices didn’t start on the cyclinder boundry, and needed to come up with a better solution.







WARNING: COMMANDS MENTIONED HERE CAN DESTORY DATA AND RUIN YOUR LOVE LIFE, GET YOU FIRED, CAUSE HAIR LOSS, GIVE YOU A HEART ATTACK, EVEN YOUR DOG WILL HATE YOU AND PEE IN YOUR SHOES IF YOU USE THEM WITHOUT KNOWING WHAT YOU ARE DOING AND YOUR DATA IS NOT 100% BACKED UP, NO WARRANTY IS IMPLIED, DON'T BLAME ME NO MATTER WHAT HAPPENS TO YOUR SYSTEM.







The solution I found turns out to be fairly simple.







Step 1: save a copy of the first drives partition table to a text file.



#prtvtoc /dev/rdsk/c0t0d0s2 > oldparttable







Step 2: write it to the drive that will be the mirror and pray that it’s the same specs as the current root drive, well I got lucky and it was the same. It may be necessary to put an SMI label on the drive if its new or had another non Solaris OS on it.







#fmthard –s oldparttable /dev/rdsk/c0t1d0s2







Step 3: use format to modify the slices on the non mounted drive







Step 4: save a copy of the modified table on the non mounted drive







#prtvtoc /dev/rdsk/c0t1d0s2 > newparttable







Step 5: write the new partition table to the mounted drive.







#fmthard –s newparttable /dev/rdsk/c0t0d0s2







Step 6 reboot the system, so it sees the root drive has a new partition table.







Step 7 newfs /export/home slice.







Step 8 modify vfstab to mount /export/home again, restore data thankfully it was a new install so there was no data to restore.







Create the metadb’s and mirror the root slice as documented in numerous other places on the net. So in the end I saved a 4 hour reinstall and was able to complete the task without a serial cable.







DONE.

No comments:

Post a Comment