Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f74Nv-0008EX-2W for pgsql-general@arkaria.postgresql.org; Fri, 13 Apr 2018 19:29:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f74Ns-0003Nv-Uy for pgsql-general@arkaria.postgresql.org; Fri, 13 Apr 2018 19:29:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f74Ns-0003Nm-Na for pgsql-general@lists.postgresql.org; Fri, 13 Apr 2018 19:29:20 +0000 Received: from mail.wordtothewise.com ([2001:470:1:6d::9a]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f74No-0000TC-H3 for pgsql-general@lists.postgresql.org; Fri, 13 Apr 2018 19:29:19 +0000 Received: from satsuke.wordtothewise.com (204.11.227.194.static.etheric.net [204.11.227.194]) by mail.wordtothewise.com (Postfix) with ESMTPSA id 9FD8223379 for ; Fri, 13 Apr 2018 12:30:09 -0700 (PDT) From: Steve Atkins Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: how to securely delete the storage freed when a table is dropped? Date: Fri, 13 Apr 2018 12:29:13 -0700 References: To: "pgsql-generallists.postgresql.org" In-Reply-To: Message-Id: <11379B17-AF28-4329-94DF-D4178B88199A@blighty.com> X-Mailer: Apple Mail (2.3273) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Apr 13, 2018, at 10:48 AM, Jonathan Morgan = wrote: >=20 > For a system with information stored in a PostgreSQL 9.5 database, in = which data stored in a table that is deleted must be securely deleted = (like shred does to files), and where the system is persistent even = though any particular table likely won't be (so can't just shred the = disks at "completion"), I'm trying to figure out my options for securely = deleting the underlying data files when a table is dropped. >=20 > As background, I'm not a DBA, but I am an experienced implementor in = many languages, contexts, and databases. I've looked online and haven't = been able to find a way to ask PostgreSQL to do the equivalent of = shredding its underlying files before releasing them to the OS when a = table is DROPped. Is there a built-in way to ask PostgreSQL to do this? = (I might just not have searched for the right thing - my apologies if I = missed something) >=20 > A partial answer we're looking at is shredding the underlying data = files for a given relation and its indexes manually before dropping the = tables, but this isn't so elegant, and I'm not sure it is getting all = the information from the tables that we need to delete. >=20 > We also are looking at strategies for shredding free space on our data = disk - either running a utility to do that, or periodically replicating = the data volume, swapping in the results of the copy, then shredding the = entire volume that was the source so its "free" space is securely = overwritten in the process. >=20 > Are we missing something? Are there other options we haven't found? If = we have to clean up manually, are there other places we need to go to = shred data than the relation files for a given table, and all its = related indexes, in the database's folder? Any help or advice will be = greatly appreciated. Just "securely" deleting the files won't help much, as you'll leave data = in spare space on the filesystem, in filesystem journals and so on. Maybe put the transient tables an indexes in their own tablespace on = their own filesystem, periodically move them to another tablespace and = wipe the first one's filesystem (either physically or forgetting the key = for an encrypted FS)? That'd leave you with just the WAL data to deal = with. Seems like a slightly odd requirement, though. What's your threat model? Cheers, Steve