Automatic Logging of Disk Use and SSD Writes.

How, what, where and why - when using the software.
alan-0000
Posts: 77
Joined: 2012.06.04. 16:59

Automatic Logging of Disk Use and SSD Writes.

Post by alan-0000 »

I am using a BAT script to trigger a HDS text report and extract information and append snippets to logg files for each of the Disks.
The intention is to automatically measure the total amount of read and write to each Disk from Power up to Shutdown,
and automatically capturing the totals at both Restart and Sleep.
Plus a Manual Query when I wonder how much of my SSD write life has been consumed by a failed installation
I found 6 GB had been done to my SSD because Windows ignored my redirection to an HDD :o

This shows the end result of three triggers

Code: Select all

  19:57:56.42
  19:57:57.80 23/07/2012  PENDING Shutdown  Disk: #1: OCZ-VERTEX2 --
"  Lifetime Compressed Wr.. 0      0      0      000000000100" 
"  Lifetime Writes from H.. 0      0      0      000000000080" 
"  Lifetime Reads from Ho.. 0      0      0      000000000300" 
1: OCZ. Total Data Read  : 141 MB,  171,354 MB since installation  (23/05/2012)
1: OCZ. Total Data Write : 39 MB,  44,547 MB since installation
  20:00:09.09
  20:00:16.31 23/07/2012 Post Shutdown  Wake-Up  Disk: #2: OCZ-VERTEX2 --
"  Lifetime Compressed Wr.. 0      0      0      000000000100" 
"  Lifetime Writes from H.. 0      0      0      000000000080" 
"  Lifetime Reads from Ho.. 0      0      0      000000000300" 
2: OCZ. Total Data Read  : 7 MB,  171,361 MB since installation  (23/05/2012)
2: OCZ. Total Data Write : 2 MB,  44,549 MB since installation
  21:18:53.70
  21:18:54.98 23/07/2012  -Query-  Disk: #2: OCZ-VERTEX2 --
"  Lifetime Compressed Wr.. 0      0      0      000000000100" 
"  Lifetime Writes from H.. 0      0      0      000000000080" 
"  Lifetime Reads from Ho.. 0      0      0      000000000300" 
2: OCZ. Total Data Read  : 83 MB,  171,437 MB since installation  (23/05/2012)
2: OCZ. Total Data Write : 28 MB,  44,575 MB since installation
If you want to try it, this is the script which I call HDS_LOG.bat and hold at D:\HDSentinel\Stats\

Code: Select all

@echo off & SETLOCAL & SETLOCAL EnableDelayedExpansion & CD /D D:\HDSentinel\Stats\ & CLS

SET "T0=%TIME%"

::GOTO :SKIP
IF EXIST HDSentinel_report_*.TXT DEL HDSentinel_report_*.TXT
"C:\Program Files (x86)\Hard Disk Sentinel\HDSentinel.exe" /TXTREPORT
REN HDSentinel_report_*.TXT HDSentinel_report_X.TXT
:SKIP

SET "D_T=%TIME% %DATE%"
SET /P STATE=<CLOSING.TXT & ECHO(%*>CLOSING.TXT & if "%2"=="" ECHO(>CLOSING.TXT
SET "IDENT=---" & SET "DRV=" & SET "TOT=" & SET "VAL=0"
SET "NOW=PENDING %2" & IF "%2"=="" SET "NOW=%1"
SET LO=1001 & SET "in=HDSentinel_report_X.txt"
<%in% (
  ECHO(  %T0%& ECHO(  %D_T% %STATE% %NOW%
  for /f %%a in ('find /c /v "" ^< %in%') do (SET /A HI=LO-1+%%a)
  for /L %%b in (!LO!,1,!HI!) do (
    set "LN=" & set /P "LN="
    set "XXX=!LN:~4,10!"
    IF /I "!XXX!"==" PHYSICAL " (
      SET "IDENT=!LN:~40,6!" & SET "DRV=!DRV! !IDENT!  " & SET "OUT.TXT=!IDENT:~3!_Data_Report.txt"
      (ECHO(  %T0%& ECHO(  %D_T% %STATE% %NOW% !LN:~32!)>>  !OUT.TXT!
      ECHO !LN:~33!
    )
    IF /I "!XXX!"=="TOTAL DATA" ECHO !IDENT!. !LN:~4,16! !LN:~53!
    IF /I "!LN:~3,10!"=="  LIFETIME" ( ECHO "!LN:~3,60!">> !OUT.TXT! & ECHO "!LN:~3,60!")
    IF /I "!XXX!"=="TOTAL DATA" FOR /F "tokens=1-2 delims=:M" %%a IN ("!LN!") DO SET /A VAL=!VAL!+%%b
    IF /I "!XXX!"=="TOTAL DATA" ECHO !IDENT!. !LN:~4,16! !LN:~53!>> !OUT.TXT!
  )
)>> All_Data_Report.txt
TYPE All_Data_Report.txt
PAUSE
TYPE OCZ_Data_Report.txt
IF "%1"=="Wake-Up" (ECHO %DRV% R+W=%VAL%MB   %D_T% %STATE%>> Wake-Up.txt) && TYPE Wake-Up.txt
ECHO(%2
PAUSE
IF "%2"=="Sleep" rundll32.exe powrprof.dll,SetSuspendState 0,1,0
IF "%2"=="Restart" Shutdown.exe -r -t 00
IF "%2"=="Shutdown" Shutdown.exe -s -t 00
EXIT /B
I have HDS installed on C:\ and used Configuration / Advanced Options to store statistics at D:\HDSentinel\Stats\
Under Configuration / Operations I have scheduled on all 7 days a Project "Report" to Start "After Load" with a "Time" delay of 00:00.
The Project type is "Run ... batch file"
The command Line includes the argument "Wake-Up", and is

Code: Select all

D:\HDSentinel\Stats\HDS_LOG.bat Wake-Up
My Desktop has 4 shortcuts which each launch my script with relevant arguments
HDS-LOG
D:\HDSentinel\Stats\HDS_LOG.bat -Query-

SLEEP
D:\HDSentinel\Stats\HDS_LOG.bat Post Sleep

RESTART
D:\HDSentinel\Stats\HDS_LOG.bat Post Restart

SHUTDOWN
D:\HDSentinel\Stats\HDS_LOG.bat Post Shutdown

Regards
Alan
User avatar
hdsentinel
Site Admin
Posts: 3128
Joined: 2008.07.27. 17:00
Location: Hungary
Contact:

Re: Automatic Logging of Disk Use and SSD Writes.

Post by hdsentinel »

Thanks for this tip, it may be very useful !
A new section on the website is planned which will contain tips / add-ons to help users and if you agree, this script may be added as well.
alan-0000
Posts: 77
Joined: 2012.06.04. 16:59

Re: Automatic Logging of Disk Use and SSD Writes.

Post by alan-0000 »

Yes, I am happy for you to include my script.

Before I had a SSD my only concern was to minimize the size of updated files from one Macrium Reflect Partition Image Incremental backup to the next.
I found that by using Reparse points to redirect my Browser profiles away from my %APPDATA% on C:\ to a different partition,
the daily backup file typically dropped from 300 MB to 50 MB.
That remained true when I used an SSD for my Windows System Drive.

I had a rude awakening when I installed HDS.
Previously I was only seeing the latest size of each changed file at the end of the day,
now I saw that there was an awful lot of writes to a file that were superseded by further updates during the day,
and some days there were 1 GB of writes to the SSD that were only seen by the Incremental backup at the end of day as 100 MB of updated files.

My first purpose for my script was to launch a quick "Query" to observe the current system Writes of Windows to the SSD,
and of SSD writes to its Nand Cells as shown by SMART Data.

Then I enhanced the script to identify the conditions under which Disc numbers are inconsistent.
This is an extract from "Wake-Up.txt"

Code: Select all

 0: WDC   1: SAM   2: OCZ   R+W=8MB    8:35:34.01 22/07/2012 Post Shutdown 
 0: OCZ   1: WDC   2: SAM   R+W=9MB    15:09:25.35 22/07/2012 Post Restart
 0: WDC   1: SAM   2: OCZ   R+W=14MB   16:08:27.50 22/07/2012 Post Shutdown 
 0: WDC   1: OCZ   2: SAM   R+W=9MB    21:01:57.00 22/07/2012 Post Restart 
 0: WDC   1: SAM   2: OCZ   R+W=9MB     7:43:12.60 23/07/2012 Post Shutdown  
 0: WDC   1: SAM   2: OCZ   R+W=10MB    8:56:12.51 23/07/2012 Post Shutdown  
The above shows that random number sequences are allocated upon a Restart.
Basically M.S. expected the disc numbers to be defined by the channel numbers of a SATA controller,
and they failed abysmally and issued this admission of fault
http://support.microsoft.com/kb/937251
The wrong numbers are consistent upon a shutdown and subsequent power-up
The randomness occurs upon a Restart.

If anyone else has an SSD I would be interested in learning if this inconsistency is world wide or just my specific system.

Obviously a power-up will NOT find the rotating Discs at speed and "ready to roll",
but a Restart never gives the platters time to slow down.
At power-up the SSD is almost immediately ready to respond to the BIOS,
I just do not understand why the first responder will be given the last Disk number,
but I have given up trying to understand Windows - Windows does whatever Windows wants.

At Restart I assume the SSD will first be writing the contents of its RAM caches etc. to NAND cells because it is preparing for SHUTDOWN,
and perhaps the amount to be written determines how long before the SSD will respond to the BIOS requesting its status.

I am still awaiting a response from OCZ on this peculiarity.
http://www.ocztechnologyforum.com/forum ... ing-broken

Each time HDS is loaded upon Windows start it launches my script and appends an update to "Wake-up.txt" plus 4 other files.
I have 3 physical drives and for each there is a file, OCZ_Data_Report.txt, SAM_Data_Report.txt and WDC_Data_Report.txt,
and a composite for all drives named "All_Data_Report.txt"

NB I use the first three letters of the Drive Manufacturer for the name of the log file.
This is meaningful to me because every drive has a different name.
My sympathy for those that have identical drives :(

Regards
Alan
klauzser
Posts: 24
Joined: 2012.10.31. 02:47

Re: Automatic Logging of Disk Use and SSD Writes.

Post by klauzser »

I might come across this one. Cheers!
Post Reply