More Info
Give us a clue ... what voltage is required ?
If I guess at 12v then 40W is about 3.5 Amps (P = V*I)
If I guess at 18v this comes down to 2.25 Amps.
This will only be required when the HDD is running so a battery pack could cope but its life will be short unless you have power-saving options on your computer to stop the HDD when not required.
Maybe a sealed rechargeable, Yuasa make a 2.8Ah 12v battery, #if the voltage is correct# it would give just under an hour of operation per charge. A 7Ah one would give 2 hours.
Disposables such as a pair of PP9's in series would give 18v and last for a couple of hours (at a cost of 6 pounds (UK) a time - that's £3 per hour !)
Does the size and weight matter?
A 30Ah car battery would last for 10 hours?