From owner-freebsd-questions@freebsd.org Sat Jun 13 04:41:38 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E23C328504 for ; Sat, 13 Jun 2020 04:41:38 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from holgerdanske.com (holgerdanske.com [IPv6:2001:470:0:19b::b869:801b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "holgerdanske.com", Issuer "holgerdanske.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kQ0d4CXMz4WKP for ; Sat, 13 Jun 2020 04:41:37 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from 99.100.19.101 ([99.100.19.101]) by holgerdanske.com with ESMTPSA (TLS_AES_128_GCM_SHA256:TLSv1.3:Kx=any:Au=any:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username dpchrist@holgerdanske.com, mechanism PLAIN) for ; Fri, 12 Jun 2020 21:41:35 -0700 Subject: Re: Makin' backups -- questions To: freebsd-questions@freebsd.org References: <94012.1592006407@segfault.tristatelogic.com> From: David Christensen Message-ID: <52e039ec-7ec1-d523-e64b-d76a069dde9b@holgerdanske.com> Date: Fri, 12 Jun 2020 21:41:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <94012.1592006407@segfault.tristatelogic.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49kQ0d4CXMz4WKP X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of dpchrist@holgerdanske.com has no SPF policy when checking 2001:470:0:19b::b869:801b) smtp.mailfrom=dpchrist@holgerdanske.com X-Spamd-Result: default: False [3.66 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(1.10)[1.103]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_MEDIUM(0.75)[0.747]; DMARC_NA(0.00)[holgerdanske.com]; NEURAL_SPAM_LONG(0.91)[0.907]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jun 2020 04:41:38 -0000 On 2020-06-12 17:00, Ronald F. Guilmette wrote: > But seriously, I have found that copying whole partitions is often easiest > using the Linux gparted tool. I use LUKS, GELI, and ZFS. Unfortunately, I do not believe gparted nor Clonezilla support them: https://gparted.org/ https://www.clonezilla.org/ > DD is quite obviously an -extremely- low > level tool, and rather ham-fisted. Clonezilla can also copy individual > partitions. Me personally? I wouldn't use DD except to copy -everything- > between two drives having exactly the same number of sectors. I have an assortment of "16 GB" devices of varying sizes: 2020-06-12 20:58:04 dpchrist@tinkywinky ~/hardware $ cat `find samsung sandisk/ultra-fit -name fdisk.out` | egrep '14.. GiB' | perl -pe 's/.+ (\d+ sectors)/$1/' | sort | uniq 30031872 sectors 30375936 sectors 31266816 sectors 31277232 sectors When installing, I use 1 MiB + 14 GiB = 29362176 sectors and leave the rest as unused space. When imaging, I copy from sector 0 to the end of the last MBR partition (FreeBSD slice). I can put the image onto any of the above devices, and the device will boot and work as a system drive. > Note that > if you use DD to copy from a smaller drive to a bigger drive, then afterwards > the BIOS and everything else will tell you that the destination drive's > physical size is -smaller- than it actually is, i.e. exactly equal to the > size of the (smaller) source drive. I haven't seen that. I gather drive metadata and check it into CVS whenever I wipe a device, do a fresh install, take an image, or restore an image. I will pay more attention to 'cvs diff' in the future. I would be curious to see a demonstration console session. > Yet another reason not to use DD to copy either whole disks or partitions... > unless the size of the destination is -exactly- equal to that of the source. I agree that partition sizes must be identical for dd(1) to produce a correct result. But, I know that device sizes do not need to be identical if you use MBR partitioning and leave free space at the end. David