[blfs-support] Complete Backup of {,B}LFS

akhiezer lfs65 at cruziero.com
Mon Dec 23 04:01:39 PST 2013

> Date: Mon, 23 Dec 2013 00:43:13 +0100
> From: Aleksandar Kuktin <akuktin at gmail.com>
> To: blfs-support at linuxfromscratch.org
> Subject: Re: [blfs-support] Complete Backup of {,B}LFS
> > >
> > This looks really interesting and I want to "play" with it. But what
> > I want *is* a clone, an exact copy, of what I have now.
> > 
> > Dan
> > 
> Well, in that case, dd is probably your friend.
> dd if=/dev/source of=/dev/destination bs=512
> Ofcourse, this only works if the destination partition is at least as
> big as the source partition. For best results, the two should be
> identical. If destination is bigger than the source, the extra space
> in the destination will be unused. I think I read somewhere that some
> program from e2fsprogs can be used to resize ext2/ext3 filesystems, but
> don't take my word for it. The other way of reclaiming the dead space

 - 'resize2fs', part of e2fsprogs pkg. (Has worked well here over the years, 
primarily used as part of resizing logical-volumes).

> is to resize partitions however this is a very touchy procedure, may
> not work on EFI/UEFI systems (depending on how they actually physically
> store partition information) and requires manually calculating offsets
> and filesystem and partition sizes. I did this once or twice (including
> recovering my HDD after accidentally overwriting the partition table)
> and can walk you through the process, but unless you *need* or *want*
> the modification timestamps on you directories to be exactly the same
> as on the original filesystem, you are much better off using cpio.
> Note that you can also clone devices with cat (and probably a host of
> other even more convoluted methods):
> cat < /dev/source > /dev/destination
> ...but dd is better because it prints out exact statistics on what it
> did while cat either prints nothing at all or just spits out a terse
> and not entirely informative error string.
> On the subject of cloning filesystems (as opposed to cloning devices),
> I come up blank with names of programs that can do that, even though
> there is probably at least one program that can do that.

'e2image' (part of e2fsprogs pkg) might be partly of some use there, in the 
wider-picture: but I'd say for the present task you really want dd or the 
find/cpio combination; either of them will do the job just fine. If you 
need 100% identical data - incl metadata, timestamps, &c - then I'd say use 
dd. Whereas, working at the filesystem-level - as you normally would with 
find/cpio, cp, tar, cat, &c - you run the 'risk' of at least some metadata 
(e.g. timestamps on dirs) being changed in source &/or target. IME, for 
working at the filesystem-level, the find/cpio combination will get you 
100% identical data-copy (I've never encountered find/cpio 'choking' on any 
filesys-objects), and near-100%-identical metadata-copy (e.g. via those '-a' 
& '-m' cpio flags).




More information about the blfs-support mailing list