# Drive lost - Synchronize cache failed



## cosmin (Mar 4, 2013)

Hello guys,

Once a month, precisely on the firsst, my FreeBSD 9.0 box crashes. It is something related to my OS drive which is an IDE 80GB drive on a PCI controller.

Here is the kernel dump:


```
(ada1:ata2:0:1:0): Synchronize cache failed
g_vfs_done():ada0p2[WRITE(offset=37278347264, length=4096)]error = 5
(ada1:ata2:0:1:0): Synchronize cache failed
(ada1:ata2:0:1:0): lost device
(ada0:g_vfs_done():ata2:0:ada0p2[WRITE(offset=37245779968, length=32768)]error = 6
0:0): lost device
g_vfs_done():ada0p2[WRITE(offset=37268750336, length=28672)]error = 6
g_vfs_done():ada0p2[WRITE(offset=37269536768, length=32768)]error = 6
g_vfs_done():ada0p2[WRITE(offset=37269635072, length=32768)]error = 6
g_vfs_done():ada0p2[WRITE(offset=37278347264, length=4096)]error = 6
g_vfs_done():ada0p2[WRITE(offset=34658304, length=512)]error = 6
/dev: got error 6 while accessing filesystem
panic: softdep_deallocate_dependencies: unrecovered I/O error
cpuid = 0
KDB: stack backtrace:
#0 0xffffffff8087214e at kdb_backtrace+0x5e
#1 0xffffffff8083cd07 at panic+0x187
#2 0xffffffff80a54390 at clear_remove+0
#3 0xffffffff808b7690 at brelse+0x60
#4 0xffffffff808ba038 at bufdone+0x68
#5 0xffffffff807d96b6 at g_io_schedule_up+0xa6
#6 0xffffffff807d9c3c at g_up_procbody+0x5c
#7 0xffffffff8081087f at fork_exit+0x11f
#8 0xffffffff80b0d6fe at fork_trampoline+0xe
Uptime: 17d5h26m17s
(ada0:ata2:0:0:0): Synchronize cache failed
(ada1:ata2:0:1:0): Synchronize cache failed
Copyright (c) 1992-2012 The FreeBSD Project.
```

Can somebody tell me what is happening?

Thank you very much.

Cosmin


----------



## Terry_Kennedy (Mar 5, 2013)

cosmin said:
			
		

> Once a month, precisely on the firsst, my FreeBSD 9.0 box crashes. It is something related to my OS drive which is an IDE 80GB drive on a PCI controller.


That's an odd one. It may be triggered by something in the monthly cron(8) jobs. Look in /etc/periodic/monthly/ and /usr/local/etc/periodic/monthly/ to see what your system runs at the beginning of the month.

You might also want to edit /etc/crontab and modify the "periodic monthly" line to run the monthly job soon (in a few minutes) instead of waiting for the next month. If the system fails in the same way with the edited crontab(5), you know what is triggering it and you can run each of the individual pieces to narrow it down.

NOTE: If you use system accounting or other monthly output for business purposes, be aware that you're going to get an "extra" month if you force a monthly run. Also, don't forget to revert any edits you've made after testing.


```
(ada1:ata2:0:1:0): Synchronize cache failed
g_vfs_done():ada0p2[WRITE(offset=37278347264, length=4096)]error = 5
(ada1:ata2:0:1:0): Synchronize cache failed
(ada1:ata2:0:1:0): lost device
...
```

This looks like a problem with the drive, but I don't see why it only happens on the first of the month. Normally I'd suggest installing sysutils/smartmontools, but if the drive is really an IDE model and not PATA, it may be too old to support S.M.A.R.T. Give it a try and see.


----------



## Carpetsmoker (Mar 5, 2013)

> You might also want to edit /etc/crontab and modify the "periodic monthly" line to run the monthly job soon (in a few minutes) instead of waiting for the next month.



That's a good suggestion, but instead of mucking about with your crontab, you can also just type `periodic monthly` in your shell (as root).


----------



## Beastie (Mar 5, 2013)

Terry_Kennedy said:
			
		

> but if the drive is really an IDE model and not PATA, it may be too old to support S.M.A.R.T.


SMART support was added in ATA-3 in the late 90s. I have 10+ year old disks that support it. They just don't support as many attributes as newer disks.


----------



## dum (Dec 26, 2013)

To me it happens the same with HD connected to my PROMISE SATA300 TX4 PCI CARD. But the problem is that it happens everytime I shut down the NAS (Freenas, F*ree*BSD based). It stays like in stand by mode with the "syncronized cache failed" message until I push NAS button to shut down completely. When I turn on again, it works well.


----------

