[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Ian Post

3/16/2011 3:20:00 PM

I am looking for pointers on how to position the hard disk drive head
by sector (or whatever) in my VB6 program. I do not need to read or
write, just position the head. Suggestion / terminology needed.


22 Answers

(nobody)

3/16/2011 3:36:00 PM

0

"BeeJ" <nospam@nowhere.com> wrote in message
news:ilqkee$7d4$1@speranza.aioe.org...
>I am looking for pointers on how to position the hard disk drive head by
>sector (or whatever) in my VB6 program. I do not need to read or write,
>just position the head. Suggestion / terminology needed.

Why do you need to do this? What problem are you trying to solve?


BeeJ

3/16/2011 4:45:00 PM

0

Two things

General education.
Exercising a drive.

I want to be able to randomly position the head over the entire disk
surface.

I possibly could create a large disk file then do binary reads at
different locations but that requires having the room to create the
file. I know how to do this code in VB6 but I really do not want it to
be file based.

I currently have a few drives that sometimes work and sometimes do not
and I want to see if getting them hot or exercised makes it worse or
better to enable retrieving data from them before toss the drive in the
crusher.


Jim Mack

3/16/2011 5:25:00 PM

0

BeeJ wrote:
> Two things
>
> General education.
> Exercising a drive.
>
> I want to be able to randomly position the head over the entire disk
> surface.
>
> I possibly could create a large disk file then do binary reads at
> different locations but that requires having the room to create the
> file. I know how to do this code in VB6 but I really do not want
> it to be file based.

The CreateFile API allows you to open logical and physical devices as
well as files, with the proper permissions.

use it to open \\.x: (no trailing slash), where X is A, B, C etc for
logical drives. Then use the returned handle with ReadFile or
SetFilePointer. CloseHandle when done. Pretty simple if you just need
to seek / read. Getting write permission is often problematic.

You might also open \\.\PHYSICALDRIVEx (where x is 0..n), and use the
returned handle with DeviceIoControl. But be warned that that's
complicated and dangerous stuff.


These uses are detailed in MSDN and apply to Win 2K and above.

--
Jim Mack
Support Wisconsin! http://www.cafepress.com/2050i...


Heinrich Pfeifer

3/16/2011 5:50:00 PM

0

Am 16.03.2011 17:44, schrieb BeeJ:
> Two things
>
> General education.
> Exercising a drive.
>
> I want to be able to randomly position the head over the entire disk
> surface.

Assuming you work with Windows which is required by VB6:

You know that under Windows, you'll never be sure that the disk head
stays where you've told it to go. There are many other processes working
at the same time. Can you stop them all?

In addition, you must block any caching. Otherwise the disk head is
moved at another time than expected - before/after you read/write
from/to the disk.

--

Heinrich
http://www....
mail: new<at>gartrip.de

Henning

3/16/2011 8:26:00 PM

0


"BeeJ" <nospam@live.com> skrev i meddelandet
news:ilqpds$jnc$1@speranza.aioe.org...
> Two things
>
> General education.
> Exercising a drive.
>
> I want to be able to randomly position the head over the entire disk
> surface.
>
> I possibly could create a large disk file then do binary reads at
> different locations but that requires having the room to create the file.
> I know how to do this code in VB6 but I really do not want it to be file
> based.
>
> I currently have a few drives that sometimes work and sometimes do not and
> I want to see if getting them hot or exercised makes it worse or better to
> enable retrieving data from them before toss the drive in the crusher.
>
>

For complete control over diskdrives, you have to buy an Amiga. Then you can
play Für Elise with the stepmotor for the heads in the diskette drive. :)

/Henning


Thorsten Albers

3/16/2011 9:49:00 PM

0

BeeJ <nospam@live.com> schrieb im Beitrag
<ilqpds$jnc$1@speranza.aioe.org>...
> I want to be able to randomly position the head over the entire disk
> surface.

What you want to do is impossible:
- Modern hard disks do not only have one but several heads.
- The heads are positioned by the hard disk controler from the outer rim of
the magnetic plates (sorry, don't know the correct english name for this)
towards the center and back, not around it. The magnetic plates are
spinning >>all the time<<. Therefore the heads do never stopp over a
certain area of the magnetic plates, even if reading/writing data - they
simply are reading/writing the data somewhat 'on the fly'.
- It is not for sure that a sector is always located at the same place on
one of the magnetic plates.

What you want to do is the work of the controller inside the hard disk
(firmware). To do it yourself you would have to bypass the controller, or
to send it low-level commands.

> I currently have a few drives that sometimes work and sometimes do not
> and I want to see if getting them hot or exercised makes it worse or
> better to enable retrieving data from them before toss the drive in the
> crusher.

- Get yourself an apropriate diagnostic tool of the hard disk drive
manufacturer which the manufacturers usually offer for free as a download
on their web pages.
- Do a complete surface scan. Modern hard disk drives have much more
sectors than can be used for data storing. If it turns out that a used
sector is faulty, a sector in good state is used instead and the previous
sector gets marked as unusable. The surface scan checks if there are any
sector replacements necessary and possible.

If after the surface scan any error codes regarding bad sectors or the like
are reported, toss the drive on the cusher...

--
Thorsten Albers

gudea at gmx.de

(nobody)

3/16/2011 10:27:00 PM

0

BeeJ wrote:
> Two things
>
> General education.
> Exercising a drive.
>
> I want to be able to randomly position the head over the entire disk
> surface.
>
> I possibly could create a large disk file then do binary reads at
> different locations but that requires having the room to create the
> file. I know how to do this code in VB6 but I really do not want it
> to be file based.
>
> I currently have a few drives that sometimes work and sometimes do not
> and I want to see if getting them hot or exercised makes it worse or
> better to enable retrieving data from them before toss the drive in
> the crusher.

Is others mentioned, the HD is spinning all the time, and the HD head only
swings from left to right, it doesn't extend forward and backward, nor goes
up and down. You will need to read this article to see how hard disks work:

http://www.howstuffworks.com/har...

What I would do is take a snapshot of SMART data, do a hard disk surface
scan, then compare the SMART result, see this page for description of what
the data means:

http://en.wikipedia.org/wiki....

Fortunately, the free version of HD Tune lets you do all that:

http://www....




Anton

3/16/2011 11:26:00 PM

0

Part of what I need is to be able to hear the head being positioned so
I plan to randomly do reads sufficient such that caching is not in the
picture. Or I can write random data to a large binary file. Doing so
in a loop. That will force writing and not rely on the cache.
Currently all the drives I have will make a noise when the dreaded
indexing is going on so I know they are audible.


Karl E. Peterson

3/16/2011 11:35:00 PM

0

BeeJ laid this down on his screen :
> Part of what I need is to be able to hear the head being positioned so I plan
> to randomly do reads sufficient such that caching is not in the picture. Or
> I can write random data to a large binary file. Doing so in a loop. That
> will force writing and not rely on the cache.
> Currently all the drives I have will make a noise when the dreaded indexing
> is going on so I know they are audible.

I gotta say it. Yer nutz. With some respect, of course, but still.

Get the drive manufactuer's maintenance utility.

Run the friggin' diagnostics.

Turn on SMART, and download HD Tune to monitor that.

If you don't like the noise, turn on AAM. It'll be slower, but
quieter.

Or, just buy a new drive. THey're cheap!

--
..NET: It's About Trust!
http://vfre...


Thorsten Albers

3/16/2011 11:36:00 PM

0

BeeJ <nospam@spamfree.com> schrieb im Beitrag
<ilrgtt$eje$1@speranza.aioe.org>...
> Part of what I need is to be able to hear the head being positioned so
> I plan to randomly do reads sufficient such that caching is not in the
> picture. Or I can write random data to a large binary file. Doing so
> in a loop. That will force writing and not rely on the cache.
> Currently all the drives I have will make a noise when the dreaded
> indexing is going on so I know they are audible.

You are mixing up the operating system caching and the internal hard disk
caching: The first may be influenced by what you have described above, the
latter not. You can't tell at what time the hard disk writes data from the
cache to its magnetic plates. To do what you want to do you would have to
turn of the internal hard disk cache what presumably is possible but again
only by low-level commands.
And don't draw any conclusions from the noise the hard disk makes: The
noise comes from the heads being moved, not from writing data to the disk.
The more the heads have to be moved over the magnetic plates, the more
noise can be heard. No noise doesn't necessarily mean that nothing happens.

--
Thorsten Albers

gudea at gmx.de