Representation of used space and free space in hard drives
Free space is a concept at the level of the filesystem, which is part of the operating system. It is up to the filesystem to determine what space is free, and how to exploit it.

Data is stored on the hard drive in a structured way. The filesystem divides the drive into sectors (basic units, usually 512, 1024, 2048, or 4096 bytes), and maintains data structures on the drive which store which sectors are used and which are available. These data structures also store the directory structure of the drive, which sectors comprise which file, file names, and other metadata (such as various file timestamps).

Your experiment, of storing a repeated pattern on the raw drive, doesn't constitute a legitimate use of the drive. The drive is usually used only via a filesystem. The filesystem presents to the user (i.e., the software programmer) a logical view of the hard drive. Physical details such as were different parts of a file are stored are the business of the filesystem rather than of the user (though sometimes the user would like to know more, for example in order to defragment the drive).

The same, by the way, is true for memory, which is maintained by the memory manager, another part of the operating system. The operating system allocated memory to the user, takes care of swapping, stores the memory when hibernating, and so on. On modern CPUs, the user can't just use unallocated memory - this will trigger an exception. The supporting data structures are perhaps more lightweight, but there is still an infrastructure supporting memory allocation and deallocation.