[TriLUG] HDD Migration

Scott G. Hall ScottGHall at BellSouth.Net
Thu Jan 6 16:25:39 EST 2005


On 01/06/2005 14:19 EST, Jason Browne wrote:
> I am trying to get some tips on migrating an install of Linux to
> another, bigger HDD?  It is a straight 1 HDD to 1 HDD change...
> I know I could use dd, but I am trying to see if there is a better
> way.
> 
> Thanks
> Jason

If you are using the exact same kernel and type of harddisk (ie. IDE,
or SCSI, not a mix), then I would approach it like this:

1) Reinstall the OS on the new drive -- don't bother with much
    configuration or updates, except as to set partition and volume
    sizes.
2) Connect the old drive to a spare port, and mount it in the new
    install (several mounts if several partitions).
3) Use 'find|cpio' to copy all of the files from an old partition
    to its corresponding new location:

	cd _mountpoint_of_old_partition_
	find . -print -depth |cpio -pdumanV _location_of_new_directory_

    - the "-depth" find flag causes directories to be listed after their
      files, upon which the "-ma" cpio flags reset the permission and
      access times of the directories after the files are copied in it
4) Make sure or reset the boot loader to correctly point to your desired
    kernel.

Note: I prefer _cpio_ over _tar_ for this, but with the right flags,
either can be used -- just make sure to set to copy links, not follow
them, and to copy special files such as devices and FIFO's and such.

-- 
Scott G. Hall
Raleigh, NC, USA
ScottGHall at BellSouth.Net



More information about the TriLUG mailing list