[NTLUG:Discuss] How to move data from one drive to another

Bryan J. Smith b.j.smith at ieee.org
Thu Aug 4 21:00:59 CDT 2005


On Thu, 2005-08-04 at 16:20 -0500, Stuart Johnston wrote:
> I've used that method a few times (after booting with Knoppix) and never 
> had any trouble.

I typically try to use the distro's CD and recovery mode.  For Ext3 and
XFS, it shouldn't matter, but with ReiserFS, you're asking for a world
of hurt if your implementation doesn't match exactly.

> When similar questions have been asked on this list before, some people
> have reported problems if the disk geometries are not similar enough. 

Yep, you should have the _exact_ same number of logical heads/sectors.
Otherwise, this alternative approach always works.  I recommend you do
it from run-level 1 (or even init=/bin/sh).

  1.  Slice (partition) new disk and create new filesystems

NOTE: If you're using filesystem labels, we sure you enter them
appropriate under #4 below.

  2.  Create a new mount point, say /newroot, and mount new filesystem
tree under /newroot

NOTE A:  You do _not_ need a 1:1 filesystem setup, you can change your
filesystem organization if you wish.

NOTE B:  Also remember that /newroot/tmp, if a separate filesystem,
should be chmod 1777, although #3 might correct this anyway).

  3.  Copy all existing data as follows ...

  for i in / /fs1 /fs2 ...; do
    cd $i
    find . -mount | cpio -pmdv /newroot$i
  done

You can make this one line with:  
  # for i in / /fs1 /fs2 ...; do cd $i; find . -mount | cpio -pmdv /newroot$i; done

NOTE A:  The list of filesystems should be the _original_, not the new
ones.  Using the "-mount" (sometimes "-xdev" on other implementations)
option to find does not cross filesystems, hence why you pass the
existing filesystems.  The new tree will be populated as appropriate.

NOTE B:  Spare files may be expanded after this operation and take up
more disk space, depending on the filesystem(s) in use.

  4.  Modify /newroot/etc/fstab, /newroot/etc/grub.conf (or lilo.conf),
      etc... as appropriate

  6.  Re-install GRUB/LILO to new disk

NOTE:  You _may_ need to boot the distro's CD and recovery mode after
you remove the former disk for proper BIOS-Linux device disk mapping.
I've been able to do so in LILO without, but GRUB always seems to never
like the fact that my mappings don't line up until I make them actual.

> If it doesn't work though, you won't have lost anything other than a
> little time and effort.  Just make sure you get your 'of's and 'if's
> right!

Also note potential dual-boot issues with Windows.

At this point with XP SP2 and various hotfixes, I recommend your C: (NT
terminology: "System" partition, ironically not "Boot" which is \WINNT)
filesystem _never_ be bigger than 32GiB.  It seems Microsoft is now
using portions of the MBR to store geometry/boot data if your C:
filesystem is larger than 32GiB, and it will overwrite portions of GRUB.
If you re-install GRUB it will overwrite portions of it, and leave your
Windows boot useless.


-- 
Bryan J. Smith     b.j.smith at ieee.org     http://thebs413.blogspot.com
----------------------------------------------------------------------
The best things in life are NOT free - which is why life is easiest if
you save all the bills until you can share them with the perfect woman





More information about the Discuss mailing list