# Savecore rebooting issue.



## manilaboy1vic (Jan 8, 2018)

My freeBSD pc keeps rebooting every single night due to "bad dir" trouble.


```
Jan  8 04:50:17 yeaguy savecore: reboot after panic: ufs_dirbad: /usr: bad dir ino 38850525 at offset 512: mangled entry
Jan  8 04:50:17 yeaguy savecore: writing core to /var/crash/vmcore.9
```

I have attempted to run `fsck` in single user mode to address the issue but it did not seem to resolve the issue.

I also used `smartctl` to see if my hard drive is bad and it seems to pass the test.

Just looking to see if any of the pros can help me out


```
vic@yeaguy[~]$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ada0p2    194G     10G    168G     6%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ada0p3    9.7G    5.1G    3.8G    57%    /var
/dev/ada0p4    3.9G    625M    2.9G    17%    /tmp
/dev/ada0p5    684G    221G    408G    35%    /usr
/dev/ada1p1    484G    175G    271G    39%    /backup
/dev/ada2p1    451G    158G    257G    38%    /storage
/dev/ada2p2    450G    242G    173G    58%    /spare
linprocfs      4.0K    4.0K      0B   100%    /compat/linux/proc
fdescfs        1.0K    1.0K      0B   100%    /dev/fd
procfs         4.0K    4.0K      0B   100%    /proc
vic@yeaguy[~]$ sudo smartctl -a /dev/ada0
Password:
smartctl 6.6 2017-11-05 r4594 [FreeBSD 11.1-RELEASE-p4 amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue
Device Model:     WDC WD10EZEX-60ZF5A0
Serial Number:    WD-WCC1S3965569
LU WWN Device Id: 5 0014ee 25dc978d2
Firmware Version: 80.00A80
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Mon Jan  8 15:21:43 2018 PST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                (10920) seconds.
Offline data collection
capabilities:                    (0x5b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        No Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        ( 126) minutes.
SCT capabilities:              (0x30bd) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   177   173   021    Pre-fail  Always       -       2141
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       163
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002f   200   200   051    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   046   046   000    Old_age   Always       -       39617
 10 Spin_Retry_Count        0x0033   100   100   051    Pre-fail  Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       163
184 End-to-End_Error        0x0033   100   100   097    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   093   000    Old_age   Always       -       7
190 Airflow_Temperature_Cel 0x0022   067   052   040    Old_age   Always       -       33 (Min/Max 28/36)
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       117
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       45
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      6388         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

vic@yeaguy[~]$
```


----------



## SirDice (Jan 9, 2018)

I'm not sure if the issue is on ada0p2 with the actual directory or on ada0p5 where the filesystem is. But something to try in single user mode is to remove that /usr directory (make sure it's not mounted!) from the root filesystem and just recreating it. That would hopefully fix the issue if it's on ada0p2.



manilaboy1vic said:


> I have attempted to run  fsck in single user mode to address the issue but it did not seem to resolve the issue.


Make sure none of the filesystems are mounted, or else it won't be able to fix things. Only the root filesystem should be mounted (read-only).


----------



## manilaboy1vic (Jan 10, 2018)

I think I may have resolved the issue using a tutorial I found online.

http://phaq.phunsites.net/2007/07/01/ufs_dirbad-panic-with-mangled-entries-in-ufs/

I ran through the steps in that link and it marked the filesystem as clean.  Crossing fingers.


----------



## manilaboy1vic (Jan 13, 2018)

No more issues since clearing the bad inodes.  `Uptime` is three plus days.  So glad I did not have to do a fresh install.


----------

