server: add ability to prune by total size
server: fixed more logic issues