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

Re: LVM: combining two logical volumes, how?



On 05/26/11 at 02:40pm, Boyd Stephen Smith Jr. wrote:
> In <[🔎] 4DDE7E85.50304@heard.name>, Ken Heard wrote:
> >In a box with Squeeze I have one volume group (VG1) with only one (at
> >the moment) physical volume (/dev/md1).  Two of the six current logical
> >volumes (LV) in VG1 are are /dev/VG1/root (/) and /dev/VG1/usr.  I want
> >to (1) enlarge /dev/VG1/root, (2) transfer the contents of /dev/VG1/usr
> >to it, and (3) remove /dev/VG1/usr.
> >
> >Enlarging /dev/VG1/root is easy (I think) using the lvextend command,
> >and so is removing /dev/VG1/usr using the lvremove command.  What I
> >cannot find is any command or information to do the second step,
> >transfer the entire contents of one LV to another.  Is it possible to do
> >what I want to do?
> 
> You would do that via cp, rsync, etc.
> 
> Something like this could work:
> mount -o bind / /mnt
> # view of the / file systems without any other mounts under /mnt
> mount -o remount,ro /usr # Make sure no one is writing to the /usr file system
> rsync -HaAxX --progress --stats /usr/. /mnt/usr
> # Copy the data, including hard links, acls, and extended attributes
> umount /mnt # Remove the view
> sync;sync;sync # Precaution
> umount /usr
> # Fully unmount /usr, exposing the copy created on the / file system

If this is a live filesystem, your best bet is to boot up with a liveCD or boot disk, basically any other OS so writes won't be happening to /usr when you go to move it into the newly-extended root LV. 

--
Liam

Attachment: signature.asc
Description: Digital signature


Reply to: