We've encountered a serious bug with pg_basebackup. It seems to be following hard links and duplicating all files in the tablespaces rather than preserving links.
It could be barman, not pg_basebackup, that has the bug. I assumed that barman was using pg_basebackup, but one of my colleagues pointed out that we're using barman, which may or may not use pg_basebackup to do its work.
Craig
Drilling down into one specific tablespace, we find this:
That is, no hard links, and all of the data files are duplicated. And of course, when we try to actually use this archive to recover, it's twice the size as the original database and doesn't fit on our disks.
My guess is that pg_basebackup is using (or doing the equivalent of) rsync(1) without the --hard-links option, and that these hard links were created by pg_upgrade when we went from 8.4.17 to 9.3.5.
What can we do to fix this? The whole cluster is about 350 databases and 800GB.