Assuming you are running the Windows defragger, unfortunately, particularly with a badly fragmented hard drive, it doesn’t always do a complete defragmentation in one pass. (I’ve seen it take as many as 3 passes for that defragger to completely defrag a drive.) In addition, that defragger will not defrag the page file.
To get a complete defragmentation, you have to use a 3rd party defragger like Diskeeper or some such.
Also any open files (such as Windows itself) will prevent the disk from fully defragmenting.
Your hard disk drive could not be defragged because there might be a problem with some sectors of the drive. It would be better if you will run the checkdisk utility first before performing the hard disk drive defragmentation.