In a hard drive the bits are written using magnetic impulses to a magnetic disc, which holds or releases the charge as needed. In an optical drive there is a laser that writes bits to a light sensitive disc. A different laser, in some drives, reads the bits, which are effectively pits in the disc itself.