HDD appears much smaller than its factory size

Research HPA. It can make your drive appear smaller. From Wikipedia:

The host protected area (HPA) is an area of a hard drive or solid-state drive that is not normally visible to an operating system. It was first introduced in the ATA-4 standard CXV (T13) in 2001.

In Linux the right command to check if HPA is enabled is hdparm -N, e.g.:

sudo hdparm -N /dev/sdx

The same hdparm will let you change or disable this setting. Invoke man hdparm and read about the -N option. Note there is a volatile and non-volatile mode.

There should be similar tool(s) for Windows. The mentioned Wikipedia article links to ATATool; seems useful, I have never used it though.