[Gllug] moving system from one disc to another

Philip Hands phil at hands.com
Wed Sep 1 12:43:18 UTC 2010


On Tue, 31 Aug 2010 15:07:40 +0100, John Hearns <hearnsj at googlemail.com> wrote:
> I would boot from Knoppix, format the new disk with whatever partition
> sizes you want,
> then rsync the partitions over.

While you have the chance, I'd rearrange the partitions so that you have
most of the disk allocated as LVM, with only root and boot partitions
as real partitions -- it's possible to put root on LVM as well, but I
think that makes disaster recovery harder.

My personal preference is to slice the disk up into partitions allocated
as RAID1 mirrors, something like:

   /dev/sd_1    /dev/md0    /boot
   /dev/sd_2    /dev/md1    /

   /dev/sd_5    /dev/md5    LVM pv
      ...
   /dev/sd_N    /dev/mdN    LVM pv

In the above scenario, I'd then make /dev/md[5-N] PVs for LVM.

The reason to have them as mirrors (even though you only have one disk)
is that next time you need to migrate, you just add the new disk,
partition it, add the new partitions to the raids, wait for /dev/md0 to
sync up, install GRUB or whatever, and then you can swap the disks.

If you install mbr on the MBR, with grub on the start of /dev/md0 then
you don't need to worry about the problem of installing a new grub,
which is cute.

This takes advantage of the fact that you can create a degraded RAID1
with only one disk by declaring the other disk as "missing" (see
mdadm(8) CREATE MODE).  You can always add the old disk into the RAID
once you've got the data off it, to protect the OS on the system -- I
normally create a volume group for raided stuff, and another for
non-raid, and stick stuff like polipo caches on the un-mirrored bit of
the bigger disk.

The reason for chopping the rest of the disk up into a few chunks is that it
allows you to be more flexible.  You get to migrate volumes around using
pvmove which might otherwise be too big to move.

It is possible to do all that booting from the old disk, but probably
rather easier to do it from a live CD -- if you do a live CD, do make
sure that the packages and kernel required to support new features like
RAID and LVM exist on the new disk.

BTW the -x option to cp and rsync is useful for copying partitions around
without descending into /proc etc.  I tend to favour:

 cd /top/of/partition ; cp -avx . /mnt/...

Cheers, Phil.
-- 
|)|  Philip Hands [+44 (0)20 8530 9560]    http://www.hands.com/
|-|  HANDS.COM Ltd.                    http://www.uk.debian.org/
|(|  10 Onslow Gardens, South Woodford, London  E18 1NE  ENGLAND
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list