[fpc-pascal] Writing to a drive which may be spun down
winni at bartnick.info
Fri Nov 22 15:34:40 CET 2019
James dragged the solution a little bit away from the
This way it is usable also in critical situations.
SMART is a never ending story and you jump into the jungle:
* A lot of noname disk have no entry in the SMART DB
* Even a half year old Maxtor/Seagate was not found in an updated DB
* On external disks SMART is often disabled by default
* I don't know a Pascal interface to smart
But what will you exspect when the price for 1 TB is now down to 40.- €???
It would be a good idea if reality had not so many obstacles.
Am 22.11.19 um 14:38 schrieb James Richters:
> I thought there was a way to figure out if the drive was spun down, perhaps with a S.M.A.R.T command?
> I like the idea of using the ioResult, but I would put in a way to exit the loop for ioReults of errors not caused by a spun down drive would report right away and a timeout in case some other condition causes the same error as being spun down, so it's not caught in an infinite loop for errors not caused by the spindown. Something like this... (Untested):
> A_Day = 1;
> An_Hour = A_Day/24;
> A_Minute = An_Hour/60;
> A_Second = A_Minute/60;
> rewrite (txt);
> writeln (txt,'I''m so tired ...');
> io := ioResult;
> // showMessage ('--> '+IntToStr(io));
> until (io=NoSuchFileErrorCode) or (StartTime+(30*A_Second)<Now);
> If io<>0 Then
> It seems strange that this would be an issue at all, I would think the drive itself would cache any data written to it for long enough to get the drive spun up... seems very short sighted on hard drive design for this to be an issue at all, and even if the drive didn't do this, it seems like the operating system should take care of it for you.
> -----Original Message-----
> From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Brian
> Sent: Thursday, November 21, 2019 8:55 PM
> To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
> Subject: Re: [fpc-pascal] Writing to a drive which may be spun down
> On 11/21/19 2:38 PM, Winfried Bartnick wrote:
>> writeln (txt,'I''m so tired ...');
>> io := ioResult;
> Thanks Winni, that sounds the sort of idea I'm looking for...
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
More information about the fpc-pascal