Home / Articles / BSD / FreeBSD / How to repair file system with a system utility fsck in FreeBSD

How to repair file system with a system utility fsck in FreeBSD

How to repair file system with a system utility fsck in FreeBSD
 
  • Currently 0 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 0/5 (0 votes cast)

Thank you for rating!

You have already rated this page, you can only rate it once!

Your rating has been changed, thanks for rating!

Log in or create a user account to rate this page.


This article shows how to use system utility fsck to repair file system in few simple steps.

Boot the system into a single-user mode

This must be selected in the boot menu:

  • Press 4 to select single-user mode in FreeBSD 8;
  • Press 6 then Enter to select single-user mode in FreeBSD 9.

Similar step is described in the article How to reset root password in FreeBSD, but with illustration.

While the system loads in a single-user mode the following message is shown:

Enter full pathname of shell or RETURN for /bin/sh:

Press Enter to run the shell.

Check which file systems are mounted

The following command is especially designed for this purpose:

mount

The output should look something like this:

/dev/ada0s1a on / (ufs, local, read-only)
devfs on /dev (devfs, local)

Make sure that only "/" (root file system) and devices under "/dev" are mounted. Also the root file system must be mounted in the read-only mode.

Read-only is the simplest and safest possible mode for the system.

Since the file systems are not mounted, the system utility fsck ("file system check") can be run on them.

Have a look at the list of normally mounted partitions

Now have a look at the partitions which are normally mounted. The /etc/fstab file contains this information.

cat /etc/fstab

Output:

/dev/ada0s1a    /               ufs     rw      1       1
/dev/ada0s1b    none            swap    sw      0       0
/dev/ada0s1d    /var            ufs     rw      2       2
/dev/ada0s1e    /tmp            ufs     rw      2       2
/dev/ada0s1f    /usr            ufs     rw      2       2

Run fsck for the needed partitions

Choose one of these partitions, and run fsck on it. For example, to check the partition "/dev/ada0s1a", run the following command:

fsck -y /dev/ada0s1a

The -y option gives fsck permission to carry out any repairs it suggests.


 

Read also

Install MySQL server on FreeBSD

Install MySQL server on FreeBSD

Install Apache in FreeBSD

Install Apache in FreeBSD

Discussion (total 2 comments)

tracyweaver
September 26, 2014 at 11:33 pm
Recovery Software that recovers your lost, missing, and inaccessible files from any UFS file system based Sun Solaris-Intel hard drive.
Try:- http://www.filesrecoverytool.com/bsd-data-recovery.html
TimmyMyers
October 14, 2014 at 03:06 am
Try your most trusted search engine to learn about bsd recovery software. http://www.undeletepcfiles.com/bsd-data-recovery-software.html

Post comment

easyos.net
117217982212577402640

Quick navigation

General navigation