DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 29th January 2009
bsdme2 bsdme2 is offline
New User
 
Join Date: Jan 2009
Posts: 9
Default Best way to check and fix corrupt disk?

Hi folksss,

What is the best way to check for corrupt sector and fix it on
FreeBSD? I check FSCK to see if there is any option but I can
not find one ... maybe I'm wrong. You know like windows
have scandisk with fix option. My little baby press the reset button
on the computer a couple of time and now the system found
an "incorrect block count I=32 ..." I would like to know if there
are any other way to check and fix this beside FSCK.

Thanks folks.
Reply With Quote
  #2   (View Single Post)  
Old 29th January 2009
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Default

FSCK should fix those errors. Boot into single user and run just bare "fsck" and wait. Depending on the size of your drive and how you partitioned it, it may take a long time.
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!
Reply With Quote
  #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
  #4   (View Single Post)  
Old 29th January 2009
jb_daefo jb_daefo is offline
Spam Deminer
 
Join Date: May 2008
Posts: 303
Default

back using 5.x I always had to boot single-user to fsck properly
...........
now ( using _7, the last 10 or so times) I just boot normally and
it completes fine. Maybe useful to know.
__________________
FreeBSD 13-STABLE
Reply With Quote
  #5   (View Single Post)  
Old 29th January 2009
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Default

Besides file checking, run this one:
sysutils/testdisk

Chances are, when ran a couple of times, that you will implement proper backup|sync procedures
As most of us do, usually we run fsck -y
in the hope evrything gets fixed.

Remember that a hard disk is a table with entries and pointers.
"Formatting" only set those entries as "re-writable".

Proper test is destructive, as most manufacturer's hard drive utilities, but these will actually "zero" your drive, mark bad sectors (in yet another table), eventually give you a report to use for a RMA.
Watch fine prints in the warranty (or browse the manufacturer's site): some drives carry five years (wheter manufacturer's, or national distributor, or local outlet).

I keep a table of serial numbers and dates and test in due time.
__________________
da more I know I know I know nuttin'

Last edited by lvlamb; 29th January 2009 at 01:02 PM.
Reply With Quote
  #6   (View Single Post)  
Old 29th January 2009
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 696
Default

Quote:
Originally Posted by bsdme2 View Post
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.
You can't run fsck on a mounted filesystem. You don't have to drop to single-user mode, but it makes it a lot easier if you do.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Check this out (funny contest). fbsduser Off-Topic 6 4th March 2009 10:48 PM
please check my pf.conf gosha OpenBSD Security 10 30th January 2009 12:32 AM
Disk geometry for Seagate disk phreud FreeBSD Installation and Upgrading 5 8th November 2008 10:51 PM
check for badblocks ccc FreeBSD General 5 30th October 2008 07:00 PM
how to check package dependencies? bsdnewbie999 OpenBSD Packages and Ports 5 31st July 2008 04:05 AM


All times are GMT. The time now is 03:14 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick