Tille - I can see you, read those man pages!   Tille's Site

Repairing important files in 10 steps

Forgot your root password? Made a silly mistake in the file system table? It will happen, rather sooner than later. Here is what you can do in such situations. In the example below, we have a problem with /etc/system which is on the /dev/dsk/c0t0d0s0 device.

  1. Find Solaris installation media, e.g. the CD's.

  2. Boot from Software CD 1 of 2 in single user mode:

    OK boot cdrom -s
    
  3. Do a file system check on the troubled device before mounting it:

    # fsck /dev/rdsk/c0t0d0s0
    
  4. Mount the device onto a temporary directory on the CD:

    # mount -F ufs /dev/dsk/c0t0d0s0 /a
    
  5. Set your terminal variable so editing files won't have to be done on a single line:

    # TERM=sun
    

    TERM can be any one of your favorite terminal emulations, e.g. TERM=vt100 will also work.

  6. Don't forget to export TERM, this is plain sh, not bash or some other more advanced shell:

    # export TERM
    
  7. Edit the erroneous file:

    # vi /a/etc/system
    

    Take out the errors, write and quit.

    Note that you cannot edit /etc/vfstab, because this is the virtual file system table from the CD-ROM, which is read-only as you know. We need to repair the vfstab from our boot disk, which we just mounted on a temporary directory on the CD.

  8. Change back to a directory on the CD-ROM, e.g. with the cd command with no options.

  9. Unmount your boot disk from the CD:

    # umount /a
    
  10. Reboot the system. Use the init 6 command, not the reboot command!

Home
© 1995-2010 Machtelt Garrels - tille - Powered by vIm - Best viewed with your eyes - Validated by W3C - Last update 20100511