[wplug] Backing up (cloning) to a smaller drive...

Bryan J. Smith thebs413 at yahoo.com
Mon Aug 13 18:23:05 EDT 2007


Jonathan Billings <billings at negate.org> wrote:
> I assume that you aren't using the full capacity of the original
> drive, so you could always copy the data from one disk to the
other,
> without needing to clone the filesystem.
> One thing you could do is this:
> I assume you have /dev/Old/Root as /, and /dev/New/Root as the new
> disk, at /mnt/newroot.  I'd then run:
> cd /mnt/newroot;
> /sbin/dump 0f - / | /sbin/restore rf -
> That'll copy all the data from / to /mnt/newroot.  Since this is
> LVM, I suspect you'll also have to create and copy a /boot
> partition too, which isn't in LVM.

Completely mirror Jonathan's recommendations here.  If you can, use
the native inode filesystem dump tools, which copy all Extended
Attributes (at least Ext3 does as of more recent e2fsprogs releases).

If you're using LVM, you're going to run into some naming issues in
your grub.conf and /etc/fstab, but they are easily accommodated. 
I.e., you probably want to create a new Volume Group for the new
drive, and your boot/fstab will need to be modified.


scoob8000 <scoob8000 at gmail.com> wrote:
> I guess I left a few details out.  :(
> The new drive is actually in a second machine with identical
> hardware as the first.
> I was tasked with putting together a server with the hardware we
> had at hand.  I was asked to make a second box the same as the
> first so if it would ever die, anybody would be able to unplug
> it and plug the backup unit in.

It might be because I've worked on too long as a consultant, but that
throws up the liability/negligence flag.  But I won't go there.

> You are correct in that the 40gb drives are nowheres near full.
> Typically I would use DD and Netcat for this.  Which is how I
> learned my second drive is just slightly smaller than the first.
> Assuming the end of the drive is all zero's, is it safe to
> just ignore any errors I receive?

Ahhh, _no_.  Inode (or inode compatible) filesystems have
pre-allocated blocks.  In the case of Ext3, inode blocks are also
pre-allocated.  In fact, I haven't seen any common block filesystem
design (sans Universal Device Format, UDF, which can be either
character stream/pre-mastered or block pre-allocated) that isn't
pre-allocated.

The requirement to use "dd" is more of an non-UNIX, FAT filesystem
concept (long story).  Inode filesystems are easily "dumped" into a
stream and can be "put back together" on any new geometry (whereas
FAT screams when the geometry differs in many cases, long story).

Learn to use dump in/out pipe (as well as tar pipe or find|cpio
passthru).  It is very, very useful when you start dealing with
moving network filesystems.  It's UNIX sysadmin 101, and it's easy
once you get used to it.

You'd only, maybe want to use dd preserve LVM.  But even the LVM
tools have commands for copying the meta-data.  In all honesty, I
don't recommend having disks with the same LVM meta-data though.



-- 
Bryan J. Smith   Professional, Technical Annoyance
b.j.smith at ieee.org    http://thebs413.blogspot.com
--------------------------------------------------
     Fission Power:  An Inconvenient Solution


More information about the wplug mailing list