Gentoo Archives: gentoo-user

From: Bas Zoutendijk <slzoutendijk@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] backing up a partition
Date: Fri, 24 Aug 2018 09:02:31
Message-Id: 20180824090219.GI7179@blackeye.localdomain
In Reply to: [gentoo-user] backing up a partition by Philip Webb
1 Dear Philip,
2
3 On Fri 24 Aug 2018 at 04:32:23 -0400, Philip Webb wrote:
4 > I want to make a copy of a partition which I can use to replace it,
5 > if some catastrophe damages the partition or wipes it out ;
6 > it needs to be byte-byte identical, incl all permissions.
7 >
8 > Can I use 'dd' ? -- eg 'dd if=/mnt/xxx of=/mnt/yyy',
9 > where the partition has been mounted at /mnt/xxx
10 > & a USB stick has been mounted at /mnt/yyy . Will that do the job ?
11
12 If you want to make a byte-by-byte copy of a partition, the easiest
13 way in my opinion is to dd the (unmounted) partition, e.g.
14 if=/dev/sda1. You could also do that with the entire drive, e.g.
15 if=/dev/sda.
16
17 > There seems also to be an issue re 'bs=<some number of bytes>' :
18 > what size is best ? i plan to use USB 3.0 for quicker copying.
19
20 For optimal performance the block size should be a multiple of the
21 device’s physical block size. Old hard drives had 512-B blocks, more
22 recent ones have larger 4-KiB physical blocks that are sometimes
23 software-emulated to appear as 512-B blocks. In my experience it is
24 faster to use even larger block sizes; I usually use bs=1M.
25
26 > Does it matter how the USB stick is formatted ?
27 > Can I use a raw stick with the usual default VFAT formatting ?
28 > Might it be better to replace that with a Linux FS, eg Ext2 ?
29
30 The lowest overhead is when you write the back-up to a raw partition
31 of the same size, e.g. of=/dev/sdb1. You can also write it to a
32 filesystem, which might make it easier to manage multiple back-ups.
33 Since all permissions etc. are stored in the back-up file, the choice
34 of file system does not really matter, though the back-up file might be
35 too large for VFAT (max ~4 GiB).
36
37 Sincerely,
38
39 Bas
40
41 --
42 Sebastiaan L. Zoutendijk | slzoutendijk@×××××.com