1 |
On Fri, Aug 24, 2018 at 6:09 AM Mick <michaelkintzios@×××××.com> wrote: |
2 |
> |
3 |
> However, you may prefer to use clonezilla instead of dd. The dd command will |
4 |
> copy each and every bit and byte of the partition whether it has data on it or |
5 |
> not. It is not particularly efficient. Clonezilla will perform better at |
6 |
> this task. |
7 |
> |
8 |
> Personally, I would only keep a back up of the filesystem contents with e.g. |
9 |
> rsync, and reformat the partition and restore its contents in the case of a |
10 |
> disaster recovery scenario. |
11 |
|
12 |
Just to summarize the sorts of options you have: |
13 |
|
14 |
dd = bit level copy. Output is the size of the partition, period, |
15 |
though you could compress the output by piping it into a compression |
16 |
utility/etc. Restored partition is identical to original, including |
17 |
unallocated space, file fragmentation, etc. |
18 |
|
19 |
clonezilla/partimage/etc = sparse bit level copy. Output is the size |
20 |
of all blocks that contain useful data, and can be further compressed. |
21 |
Restored partition will contain zeros in the place of free space, but |
22 |
will still preserve file fragmentation, special filesystem features, |
23 |
etc. Basically these tools operate like dd at a block level, but they |
24 |
first identify which blocks are used/unused. Savings is minimal for a |
25 |
full filesystem, and substantial for a near-empty one. These tools |
26 |
will fall back to dd if they can't identify free space, and can |
27 |
support a wider variety of filesystems quickly because they don't have |
28 |
to be able to mount/read the filesystem, just figure out which blocks |
29 |
matter. I'll also note that with clonezilla you get a fairly nice |
30 |
all-in-one bootable image that can store these images remotely via |
31 |
ssh/samba/etc, which makes restoring images onto bare metal very easy. |
32 |
|
33 |
tar/rsync/etc = file level copy. Output is the logical size of all |
34 |
the files on the filesystem. Restore partition will only contain file |
35 |
contents - details like fragmentation, trailing unused space in |
36 |
blocks, unused space in general, or many filesystem-specific features |
37 |
like snapshots/etc will NOT be preserved. On the other hand it is |
38 |
trivial to restore this data to any filesystem of any type of any |
39 |
sufficient size. The other solutions make resizing or changing |
40 |
filesystems more-or-less impossible unless you can mount the image |
41 |
files and then do a subsequent file-level copy (which is no different |
42 |
than doing a file level copy in the first place). |
43 |
|
44 |
I'd toss in one other general category: |
45 |
|
46 |
dump/send/etc - filesystem-specific serializing tools. The tools are |
47 |
specific to the filesystem, so you can't just point them at a whole |
48 |
hard drive with varying partition types like you can with clonezilla. |
49 |
They may or may not reproduce details like fragmentation, but they |
50 |
will efficiently store the actual data and will reproduce all |
51 |
filesystem-specific features (snapshots, special attributes, etc). |
52 |
They may also contain features that make them more efficient |
53 |
(especially for incremental backups) because they can use an algorithm |
54 |
suited for the low-level data structures employed by the filesystem, |
55 |
instead of doing scanning at the file/directory level. For example, |
56 |
it could just read all the metadata on the disk sequentially as it is |
57 |
physically stored on the disk, instead of traversing it from root down |
58 |
to leaf in the directory hierarchy which could result in lots of |
59 |
seeks. Filesystems like btrfs/zfs have data structures that make it |
60 |
VERY efficient to compare two related snapshots and find just the |
61 |
differences between them, including differences of one block in the |
62 |
middle of a large file without having to read the whole file. |
63 |
Restoration usually is flexible with regard to filesystem size, but |
64 |
not type. That is, if you have a 100GB filesystem with 20GB of data, |
65 |
you could restore it to a 30GB filesystem of the same type, but not |
66 |
one of a different type as with tar. |
67 |
|
68 |
The best solution for you obviously depends on your needs. I try to |
69 |
go with the last category in general as it is far more efficient. |
70 |
But, clonezilla is my general tool for replicating whole systems/etc |
71 |
since it does that so well and works with anything. For partial |
72 |
backups of high-value data I use duplicity, which is file-level (and |
73 |
supports various cloud/etc options for storage). |
74 |
|
75 |
-- |
76 |
Rich |