Results 1 to 17 of 17

Thread: mechanical hdd, is possible select in what sectors save some files?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    mechanical hdd, is possible select in what sectors save some files?

    mechanical hdd, is possible select in what sectors save some files?

    The mechanical HDD have areas of fast speed, medium speed and slow speed, Is it possible to programmatically save some files to a predetermined area on the hard drive?

    Greentings!!!
    Last edited by James Reynolds; Jun 4th, 2023 at 10:54 AM.

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,140

    Re: mechanical hdd, is possible select in what sectors save some files?

    Using Visual Basic 6? Or in general???

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: mechanical hdd, is possible select in what sectors save some files?

    Hard drives contain a lot of cache memory these days. That pretty much wipes out any advantage in playing allocation games from the 1980s.

  4. #4
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,251

    Re: mechanical hdd, is possible select in what sectors save some files?

    To a limited extent, yes.

    If you buy a big, empty hard drive and place a series of large files that comprise a database, it will be written contiguously to one part of the hard drive - and that I believe will be the outer cylinders. By not adding any other files to the hard drive the heads are kept within the same range of cylinders and read/write speeds are maximised as the heads are doing no seeking elsewhere. I have used this technique in the past.

    As long as you do no more writes and keep the drive empty serving just the database files, it will read/write quickly. In this way you are partly controlling where the initial writes occur and then excluding any other.

    The last time I was involved in placing files specifically on a drive was back in the ICL mainframe days, since then the placement has been handled by the controller and then possibly optimised at the file system level using a disc defragmentation tool. I have used VMS, AOS/VS, Solaris and later operating systems and have not come across manual placement of files whilst using those.

    I do believe it was possible in VMS clusters to access the Heirarchical Storage Controller and have more control of physical access. When you logged into these it was somewhat like being logged into the processor that acted like a drive controller even though each drive would still have its own dedicated controller board.

    In DOS you could format a drive in such a way that some of its cylinders would not be accessible and in that way you could restrict which parts were being used. The rest was inaccessible.

    It may be possible to enable something legacy regarding the various filesystems that are used in the remaining Unix Oses and the derived Linux Oses but to me it feels as if that would be a characteristic of the chosen filesystem and not a general thing.

    I think it is not do-able using Windows though I am prepared to be wrong. In any case, there is no need anymore - buy an SSD.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,717

    Re: mechanical hdd, is possible select in what sectors save some files?

    99.999% chance you gain nothing from doing this, but if you're heart is set on it, look into the defragmentation APIs. Specifically, FSCTL_MOVE_FILE which specifies an origin cluster number and destination cluster number.


    This post brought to you by fafalone's FootGun Market. No refunds when you accidentally nuke your partition table and lose everything on the drive.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    Re: mechanical hdd, is possible select in what sectors save some files?

    It make the question for curiosity, because I checked with google, and nothing came out, and I said to myself, I'm going to ask the vbforums forum...

    Thanks for the answers, and well, a program like this would be interesting, better for me in VB6, but in any language...

    I've already commented on other issues, to get rid of RANSOMWARE problems, because it attacked me twice, and it didn't do me much harm because I'm obsessed with backup copies, and I have everything in triplicate on many disks disconnected from the pc, and, therefore, I only lost about 2 days of work, but I decided that it wouldn't happen to me anymore...

    And what I have done is create a lot of directories that are not important to me, with many subdirectories and subdirectories of subdirectories, etc, with many files, and thus, the ransomware has to encrypt tens of thousands of files that do not matter to me before Getting to the ones that I do care about are in about a tenth subdirectory of one of the directories at the root of the drive...

    I have also made a program that starts with windows, and it checks some of those junk files, in case they change, since I don't touch them, they are not important to me, they are copies of my codes, programs, etc, but that I already have in a good place, and that, I never touch those files, and if the program detects any change in these files, it warns me with a sound and closes the PC...

    This is how I get rid of possible ransomware attacks...

    At the same time I have a program that opens the file manager in the directory that works for me on each hard drive, the real directory where I have everything I use...

    And well, since these files that I'm not interested in can use space in the fast areas of the hdd, I wondered, just to know, if I could put them in the slow areas, there are about 30,000 files, 98% not very large, and They take up little space anyway, but I was wondering if I could put them in the slow zone of the hdd...

    Thank you all for the answers!!! And I wish there was some code...

    Sorry for me bad English...!!!
    Last edited by James Reynolds; Jun 4th, 2023 at 12:49 PM.

  7. #7
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,251

    Re: mechanical hdd, is possible select in what sectors save some files?

    Hmmm, perhaps you are going around this the wrong way. Determining how you are being invaded by ransomware rather than setting up a honeytrap to catch them might be a better response.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  8. #8
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,251

    Re: mechanical hdd, is possible select in what sectors save some files?

    I'd still be interested to see your code on your honeytrap.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  9. #9
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: mechanical hdd, is possible select in what sectors save some files?

    Quote Originally Posted by James Reynolds View Post
    Is it possible to programmatically save some files to a predetermined area on the hard drive?
    There are far too many abstractions between you as the programmer and a hard disk's individual clusters and sectors. The only way to achieve this is to write your own file system drivers and this would be a bad idea because if you could, you will corrupt you hard disk's data on account of Windows and your driver each wanting to do their own thing independent of what the other is doing.

    So the short answer to your question is no and a hard no at that.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  10. #10
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: mechanical hdd, is possible select in what sectors save some files?

    BTW, you guys really need to be able to just give people a straight no sometimes when they come with wild ideas like this.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  11. #11
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,910

    Re: mechanical hdd, is possible select in what sectors save some files?

    And when your system is compromised by ransomeware then all disk IO is intercepted and rerouted. So you won’t notice anything for weeks or months all files/data seem to be normal while accessing them

  12. #12
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,717

    Re: mechanical hdd, is possible select in what sectors save some files?

    Quote Originally Posted by Niya View Post
    There are far too many abstractions between you as the programmer and a hard disk's individual clusters and sectors. The only way to achieve this is to write your own file system drivers and this would be a bad idea because if you could, you will corrupt you hard disk's data on account of Windows and your driver each wanting to do their own thing independent of what the other is doing.

    So the short answer to your question is no and a hard no at that.
    See all I heard there was "yes it's possible".

    (And I previously chimed in with a non-kernel mode method).

  13. #13
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: mechanical hdd, is possible select in what sectors save some files?

    Quote Originally Posted by fafalone View Post
    See all I heard there was "yes it's possible".
    And the bull sees red again
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  14. #14
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,000

    Re: mechanical hdd, is possible select in what sectors save some files?

    mechanical hdd, is possible select in what sectors save some files?
    The short answer is no. The longer answer is that if you write a kernel mode driver you can do what you want with the hdd - but you really, really shouldn't.

    FSCTL_MOVE_FILE is used with DeviceIoControl()
    https://learn.microsoft.com/en-us/wi...eviceiocontrol

    Available disk control codes are documented as:
    https://learn.microsoft.com/en-us/wi...-control-codes

    Use amending ones at your own peril!
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Posts
    67

    Re: mechanical hdd, is possible select in what sectors save some files?

    Quote Originally Posted by Niya View Post
    BTW, you guys really need to be able to just give people a straight no sometimes when they come with wild ideas like this.
    I think not is a "wild idea", I think it is logical to want to know if it is possible to determine in which sectors some files are stored, and to know if it is possible or not, it seems to me a good question if you want to know in depth how Windows works...

    And Windows should allow you to put a parameter to save files in different areas, for example, I have a video program that occupies about 38 GB - aprox 580 Videos - compressed with Winrar part01.rar, part02.rar... ... ... part24.rar, 24 files of 2GB, and it would be good for me to have free areas in the fastest area for this type of files... And leave the slowest areas of HDD for small files...

    Although I think that it doesn't do it so as not to make the heads jump a lot between zones, and that what is being saved is always close, and thus the heads can last longer, I think that must be the reason...
    Last edited by James Reynolds; Jun 5th, 2023 at 10:04 AM.

  16. #16
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,000

    Re: mechanical hdd, is possible select in what sectors save some files?

    @James - there is nothing wrong with your thinking about this. It's what we old timers used to do many decades ago. In the 1980's I wrote systems in Wang Basic which had language statements to read/write data direct to any specified area of the disk. If you got your code right you read/wrote the next data sector you wanted just as it was passing under the head(s) - with 0 seek time! In Pick Assembler you could do something like this if you wanted and access this from Pick Basic. But with the advent of SSD, disk caching and now with defragmentation available in Windows these sorts of hack went out years ago (thank goodness!).

    Why not just add an SSD for these files?
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  17. #17
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: mechanical hdd, is possible select in what sectors save some files?

    Quote Originally Posted by James Reynolds View Post
    I think not is a "wild idea", I think it is logical to want to know if it is possible to determine in which sectors some files are stored, and to know if it is possible or not, it seems to me a good question if you want to know in depth how Windows works...
    Oh no, there is absolutely nothing wrong with your question. It's a perfectly valid question. My comment was meant to address our tenacious tendencies on these forums. We really don't do "it's impossible" over here but sometimes it's just better to just say no. The juice isn't always worth the squeeze and I think sometimes we fail to recognize that. Even I'm guilty of that sometimes
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width