Wrack and rack can have such similar meanings that it can be difficult to know which to use at times.
To wrack is to destroy; to trash; to wreck.
To rack - to torture; to distress acutely; to torment; to strain in mental effort; to strain by physical force or violence; to strain beyond what is normal or usual.
Both wrack and rack can therefore mean to cause the ruin of something and whilst in some contexts the difference may be obvious in others it is so subtle that either may be used.
The use of the spelling wrack rather than rack in sentences such as 'she
was wracked by grief' or 'the country was wracked by civil war' is very
common but is thought by many people (myself included) to be incorrect.
In other words,
one is racked by grief or civil war.
As a noun, a wrack is a wrecked ship; a shipwreck; something destroyed or the remnant of something destroyed.
Wrack therefore means collapse or destruction and is the correct word to use in the phrase wrack and ruin. The above is therefore
a wrack going to wrack and ruin.
Wrack is also any of a number of coarse brown seaweeds of the genera
Fucus,
Ascophyllum, and
Pelvetia.
A rack is also a tier (a series of rows placed one above another) and is specifically often used in the context of a tier of stereo or computer equipment.
The rack was an instrument of torture in medieval times.