Richard Freeman on 10 Dec 2009 08:19:45 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] LVM partition re-arrangement?


On 12/10/2009 09:31 AM, Mike Sheinberg wrote:
> and I want to move the /var and /tmp partitions (only) to a new
> hard-disk. Can anyone provide me with some pointers on the best way to
> accomplish this? Is there anything inherently wrong with just copying
> over that data and remounting the /var to the new disk? Obviously I want
> to ensure the /home partition doesn't break from the LV.

Just to confirm - I take it that you're not just going to add the new 
disk to the old volume group?  If you do that then you can actually use 
LVM to move the partitions while they're still mounted.

If the new disk is not going to be part of LVM then you'll need to do 
exactly what you propose - copy the data, change your fstab, unmount and 
re-mount /tmp and /var, and then at your leisure you can delete the old 
partitions (presumably after you're happy that all is well).

Note that lots of process write to /var and /tmp all the time, so this 
is best done in single-user mode with all non-essential processes killed 
from a console.  Or, you can do it from a rescue disk (getting LVM 
running might be tricky that way, however).

As a tangent - if you don't need to preserve the contents of /tmp 
between boots you might consider putting /tmp on a tmpfs (just make sure 
you have enough swap).  At worst it will cause swapping and be about the 
same as having it on disk in the first place, and at best a lot of stuff 
that gets written there never ends up on disk at all.  On Gentoo doing 
this with /var/tmp makes a huge difference since compiling generates 
tons of intermediate files that have no long-term value.  On something 
like Ubuntu I doubt that too much goes in /tmp in the first place 
(mostly lock files, sockets, editor buffers, etc).  If you do put /tmp 
on a tmpfs you might want to create another place to hold stuff that you 
want to survive reboots but where you can still use tmpreaper to keep it 
under control.

If your new drive is going into the same LVM volume group there are some 
great howtos online and I can probably dust off the instructions.  I've 
done it before, but it has been a little while...
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug