After installing windows and freeing up space for Ubuntu, I proceeded to installing ubuntu alongside Windows. But, as I mentioned in the question, it was not showing the free space. When I checked the drive using GParted, I was prompted with the following message.
/dev/sda contains GPT signatures indicating that it has a GPT table. However, it has a fake msdos partition table as it should. Perhaps it was corrupted? Is this a GPT partition table?
Once I sorted out that issue, I could be able to find the unallocated space and installed Ubuntu.
I am putting the solution as it is in this link.
I am answering because the answers here are inadequate. I don't want
future viewers of this question to destroy their windows partitions
just to install Ubuntu.
To fix your problem, follow these steps:
- Boot the emergency disk (Ubuntu or other linux Live CD) and open a
text-mode shell.
- Type sudo gdisk /dev/sda (change /dev/sda to whatever
is appropriate to access your hard disk, if necessary). The program is
likely to complain that it's found both MBR and GPT data, and will ask
which to use. It doesn't matter which you tell it to use.
- At the
Command prompt, type x to enter the experts' menu. At the Expert
command prompt, type z to zap (destroy) the GPT data.
- Type y in
response to the confirmation about destroying the GPT.
- Type n in
response to the query about blanking the MBR. Caution: If you answer y
here, you'll destroy your Windows partition(s)!
check this image.