Web lists-archives.com

Re: Measuring (or calculating) how many bytes are actually written to disk when I repeatedly save a file




Again, thanks to all who replied -- one comment below -- oops, that changed ;-)

 

On Saturday, April 06, 2019 09:22:17 PM Andy Smith wrote:

> You can test by writing a known quantity of data to the device (say,

> with dd) and then checking out with smartctl how much the counters

> altered. Here's a blog post where I did this with some flash devices

> to determine the 241 unit:

>

>

> http://strugglers.net/~andy/blog/2016/11/26/supermicro-sata-dom-flash-devi

> ces-dont-report-lifetime-writes-correctly/

>

> Given that you can easily measure how much is written to the device,

> do you still need to measure how much is written when editing

> specific files?

 

No. And the approach of using dd (or one of my editors) to write a known quantity of data (or file with a known size in the case of trying to determine if the entire file is written or just the changed part) will be useful.

 

(Aside: I do have to confirm the meaning of some of the "raw" numbers from smartctl -- some of them don't seem reasonable, e.g.,

 

Selected smartctl attributes and other info from my 5 year old (well, 5 years in service) WD 250 GB drive:

 

(Aside: I'm not really looking for anyone to respond to my comments / questions embedded below, I guess I'll be doing some reading / googling, but, any responses are welcome.>

 

 

<quotes, out of sequence, these for the HDD> <I put some comments / questions in angle brackets on these lines>

240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 217192201232731 <really, or is that a negative number or something>

241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 372986671 <I guess I need to read the provided link to determine how many bytes in an LBA on my system>

242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 2162381618

 

...

 

1 Raw_Read_Error_Rate 0x000f 111 099 006 Pre-fail Always - 41619524 <that seems high, maybe the disk is approaching failure>

3 Spin_Up_Time 0x0003 100 100 000 Pre-fail Always - 0

4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 25 <I guess this gives me a good count of the number of reboots in those 5 years, (although the other drive shows only 22 -- maybe I installed that drive later)>

5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0 <that sounds like a good thing>

7 Seek_Error_Rate 0x000f 072 060 030 Pre-fail Always - 16695206 <that seems high, maybe the disk is approaching failure>

9 Power_On_Hours 0x0032 053 053 000 Old_age Always - 41241 <correlates with a drive in service for 5 years>

 

...

 

Device is: Not in smartctl database [for details use: -P showall] <I'm not sure whether that is important or not -- the other drive in this system (the SSD drive) is in the smartctl database) -- I wonder if being in the database implies more reads or writes in order to collect smartctl data?>

 

...

 

Sector Size: 512 bytes logical/physical <I'm pretty sure that does not tell me the LBA size, (but, with a headache this morning, I'm not thinking very well.

</quotes, out of sequence, these for the HDD>

 

<quotes, out of sequence, these for the SSD (80 GB)>

3 Spin_Up_Time 0x0020 100 100 000 Old_age Offline - 0 <those SSDs spin up pretty fast ;-) >

4 Start_Stop_Count 0x0030 100 100 000 Old_age Offline - 0

5 Reallocated_Sector_Ct 0x0032 100 100 000 Old_age Always - 11 <Hmm, a little bit of a surprise, because the other drive has 0>

9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 41270 <interesting in that the other drive has 41241 close, but not exact>

12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 22

192 Unsafe_Shutdown_Count 0x0032 100 100 000 Old_age Always - 4 <hmm, this is not collected for the other drive, but it lists 25 power cycles -- maybe the other drive doesn't distinguish, but, even if I add this to the 22 power cycles (=26) there is a fencepost error (off by one)>

225 Host_Writes_32MiB 0x0030 100 100 000 Old_age Offline - 468009 <so I guess I can multiply 32 MiB times 468009 and then divide by 5 years worth of days to get an approximate MiB per day figure = 8.2 GiB / day -- seems surprisingly high because I tried to put the system stuff (the executables and such) on this drive with the expectation that they might get read often, but not written often -- I'll probably look into this a little more at some point)>

226 Workld_Media_Wear_Indic 0x0032 100 100 000 Old_age Always - 5133309 <it would be interesting to know what this is telling me>

227 Workld_Host_Reads_Perc 0x0032 100 100 000 Old_age Always - 0

228 Workload_Minutes 0x0032 100 100 000 Old_age Always - 1012829346 <my calculation (1825 days x 60 x 24 shows only 2,628,000 in 5 years -- maybe the drive is in some kind of time warp ;-) >

232 Available_Reservd_Space 0x0033 100 100 010 Pre-fail Always - 0

233 Media_Wearout_Indicator 0x0032 096 096 000 Old_age Always - 0 <it would be interesting to know what this is telling me>

184 End-to-End_Error 0x0033 100 100 090 Pre-fail Always - 0 <this sounds good, whatever it means>

</quotes, out of sequence, these for the SSD (80 GB)>