How to fix the ufs_dirbad: bad dir error in FreeBSD

 

 

 

Once, when turning on my FreeBSD 10.2 Desktop, I saw this panic error: ufs_dirbad: /usr/user/home: bad dir and the system did not start.

 

I was scared for the disk, I thought it was unusable.

 

But when I ran the fsck -y command in the single, it went without problems.

 

I rebooted and rebooted in single.

 

And the following helped me.

 

Let's see what you are registered in the fstab file

 

this can be done by executing the command

 

# cat /etc/fstab

 

Let's see how the partition is mounted /usr/user/home I have it mounted on the device /dev/ada1p2

 

Let's run the file system check again only now like this:

 

# fsck -t ufs - y /dev/ada1p2

 

Now fsck finds errors and fixes them, reboot.

 

After rebooting my FreeBSD Desktop booted without problems and mounted /usr/user/home

 

To automatically start fsck, add in /etc/rc.conf the following:

 

fsck_y_enable="YES"