Is It Possible To Move Logical Volumes?

Chris Adams cmadams at hiwaay.net
Wed Aug 26 16:00:42 UTC 2009


Once upon a time, Dave Bacon <dbacon at mail.owls.lib.wi.us> said:
> This new server will primarily be an eMail server.  So I was thinking
> about moving /var and /home to /dev/sdb which has more space.  This will
> also place most of the data on the RAID5 drives and keep it separate
> from the OS RAID 1 drives.

I'd personally probably leave /var with the rest of the OS (if /var
isn't there, the OS is pretty much screwed anyway).  Also, /var/log gets
a lot of writes, especially on a mail server, so RAID 5 could be a
performance issue).  That's all just IMHO though.

> Could you please help answer my questions?
> 
>   1. Is it possible to relocate /var and /home to /dev/sdb using the LVM?

If the filesystems are on LVM already, then yes, this is easy and fairly
straight-forward.  I've never used the GUI tools, but the CLI tool
workflow would be something like:

- fdisk /dev/sdb
  make a single partition that covers the disk (type 8e for "Linux LVM")

- lvm
  1. pvcreate /dev/sdb
     makes /dev/sdb an LVM physical volume
  2. vgextend <VGName> /dev/sdb
     adds the new PV to your existing volume group
  3. pvmove -n <LVName> /dev/sdb
     moves the specified logical volume to the specified PV
     this step takes a while
  4. lvextend -L <newsize> <LVName> /dev/sdb
     increases the space allocated to the specified LV
  (repeat steps 3 and 4 for each additional LV)

- resize2fs -p /dev/<VGName></LVName>
  increases the size of the filesystem to use all of the LV
  (repeat for each additional filesystem)

-- 
Chris Adams <cmadams at hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.




More information about the redhat-sysadmin-list mailing list