[lug] Moving / partition to a new disk

Collins Richey crichey at gmail.com
Fri Dec 10 06:52:08 MST 2004


On Fri, 10 Dec 2004 00:01:27 -0700, Zan Lynx <zlynx at acm.org> wrote:
> On Thu, 2004-12-09 at 20:16 -0800, Michael Kahn wrote:
> > So, what is the magical collection of command switches
> > that would ensure that the copy into the new partition
> > creates a faithful copy of the old partition's file
> > structure? Since the new partition size will be larger than
> > the old partition, I am not seeking a sector-by-sector image
> > type of copy.
> 
> cp -a

If it's just a non-root partition, cp -a will work fine for the whole
thing. To clone a root partition, I create the desired directory
structure on /mnt/somewhere, then copy all the wanted directories with
cp -a /bin/* /mnt/somewhere/bin (repeat for each directory). Be sure
to omit /mnt (just mount points)  /proc /sys (in memory file systems) 
/tmp (why copy tmp stuff?). If copying an active system, drop to
single user mode first.

I put all of this into a simple bash script. If you want a copy, let
me know. It's really plain jane stuff. If you use it, check to see
that all your directories are covered. Some distros add a few unusual
directories to the root partition.

HTH,
-- 
 Collins



More information about the LUG mailing list