I am wondering how the OS is reading/writing to the hard drive. I would like as an exercise to implement a simple filesystem with no directories that can read and write file
I found it quite easy to understand a simple filesystem while using the fat filesystem on the avr microcontroller.
http://elm-chan.org/fsw/ff/00index_e.html
Take look at the code you will figure out how fat works.