particle
Limits the preceding element to that amount, number, or thing; often implies 'nothing more than that'.
水だけください。
Just water, please.
彼は笑っているだけだった。
He was only laughing.
particle
as much as; enough to
Indicates an extent or degree; often used with verbs or adjectives to mean 'to the extent that' or 'enough to do'.
できるだけ早く来てください。
Please come as soon as possible.
食べきれないだけの料理が出た。
So much food was served that we couldn't eat it all.
しか is used with a negative verb to mean 'only' with a nuance of insufficiency or less than expected, while だけ is neutral and can be used in positive sentences.
ばかり means 'nothing but' or 'constantly', focusing on the exclusiveness or repetition of an action, while だけ simply limits quantity or extent.
Derived from the noun 丈 (take) meaning 'length' or 'height', which developed into a particle expressing limitation or extent. The kana form だけ is now standard.