Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

clear_drive_error

Clear Synology DSM drive error history so Storage Manager will accept a disk again.

Author: Zilloww
Inspired by 007revad/Synology_clear_drive_error.


When this helps

DSM can mark a disk Critical and refuse Repair, even when S.M.A.R.T. looks fine.

Typical case:

  • Storage pool is degraded
  • One disk is Critical / kicked from the array
  • Raw S.M.A.R.T. (5 / 197 / 198 / 199) is clean
  • Repair says the disk does not meet requirements (must be Healthy)

DSM stores that judgment in sqlite DBs under /var/log/synolog/. This script deletes all history for the selected serial across disk / test / health DBs. It does not fix hardware.


Before you run it

Worth trying only if the disk looks like a false positive / transient glitch, not a dying drive.

Prefer yes if:

  • Reallocated / Pending / Uncorrectable / CRC raw values are 0 (or stable)
  • Extended S.M.A.R.T. passes (or you plan to run one after clearing)
  • You understand you are wiping DSM’s memory of past errors for that serial

Prefer no if:

  • SMART is already bad and getting worse
  • The disk keeps dropping / reconnecting
  • You have no backup of data you care about
  • You are not comfortable with root SSH on the NAS

Risk reminder (RAID 5 / SHR-1): while degraded or rebuilding you have no redundancy. A second disk failure can kill the volume. Rebuilding on the same disk vs a new one: same catastrophe risk; same disk has a higher chance of rebuild abort / re-kick.


Install

scp -O clear_drive_error.sh user@NAS_IP:~/scripts/

ssh user@NAS_IP
sudo -i
chmod +x /var/services/homes/USER/scripts/clear_drive_error.sh

Needs: SSH, admin/root, sqlite3.


Usage

./clear_drive_error.sh --list
./clear_drive_error.sh --dry-run
./clear_drive_error.sh

Pick the drive from the menu (model|serial). Use --yes to skip the final confirmation.

Flag Meaning
-l, --list List drives with err/warning history
-n, --dry-run Preview only
-y, --yes No confirmation prompt

Always clears everything for that serial. Backups are written as *.bak.<timestamp> before any write.


Full repair flow

  1. Confirm pool degraded, note slot + serial, check SMART raw values.
  2. Clear history
    ./clear_drive_error.sh --dry-run   # pick the drive, preview
    ./clear_drive_error.sh            # pick the drive, confirm
  3. Reseat cleanly
    • Deactivate if the Action exists (often missing when already Critical — fine)
    • Pull the disk
    • Reboot without that disk
    • Reinsert in the same bay
  4. Expect Healthy / Not initialized / unused in Storage Manager.
  5. Soak (recommended) before Repair:
    • Leave the disk in, do not Repair yet
    • Run an extended S.M.A.R.T. test
    • Next day, check for new errors:
      sqlite3 /var/log/synolog/.SYNODISKDB \
        "SELECT datetime(time,'unixepoch','localtime'),level,msg FROM logs \
         WHERE serial='SERIAL' AND level IN ('err','warning') \
         ORDER BY time DESC LIMIT 30;"
  6. Repair the storage pool only if still Healthy and no new unc / ioerr / timeout / idnf.
  7. After rebuild: wait for Healthy, then run a data scrub.

If Repair still refuses: repeat pull → reboot empty → reinsert. Last resort (experts only): manual mdadm --add — easy to brick the array if you pick the wrong device.


Disclaimer

Use at your own risk. This edits internal DSM databases, is not an official Synology tool, and will not save a failing drive. Wrong target, bad timing, or a rebuild you do not understand can mean downtime or data loss.

You should know what a degraded RAID means and ideally have a backup of anything you cannot lose before you click Repair.

If unsure: stop, replace the disk, or get help.

About

Clear Synology DSM Critical drive flags so Storage Manager will accept a disk again.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages