View Single Post
  #3   (View Single Post)  
Old 29th January 2009
bsdme2 bsdme2 is offline
New User
 
Join Date: Jan 2009
Posts: 9
Default

cajunman4life,

Thanks for the reply.

I just google on how to fix corrupt sector in FreeBSD and I got this
in more detail. I just want to share with all the newbie or anyone how need
this info.

Boot into Single-user mode
Reboot your machine:
# reboot
When you see the initial boot menu, select "Boot FreeBSD in single user mode" (option 4). The kernel will boot up as
usual, but instead of starting all the system processes, only a single root shell will be provided. Hit Enter when you see
this message:
Enter full pathname of shell or RETURN for /bin/sh:
Now check what filesystems are mounted:
# mount
/dev/ad0s1a on / (ufs, local, read-only)
devfs on /dev (devfs, local)
You should see that only "/" (the root filesystem) and the devices under /dev are mounted, and furthermore the root
filesystem is mounted read-only. There are also no virtual consoles and no daemons running. This is the simplest and
safest possible state for the system to be in.
Filesystem repairs
Since the filesystems are not mounted, you can run the filesystem repair tool "fsck" on them (fsck = File System Check).
Its job is to make corrupted filesystems functional again. If individual files have been damaged then they may not be
recoverable, but at least the filesystem will be working again and the other files on it can be accessed.
Firstly, have a look at which partitions are normally mounted; this information is kept in the fie "/etc/fstab"
# cat /etc/fstab
Pick one of these partitions, and run fsck on it. For example, if you decide to check the partition /dev/ad0s1d, then you
would type
# fsck -y /dev/ad0s1d
(The -y flag gives fsck permission to carry out any repairs it suggests). If your filesystem is "clean", that is, it was
unmounted properly at system shutdown, fsck may not do anything. In that case almost certainly it’s not needed, but you
can force it to check the filesystem like this:
# fsck -f -y /dev/ad0s1d
There’s no need to run fsck in single-user mode like this unless during bootup FreeBSD tells you that there’s a filesystem
error which it can’t handle. Make a note of which partition is at fault, reboot into single user mode, and run fsck on that partition only.
Reply With Quote