Why do American English speakers typically say something is "on the hard drive" when referring to data stored with a hard drive (or other permanent storage device) but when referring to something stored in memory say that it is stored "in memory"? Is there a historical, technical reason for the choice of preposition?
I suspect that it has historical roots - physical media such as paper tape and punched cards definitely had stored data on them, just as you'd write on a piece of paper. Those data would then be read into volatile memory, and hence would be in memory.
If there's a difference today, it's really about persistence: data on something can be moved around and survives a loss of power; data in something is more transient. It gets fuzzy when talking about flash RAM and the like, though, so it's probably more a distinction around common usage (e.g. how portable the data storage medium is as much as historical/habitual use).
The question of the use of the prepositions in and on -- almost always with metaphorical informational noun phrases as objects -- comes up here often. Here is the general answer:
If you think of it as flat, use on. If you think of it as a container, use in.
And here are some other posts on specific instances of the distinction.
Quite often, it doesn't matter, and both are appropriate.
Since all computer terms are metaphoric, their images are important.
For instance, computer users see a screen, which is flat: information is on the screen,
but not *in the screen. Permanent and working memory, however, are not visible.
But hard drive is short for hard disk drive, a term that arose to contrast with floppy disk drive, which used floppy disks. Floppy disks were one of the first removable media, and they were flat.
In general, disks are two-dimensional. So information is on a disk, on a disk drive, and on a drive.
As for working memory, that's considered a container -- often filled and refilled -- of information.
Information is a mass noun, like sand, water, and rice, and one puts all of these substances -- metaphorical or not -- in something, not on something. On requires some two-dimensional image, like on a chip.
Memory is a concept, while Hard Drive is a device.
A Hard Drive is a physical collection of disks. Traditionally, the location of a particular amount of data can be directly traced to which physical device stores it, which reinforces the public's awareness that the drive itself is a device. For example, you save a file on the C: drive. You deliberately put that file on the C: drive, so you know it won't be on the A: drive or the F: drive. You can confidently say that the file is on the C: drive. The data is not a part of the drive itself. It's true that you may not know which disk in a drive is storing the file, but you do know which drive. The fact that the drive is made of separate disks is not fundamental to the conceptual role the device fills.
Memory, on the other hand, is not a device. Via metonymy, some devices are referred to as memory generically, such as "searching newegg for more memory," or prepositional phrases cause it to appear to be a device when it isn't, such as "a stick of memory." But in reality, "memory" doesn't refer to any particular device, but to the capability of the device(s) to store data, or to the data itself.
Memory has many different forms, and its allocation varies from device to device depending on use, all perfectly transparent to the user. Any particular amount of data could be stored on this particular stick of RAM, or another one, or it could be in the processor's cache or registers. Parts of it might be in one place while other parts are in another. Pieces might even be duplicated between devices. It may even be on the Hard Drive, via a concept known as virtual memory.
The word "on" would only make sense if the memory being referred to were a concrete device rather than an abstract concept. But since the data, combined with other data and often unused bits, all compose the computer's memory, the data is a part of the memory itself, and so it is "in" memory.
It would probably be acceptable to say that a file is "in" a Hard Drive, and I see no reason that wouldn't work gramatically or conceptually, but it would not be acceptable to say that data is "on" memory.
The reason is because data is literally stored on the disk and in the memory. Data is written to the surface of each platter of the hard drive, but the transistors (and capacitors in DRAM) used in modern memory are internal to the memory chip so the data is in the chip but on the disk. When computers used to use drum memory, people talked about data being stored on the drum rather than in the memory. That 'on' has carried on to being used for memory sticks and solid state drives is, I suspect, an example of a frozen accident.
I would note, however, that the use of 'on' and 'in' is frequently arbitrary in English and may be best thought of simply as a matter of convention. This is not confined to computers but is a wider property of English. Consider, for example, "I was in the car" vs "I was on the bus"; both describe the act of travelling inside a fully enclosed vehicle yet one uses "in" and the other uses "on".
I love @ProfYaffle's answer, but perhaps it's also connected to countability.
"Drive" is countable, but "memory" is uncountable; you say "the data is on the/a/twelve drive(s)", but "the data is in memory" without "the/a/twelve". Note, also, that we say the uncountable "the data is in storage".
We said data is on the hard-drive because it was physically written on the surface of the platters. Also, the first hard-drives had removable platters so you had to know which platter had your data on it. You had to mount them in washing-machine sized drives that ran on AC (I presume 3-phase) and that's why you didn't have a drive for every platter.
The connotative attachment of 'persistence' with the word 'on' happened later.
Memory and written media long precede computers. Moments from your childhood are in your memory, and you write on paper. Here, the English of computing and technology is simply following ordinary English. "The data which were on memory are now in disk" is simply not grammatical for the same reason as "by writing, he tried to capture, in paper, the fragments of Jane now only on his memory". It has nothing specifically to do with the semantics of electronic technology.
Generally "on" means something along "on the surface of..." while "in" means "contained inside of". In this case the harddrive is a physical thing, and it really is on the surface of that thing.
The data is on the harddrive, but it's in the computer.
It is in memory basically because it's hard to think of what the surface of the memory in, so I can't say "on".
That said, the words "in" and "on" have overlapping meanings. Often it's just by accident that one is used over the other.
For example, the Beatles lyric
picture yourself in a boat on a river
Or was it
picture yourself on a boat in a river