# USB flash data rot



## covacat (Nov 15, 2021)

I have an old bootable stick.
After 8 years data has changed slightly, enough to panic at every boot (privileged instruction fault in kernel mode).
Changed mobo/memory/cpu and whatnot until i figured it out.
no fsck errors, no surface scan errors
the stick is only used for booting, no write/no flash wearing, so it just lost charge
i knew it could happen but never expected it 
less than 0.1% of the data has changed


----------



## SirDice (Nov 15, 2021)

covacat said:


> less than 0.1% of the data has changed


It only has to have a couple of bits flipped in the "right" place to corrupt a file. With some files that's not so dramatic (a couple of wrong characters in a text file for example) but a few flipped bits in a binary executable or a kernel is a whole different ballgame.


----------



## Geezer (Nov 16, 2021)

covacat said:


> less than 0.1% of the data has changed



Throw it away!


----------



## covacat (Nov 16, 2021)

well, the stick is still good, it probably has under 2G of data written to it in its lifetime
it just lost charge and data got corrupted


----------



## grahamperrin@ (Nov 21, 2021)

covacat said:


> no surface scan errors



Which utility, used how? 

(Depending on what's used: a full scan might not reveal a latent problem.)


----------



## eternal_noob (Nov 21, 2021)

I bet Lennart tried to install systemd. games/xlennart


----------



## covacat (Nov 21, 2021)

grahamperrin said:


> Which utility, used how?
> 
> (Depending on what's used: a full scan might not reveal a latent problem.)


dd


----------



## angry_vincent (Nov 21, 2021)

i rather prefer ddrescue tool instead of dd, exactly for rescuing data from problematic devices.


----------



## grahamperrin@ (Nov 21, 2021)

covacat said:


> dd



Thanks, used _how_? 

Did you overwrite the entire device?


----------



## covacat (Nov 23, 2021)

just read/scan
dd if=/dev/da0 of=/dev/null bs=64k
also fsck could not find any problem
the device is used just several times a year when the server boots


----------



## hardworkingnewbie (Nov 23, 2021)

eternal_noob said:


> I bet Lennart tried to install systemd. games/xlennart


Wow, I still remember when Xbill was new - and now Xlennart? That's a very questionable honor he's achieved there!


----------



## grahamperrin@ (Nov 24, 2021)

covacat said:


> … fsck could not find any problem …



fsck_ffs(8) is unlikely to detect rotten _data_.

From the UFS chapter of a 2006 book on Solaris internals (I can't find anything similar and more recent for UFS in FreeBSD):




– not _entirely_ without checksumming, but this is for a log. Not for data.


----------



## Alain De Vos (Dec 14, 2021)

eternal_noob said:


> I bet Lennart tried to install systemd. games/xlennart


He's busy restarting a service which died for unknown reason.


----------



## Alain De Vos (Dec 14, 2021)

PS, with zfs you can do an n-way mirror on one physical device with n partitions ... 
That remains only the gptzfsboot vulnerable ?


----------

