Moving the root partition

Atro Tossavainen yellowdog-general@lists.terrasoftsolutions.com
Thu Jan 30 07:43:00 2003


> > I moved all the boot files to the new boot partition using cp -a .
> 
> There is probably a better way to do this, but I used cp -a once. Just
> don't do a 'cp -a *'! 

There is.  dump and restore are what should be used for this.

# dump 0f - / | (cd /newroot; restore rf -)

Do this in single user mode.  All mount points will be copied properly,
including /proc.  Files on other partitions will not be touched at all.

If the old file system is reiserfs, dump doesn't work.  The same may
apply in various shapes and forms for other non-ext2 filesystems.
In that case, tar will do just fine.

# cd /
# tar cf - / --exclude=/proc --exclude=/newroot | tar xv -C/newroot -f-

Do that in single user mode, too.  You'll need to create the /proc
directory on the new root partition by hand.  Files on other partitions
will be copied to the new root, so keep adding --exclude statements if
you don't want them to.

-- 
Atro Tossavainen (Mr.)               / The Institute of Biotechnology at
Systems Analyst, Techno-Amish &     / the University of Helsinki, Finland,
+358-9-19158939  UNIX Dinosaur     / employs me, but my opinions are my own.
< URL : http : / / www . iki . fi / atro . tossavainen / >

File attachments NOT welcome unless agreed to beforehand.