[TriLUG] Moving /home and others to new partitions
Joel Ebel
jbebel at ncsu.edu
Tue Jan 18 11:04:00 EST 2005
Steve Litt wrote:
> On Tuesday 18 January 2005 10:24 am, Rick DeNatale wrote:
>
>
>>Some time ago, with advice from the list, I added a couple of 180GB
>>IDE/ATA drives to my system which was running on two 9GB SCSI drives.
>>I've now gotten to the point where one of the SCSI drives is near to
>>overflowing so I need to move some stuff to one or more partitions on
>>the big disks.
>
> [clip]
>
>>What's the best way to accomplish this safely? I know that I need to
>>create a partition for each of these, temporarily mount it, cp the
>>files, test the copy, delete the files from the original location and
>>then remount to the (now empty) original directory.
>>
>>so as an example I'm thinking to move the /public directory
>>
>>1) Fdisk to create partitions and make filesystems
>>2) sudo mount /dev/hdcx /mnt/temp
>>3) Stop samba, atalk, cron services
>>4) sudo cp -al /public /mnt/temp
>>5) test somehow that the copy worked. Suggestions?
>>6) sudo rm -Rf /public/*
>>7) restart services
>
>
> Without addressing any of your other questions, I'd like to give some advice
> on the copy. Most people accomplish this type of tree copy not with the cp -R
> command, but with either tar or cpio. The reason is that these archiving
> utilities really do a good job with ownership, permissions, timestamps,
> hardlinks and symlinks.
cp -R does not preserve these things. cp -a does. It is quite
sufficient. I'm not sure you want the -l, as that's for creating hard
links. Since you're copying to a new drive that doesn't seem like what
you want to do.
As for testing the copy, I'd recommend unmounting the new partition,
then remounting it. To make sure it's all there, you could run an rsync
and make sure it doesn't find any differences. Something like
rsync -av /public/ /mnt/temp/
Since you unmounted and remounted, you can be pretty sure it's there if
this rsync doesn't show anything.
And if you want to be certain, you can mv /public /public.bak for a few
days just to make sure everything is still working ok. Once you're
satisfied, delete it.
This operation is probably safe enough to do on a running system, but I
tend to play it safe and boot RUNT or Knoppix for doing things that mess
with the core filesystem stuff.
Joel
More information about the TriLUG
mailing list