Re: hard drive access
- Posted by jimcbrown (admin) Nov 21, 2013
- 1499 views
Another way to do this maybe...
Is there a way to force the allocation of a new file to be at a specified disk location (up front)
and ensure the file is contiguous? Then absolute disk read/write would not be necessary,
normal access using blocks as records would suffice.
And set the attributes like system and readonly to prevent relocating by defragging?
Cheers,
Alan
In a word, no. It depends on the operating system kernel and the file system being used, but in general one shouldn't trust that a file will be contiguous with a particular disk sector.
Sorry, I hit post a bit early;)
Why not use your disk partitioner to create the partition which you use for exclusively for your direct access?
The partitioner will specify the cyl/head/sector during its allocation.
Just skip the first few bytes that's used for the FAT etc.
It depends on what one is trying to do. But this is a sound idea - IIRC Oracle uses this approach for its database (it manages the database directly on top of disk sectors, bypassing any use of a filesystem). If it's a brand new and empty partition, there's even no need to worry about the FAT.
This approach still requires some form of absolute disk access.