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 1f73yp-00075W-0x for pgsql-general@arkaria.postgresql.org; Fri, 13 Apr 2018 19:03:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f73ym-0003oJ-J0 for pgsql-general@arkaria.postgresql.org; Fri, 13 Apr 2018 19:03:24 +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 1f73ym-0003oA-8C for pgsql-general@lists.postgresql.org; Fri, 13 Apr 2018 19:03:24 +0000 Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f73ye-0008FU-Hn for pgsql-general@lists.postgresql.org; Fri, 13 Apr 2018 19:03:23 +0000 Received: by mail-io0-x22e.google.com with SMTP id p139so11370011iod.0 for ; Fri, 13 Apr 2018 12:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=ec/alBLpg9oiR/kd7r/6p5WXJyIzPl0mKqggH3mR9EM=; b=OmYveJq2CGitfgqVnt5CoCP/+wbNZmxp/anlS4T5MeIu0MseXpRKIWMOyyMcvAoc2y DvWWfA03jO265E/nQS1B4+CY4jV7FI86DH746FV/IJEJwY6o6XQUQ7gp8k8jkUPNsLsW 7JIrbMlLB4dKMrdf4S6In+0RJ7uqDirEPzSaYy6n1DSHYwl03fBOeYSfCErZLF18shq6 hfSKDd3aRuBKsr4slFmKO3G9if3lO3QVeNdjkwsSNwyxclvmXrv0tlxrPW915JNUiuCW TdkZ8s7R1Yl2Be8sZVBR7BHwhfVR0NHJYz3Btc1fqPehPXIidNLyihlMwZenkE1eylsF FYQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ec/alBLpg9oiR/kd7r/6p5WXJyIzPl0mKqggH3mR9EM=; b=gULkCwCfNI3GZuJFqsLm/BkbzW26frcBXk4S/4IrNlG4LTMD2qMm8gGJJtbjGFJ2zu DgR5Xu7LGcNsBBcb3nE5jPdY1jf7eFpNzq9ALK4LbdyvhlLC+u8n0aLVSg2dCpfgy1vu a2voMVf1GIKfzoRTXvg4nRgeQyeZDb4wGZ7u7RAoKZysh/qlOT6CUNKqtsNAFYYu+jTu tJ6MrQC528x2fRpQbHluyfrIDYFWFJpaMxgTP12uQqsfNK3xuTk1+wKflv1u17IGH5TU u26sjgbqpAz5eksZsYC3ktRyHsV4KNQJSIrkeo1zTzEq0M1owFu5x0Qv28N3FE23s4+0 6nGw== X-Gm-Message-State: ALQs6tCpUpw0lrKyxvOHhQAswoyGRBhNNijSjnrhK9gnfnDIjp16oh9U SV1BNM0oOOfSCt57SDosPz6qmw== X-Google-Smtp-Source: AIpwx48sb5AI3fXRDBlWJV4EyqP6m0xVhA4DfwpPJil+C7sCEuAd8rSY6JBcZ/nNShtm6/55ZroQTQ== X-Received: by 10.107.162.146 with SMTP id l140mr13908627ioe.39.1523646192726; Fri, 13 Apr 2018 12:03:12 -0700 (PDT) Received: from [10.11.10.6] (ip-15-230-239-173.toronto.ca.northamericancoax.com. [173.239.230.15]) by smtp.googlemail.com with ESMTPSA id i66-v6sm1352887ita.33.2018.04.13.12.03.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Apr 2018 12:03:11 -0700 (PDT) Subject: Re: how to securely delete the storage freed when a table is dropped? To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <81f77dea-32bf-a5d7-5a9c-c70a42b4f155@gmail.com> Date: Fri, 13 Apr 2018 14:03:10 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/13/2018 12:48 PM, Jonathan Morgan wrote: > 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. > > 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) > > 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. > > 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. > > 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. I'd write a program that fills all free space on disk with a specific pattern.  You're probably using a logging filesystem, so that'll be far from perfect, though. -- Angular momentum makes the world go 'round.