Prior to 1875, Sakhalin was inhabited by both Japanese and Russians. The Russo-Japanese Friendship Treaty (Nishiro Tsuko Joyaku) of 1855 delineated the Japan-Russia boundary as everything south of, and including, the island of Etorofu (Iterrup) being Japanese; all the islands north of Iterrup/Etorofu (the Kurile Islands, or "Chishima Retto" in Japanese) were officially recognized as being Russian territory. However, due to the nature of the mixed Russian-Japanese inhabitation of Sakhalin, no boundary for that island was established in the treaty.
In 1875, Japan gave up its claim to Sakhalin in the Karafuto (Sakhalin)-Chishima (Kurile) Exchange Treaty. In exchange, Japan received 18 Kurile Islands north of Iterrup (Etorofu). The names of all 18 islands were included in the treaty. The treaty did not include the names of the islands from Iterrup southward, since they were already designated as being Japanese in the 1855 treaty.
In 1905, as a result of Japan's victory in the Russo-Japanese War, Russia ceded the southern half of Sakhalin, up to the 50th parallel, to Japan.
In 1951 (while Japan was still an occupied country, incidentally), Japan signed the San Francisco Treaty, in which it relinquished its claim to all of Sakhalin, and all of the Kurile Islands north of Iterrup (Etorofu). However, Japan never wittingly relinquished claim to the small islands from Etorofu southward, which had always been recognized as being Japanese, but which were occupied (and continue to be occupied) by Russia after WWII had officially ended.
Today, Japanese atlases show the islands from Etorofu southward as being Japanese islands (even though they are currently occupied by Russia). The islands consist of Etorofu and Kunashiri (which geologically are part of the Kuriles), as well as Shikotan (essentially a large rock) and the Habomai islets (smaller "rocks"), all of which Russia had never claimed prior to its invasion in October 1945.
The southern half of Sakhalin Island, up to the 50th parallel, is shown in white, but is not part of the "Northern Territories" which Japan wants Russia to return.
http://www.pref.hokkaido.jp/soumu/sm-hrtsk/hp/histo.htm