@AaronD
Are you trying to ask if wiping free space is better to do with 0's or 1's
pattern because there will be less blocks being used and re filled?
Thinking 0 for empty 1 being used, and by that logic will help increase or decrease the life of a SSD drive. Having the the second logic that is will collapse blocks to not being used, instead of having free space with deleted or removed items is still data using space and more blocks, having more writes, which makes degradation faster
Your missing the point of why Ramhound does not understand you question.
It's with your logic,
by wiping free space and creating and piping it out with
cat > ~/zeros
Creating a write by removing used blocks is still a write on that drive, meaning bad idea, but good thought having bad logic regardless if helps to have a smaller backup image or not. This process will help to create a smaller compressed backup image but your killing your drive in the process.
By piping the output file on the same drive and clearing free space you are creating a large file with > on same drive b/c that is still writing the drive with data even though its is free space.
A write to the drive is a write, and a massive write at that.
I think your asking a loaded question, meaning the logic your asking makes sense, but its wrong, and 100% counter productive, and possible wearing out your drive 10x faster.
Having the drive free of space but creating writes by using a file that will have a large file size, a write is a write, therefore the entire logic even though I get it, still by your thinking
of having the smallest backup image is helping which is true, the wiping free space is creating much more writes than even with free space in your backup image would create, even with the
process of doing it over and over, by writing free space that is a mute amount then creating a file write of the entire free space of the drive still creates a massive write, where the free space,
would only be using a small amount of space. The drive will be worse because its writing a file. erasing clears the file, your writing a file.
What is the goal? – Ramhound – 2017-01-14T01:53:23.587
@Ramhound: Basically the questions at the end. Specifically, I'm doing a lot of trial-and-error trying to build a Pi the way I want it and thrashing the SD card a lot in the process. Backing up partial successes, then trying a completely different approach, etc. I didn't think the specific application was relevant except that I'm writing to it a lot. – AaronD – 2017-01-14T01:58:17.353
I think erasures just unlink entries to file locations or partition tables, and leave the data untouched. If during a restore the drive decided not to do a write because the bit happened to be the right one already, I would guess that is a feature of the installer or drive controller and not the way flash storage works. – Louis – 2017-01-14T02:06:24.400
@Louis: Yes,
rm <file>
does that, but I'm usingdd
for the backup/restore, not a file-copy that misses things that aren't files. The point of the full-drive file that is immediately deleted is to set all the free space to the same value so the drive image can be compressed efficiently. ~600MB for an 8GB SD card with ~2GB used, for example. Despite that file only being ~600MB, it must be restored to an 8GB card or bigger. The overall point is to read back a bunch of the same value when backing up, regardless of how that works underneath...except that there aren't THAT many spare blocks. – AaronD – 2017-01-14T02:19:33.650Your question isn't clear, so clarify it, what is your end goal of writing 0's or 1's to the device? – Ramhound – 2017-01-14T02:35:02.790
@Ramhound: I'm not sure I changed much, but I reworded it anyway. Is this better? – AaronD – 2017-01-14T02:47:25.587
Most SSDs have a bulk erase that's so fast it would be a better solution than dd – Ramhound – 2017-01-14T03:17:07.190
@Ramhound: I don't want to erase EVERYTHING!!! Just set the free space to an easily-compressible pattern (all the same value) so I can then read it with
dd
and compress it. – AaronD – 2017-01-14T03:21:49.547(okay, so I'm using the word "bulk" in a more general sense in the question than what the spec uses; changing that) – AaronD – 2017-01-14T03:23:41.900
You understand that SSDs have a limited writes right. Do you have any benchmarks that actually show your typical actions will actually be helpful with a SSD? – Ramhound – 2017-01-14T03:48:20.783
@Ramhound: Yes, that's half the point of the question - avoiding actual, physical writes by the specific value that I use, considering how the technology works. Other than reading an entire 8GB SD card into a 0.6GB compressed image, restoring the entire 8GB, and running it without errors, no I don't have a benchmark for my typical action of filling the drive with the same value. Personally, I consider that by itself to be a pretty good benchmark. – AaronD – 2017-01-14T03:52:41.430