On Mon, 26 Dec 2022, Tixy wrote:

On Mon, 2022-12-26 at 20:46 +0100, Nicolas George wrote:
John Conover (12022-12-26):
So, the more unused SD space is better, since wear leveling writes to
a "bit" that has been written to fewer times.

To test, say with a 16 GB SD, fill the SD to all except the last 1 KB,
and with a looping script, write 1KB of 1's to the remainder of the
SD, erase the "bits," then 1KB of 0's, erase the "bits", and so on;
the SD card will fail within hours to a few days, (with luck-note that
MTBF is mean time between failures, meaning that by MTBF, half will
have failed, half still running; its a stochastic/probability issue;
it does NOT mean that all are expected to last at least 6K writes.)

Doing the same test without filling to the last 1 KB, and the SD card
will last a very long time, (about 16 million total writes.)

Are you suggesting that the microcontroller of the SD card is capable of
decoding filesystem data structures to find out which sectors are
unused?

He didn't mention filesystems.

The controller in the card would surely know what flash blocks contain
data, so writing the whole card first would reserve those blocks as
'in-use' leaving just a relatively small amount of spare blocks which
would be available for erasure and reuse the that repeated write.

But now I'm concerned about disks in a raid-1. Everything gets written
when the raid rebuilds.

I've found fstrim - but that only seems to be for filesystems.

How do I tell the card that the free space in the VG really is free?

However, ff you only ever used the first few GB (say by putting a
filesystem on a partition a fraction the size of the card). Then
there's lots of unused flash blocks that can be cycled through by any
ware levelling algorithm the card implements.

Bizarrely, I ran the following without error on Saturday, however, it
seems to have had zero effect on the card and I cannot get it to work
again

  451  fdisk
  452  mke2fs -j /dev/mmcblk0p3
  453  cd /mnt
  454  ls
  455  mount -o ro /dev/mmcblk0p2 root
  456  mount /dev/mmcblk0p3 transfer/
  457  rsync -avHx root/ transfer/
  458  umount root/
  459  umount transfer/
  460  mke2fs -j /dev/mmcblk0p2

First command created mmcblk0p3

The card now seems to be completely read only. mmcblk0p2 is still there
with data. fstrim does not work after mounting one of the partitions.

Interestingly, my microSD adapter has a little read-only switch - switch
it to ro and I cannot mount mmcblk0p2.

Reply via email to