Praise be to Allah.
Fasting nine days of Dhu’l-Hijjah is mustahabb. This is indicated by the words of the Prophet (peace and blessings of Allaah be upon him), as narrated in the hadeeth of Ibn ‘Abbaas (may Allaah be pleased with him): “There are no days on which righteous deeds are more beloved to Allaah then these ten days – i.e., ten days of Dhu’l-Hijjah).” They said: “O Messenger of Allaah, not even jihad for the sake of Allaah?” He said: “Not even jihad for the sake of Allaah, unless a man goes out himself with his wealth and does not come back with anything (i.e., he expends all his wealth and is martyred).” Narrated by al-Bukhaari, 969.
And it was narrated from Hunaydah ibn Khaalid from his wife that one of the wives of the Prophet (peace and blessings of Allaah be upon him) said: “The Messenger of Allaah (peace and blessings of Allaah be upon him) used to fast nine days of Dhu’l-Hijjah and the day of ‘Ashoora’ and three days of each month – the first Monday and two Thursdays.” Narrated by Imam Ahmad, 21829; Abu Dawood, 2437; classed as da’eef in Nasab al-Raayah, 2/180, but classed as saheeh by al-Albaani.
With regard to fasting on the day of Eid, this is haraam, as is indicated by the marfoo’ hadeeth of Abu Sa’eed al-Khudri (may Allaah be pleased with him): “He [the Prophet (peace and blessings of Allaah be upon him)] forbade fasting on the day of (Eid) al-Fitr and the day of al-Nahr (the day of sacrifice, i.e., Eid al-Adha).” Narrated by al-Bukhaari, no. 1992; Muslim, 827. The scholars are unanimously agreed that it is haraam to fast on these days.
Righteous deeds on these ten days are better than on others. With regard to fasting, that should only be done on nine of them; the tenth day is the day of Eid when it is haraam to fast.
Based on this, what is meant by the virtue of the ten days of Dhu’l-Hijjah is fasting nine days only, even though they are called ten days.
See Sharh Muslim by al-Nawawi, hadeeth no. 1176.