Delete segments from historical nodes that are not currently served

A large number of segments have accumulated in the cache directory of historical node(due to some misconfigs) that are not being served by it currently and therefore the disk is full and the node has difficulty loading new segments.
Is there any way to find out and safely remove all such data?

if it is one node, you can do it manually thought. Take that node out first then clean the cache directory (assuming you have a replication factor greater than 1)