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

Re: [linux-lvm] Newbie of LVM



On Fri, Dec 09, 2005 at 02:38:49PM -0500, Jeff Cousino wrote:
> But couldn't he set up his new drive with LVM copy the data from the
> old drive to it, provided it's large enough and then add the old drive
> to the group?
As long as he can get the downtime to do it, sure.  At that point the
device '/dev/md5' can be added as a PV and the volume grown.

However - to do that he'd need to unmount the existing volume, ideally
for the time it took to do the copy (although there are ways around
that). 

And also, the answer to the initial question is still no, since that's
just a different way to do it.

If the new storage device is big enough (and the solution wanted is not
a RAID that requires the existing disk space to build) then the
following would be a way to do it:

1. Create the PV/VG on the new disk (since it doesn't look as though LVM 
is in use at all on that machine, if it is then do as appropriate)
2. Create the new volume, and mount it under /mnt or something.
3. use rsync to get the two volumes (existing & new) in sync.  The
command I use is:
	rsync --delete-after -av /www /mnt
4. Arrange a downtime of at least 15 minutes, and during that move the
mount points around (after stopping all applications that use /www):
	rsync --delete-after -av /www /mnt # bring the copy up to date
	umount /mnt
	umount /www
	mount <LVM device> /www
5. Restart all the applications

Things to note about this are that not only does it require a lot of
disk space, but it also will be quite slow (especially if there are lots
of little files on /www).  If you start work well before you can arrange
the downtime (last time I did this I had everything in place and had to
wait 2 weeks for the window to do the rotation) then you can keep
running the rsync to keep the two copies closer together and therefore
keep the downtime to a minimum.

A shorter term solution would be to migrate some of the data off /www
and use symlinks.  That would still require a brief downtime to move
around the data - but it doesn't require the big hit.  (e.g. mount the
new partition as /www2 and then move /www/site1 to /www2/site1 and then
create a symlink /www/site1 to /www2/site1 - couple of other things to
be aware of, but that's the principle).


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