Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jun 2020 21:41:34 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Makin' backups -- questions
Message-ID:  <52e039ec-7ec1-d523-e64b-d76a069dde9b@holgerdanske.com>
In-Reply-To: <94012.1592006407@segfault.tristatelogic.com>
References:  <94012.1592006407@segfault.tristatelogic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52e039ec-7ec1-d523-e64b-d76a069dde9b>