|
Moving partitions between drives |
|
|
|
|
Written by Rick Phillips
|
|
Thursday, 21 April 2005 |
|
I am facing this problem at work - my
original partition configuration seemed to be right at the time but
is now no longer appropriate and we are about to run out of room.
Partition Magic would solve the problem under normal circumstances
but unfortunately, we have "home" on a drive on its own and
"var" on another drive with other partitions and not much
room. What we are storing in var is growing fast and it will
have to be moved. One could probably set up a symlink but
that's a bit kludgy and prone to failure.
As luck would have
it, following exchange has just occurred on another list and I
thought I would publish it here.
Here's the problem as stated -
"I've
got a machine that has everything on one partition, which was OK at
the time, but is causing some pain now. I've got a free partition and
I want to move /usr from the root partition to the newly formatted
partition *without* kill anything that currently works."
Here
are some solutions -
cp
-L -preserve=all -r /usr /mnt/hda6
"but
some links weren't being created. I'm currently using midnight
commander to do this[1], but I want to know the right way to get it
done with cp.
midnight
commander did preserve, so it is done correctly, but I feel dirty
doing it this way. What is the "right" way to do this with
cp?"
OR
pax -rwvtpe /usr /mnt/hda6
Drop
the 'v' if you don't want to see what it's doing.
If
you don't have pax, the next tool to try is tar(1):
tar -cf- /usr | ( cd /mnt/hda6 ; tar
-xvf- )
Again,
drop the 'v' as above.
OR
cd
/usr find
. | cpio -pm /mnt/hda6
One
should change to single user mode before doing this and of course,
log on as root.
|
|
Last Updated ( Thursday, 21 April 2005 )
|