Remember the golden rule of fsck: Never fsck a mounted filesystem! Always unmount the filesystem before attempting an fsck, or you will lose data. Since the root filesystem cannot be unmounted, you must boot to alternate media (cd-rom or network) to perform the fsck
- Drop to the open boot prom
- Boot to single user mode from cd-rom or network:
- Perform the fsck - You need to know the controller, target, drive, and slice of the root filesystem:
- If the filesystem is mirrored with SVM, you should fsck both halves of the mirror:
- If fsck reports errors, run it again until the filesystem is clean
- If fsck still can't fix the errors, get a list of alternate superblocks:
- Perform the fsck using an alternate superblock - The example below uses the first alternate superblock (32):
- If it still doesn't work, you're pretty much screwed
ok} boot cdrom -s
# fsck -y /dev/rdsk/c0t0d0s0
# fsck -y /dev/rdsk/c0t1d0s0
# newfs -N /dev/rdsk/c0t0d0s0
# fsck -y -F ufs -o b=32 /dev/rdsk/c0t0d0s0