Clock battery died on Sun Netra X1, file systems unusable.

I recently had a problem on my 3 year old Sun Netra X1 running Solaris 8. The system hardware clock battery ran out, and the system time reset itself to a crazy date (November 1908). Trying to get the machine running again, I rebooted and fsck'ed the file systems which were marked as bad (probably because they had inode datestamps with pre-epoch dates).

After successfully fscking the file systems, they still would not mount in read/write mode, only read only, and so the machine would not boot in a usable way. All attempts to mount the file systems in read/write mode provoked a "not okay" message.

Searching in Google I found this newsgroup posting which seems to match exactly with my circumstance.

Now an X1 doesn't have a CD-ROM drive, but will use one if you open the case and attach one (in IDE Master mode) to the 2nd IDE interface. Do a "boot -r" from the "ok>" prompt to get the CD-ROM recognised, and a "boot cdrom" with a Solaris 8 or 9 installation disk. Don't proceed with the install, just drop to the mini-root that it sets up in your swap slice.

From the swap slice mini-root you MAY be able to recover things. I was fortunate enough to have enough spare space on my boot drive to create a new file system large enough to hold the contents of any one of my other file systems.

So here's what I did:-
  1. Use "format" to create a slice, (c0t0d0s3 in this example) with enough space.
  2. newfs /dev/dsk/c0t0d0s3
  3. mount /dev/dsk/c0t0d0s3 /mnt
  4. ufsdump 0f - /dev/dsk/c0t0d0s0|(cd /mnt;ufsrestore rf -);
  5. umount /mnt
  6. installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0
  7. newfs /dev/dsk/c0t0d0s0
  8. mount /dev/dsk/c0t0d0s0 /mnt
  9. ufsdump 0f - /dev/dsk/c0t0d0s3|(cd /mnt;ufsrestore rf -);
Now repeat steps 2-9 (except 6) for each other slice (except any "swap", or "unassigned").

That will copy each filesystem to the spare space, clean the original filesystem, and put the contents back.

Worked for me, your luck may vary. It certainly beats having to rebuild from scratch.

Things to learn:
If the clock battery goes on your Sun machine, DON'T fsck until you've replaced the battery and fixed the clock.

Chris Spry's guide to duplicating a drive on a Blade 1000 which is where I nicked the ufsdump/restore stuff from.

Back to Misc Stuff