Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBXtC-00BHjD-8l for pgsql-admin@arkaria.postgresql.org; Fri, 08 Dec 2023 10:15:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rBXtA-006SZF-NQ for pgsql-admin@arkaria.postgresql.org; Fri, 08 Dec 2023 10:15:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBXtA-006SZ6-A3 for pgsql-admin@lists.postgresql.org; Fri, 08 Dec 2023 10:15:20 +0000 Received: from mail2.pscs.co.uk ([178.159.10.131] helo=mail.pscs.co.uk) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBXt6-00AkqH-8X for pgsql-admin@lists.postgresql.org; Fri, 08 Dec 2023 10:15:19 +0000 Authentication-Results: mail.pscs.co.uk; spf=none; auth=pass (cram-md5) smtp.auth=pscs Received: from lmail.pscs.co.uk ([192.168.120.1]) by mail.pscs.co.uk ([192.168.120.185] running VPOP3) with ESMTPSA (TLSv1.3 TLS_AES_256_GCM_SHA384) for ; Fri, 8 Dec 2023 10:15:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pscs.co.uk; q=dns/txt; s=lmail; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To :Content-Type:Content-Transfer-Encoding:Cc:Reply-to:Sender; t=1702030204; x=1702635004; bh=h6E7y3FNdZMdeA+eyV2cTmixfGRuQOm+2xh+TwuwIVs=; b=WgRWAVpucpWgXVILT9gJPXE3yJqJ9WWTzcX1YhXleO2G47h0uqpD8bhLj/87Co/kuNJHLmGs qwl/UH3cqMKDy4Xx84BX/15ZKrQ6AEBxT5UgNAgIfrhiWlISK5PG7fBvCEw5BgqzP1y7rL7dgo Zd/Nj4+xXZw3HO9IIKU+74jE8= Authentication-Results: lmail.pscs.co.uk; spf=none; auth=pass (cram-md5) smtp.auth=paul Received: from [192.168.57.78] ([82.68.48.206] (82-68-48-206.dsl.in-addr.zen.co.uk)) by lmail.pscs.co.uk ([192.168.120.70] running VPOP3) with ESMTPSA (TLSv1.3 TLS_AES_256_GCM_SHA384) for ; Fri, 8 Dec 2023 10:09:53 -0000 Message-ID: <20fd6e7a-73ff-4d15-a2e1-a44d5a4aa299@pscs.co.uk> Date: Fri, 8 Dec 2023 10:09:52 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Postgres storage migration Content-Language: en-GB To: pgsql-admin@lists.postgresql.org References: From: Paul Smith* In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: paul X-Server: VPOP3 Enterprise V8.5 - Registered X-Organisation: Paul Smith Computer Services X-VPOP3Tester: 12 345 X-Authenticated-Sender: pscs List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 08/12/2023 09:43, Rajesh Kumar wrote: > Hi > > We are using openshift environment and postgres version 15.2. We want > to change storage from ceph to local storage. So, Storage team made > default storage as local. Now, I created a new cluster with same > postgres version and I am planning to take backup from old cluster to > new cluster. Size is 100gb. Ram 24gb, cpu 2. > > My question is, is there a combination of pg_dump and pg_restore that > takes less time to complete the task? > > Last time it took more than 8hours. We were taking schema only dump > using dumpall . Then data only backup using pg_dump in directory format. If you are using the same (major) version of PostgreSQL, you are moving the whole cluster, and can stop the services on both ends first, then you can: - stop the services (both old and new) - empty the data directory in the new location - copy the whole data directory from the old location to the new location (using copy, rsync, scp, whatever) - start the service on the new location Obviously backup everything before doing anything destructive. If you want to do it while the database is still running, then use replication and fail-over instead. Paul