That's exactly what one very patient Minecraft player has done. Reddit user smellystring recently posted an Imgur link to a fully functional 1KB hard drive built within the game. It's all a bit complicated but the post does a solid job of breaking down exactly what's happening.
As you likely know, computer data is ultimately broken down into 0s and 1s - you know, binary code. The in-game hard drive behaves the same way in that solid blocks are a 1 and clear blocks represent a 0. By using a lot of pistons to push blocks around in a loop, the "hard drive" can actually store data.
Granted, it isn't very fast with a theoretical spin speed of 1 byte per 8 redstone ticks but it's impressive nevertheless
The creator also explains and shows where and how new data is called upon and created. Reading detects whether a block is solid or clear and retrieves the data stored. Conversely, writing takes place simply by switching blocks from solid to clear and vice versa.
In my opinion, this is one of the most impressive Minecraft creations I've ever seen. It ranks right up there with the 16-bit Minecraft computer from a few years ago. To download Minecraft please head here.