[linux-lvm] 2 LVM questions

Eric M. Hopper hopper at omnifarious.org
Fri Jul 20 14:28:28 UTC 2001


On Fri, Jul 20, 2001 at 04:34:15PM +0300, moka at hol.gr wrote:
> 
> Hi there, new to LVM, so I would appreciate if you can 
> point me to answers to these questions:
> 
> 1) I have a system with 3 hard disks, and only one of 
> them is presently used. This contains boot, root and 
> swap plus a logical  partition(not LVM) containing
> /var and /home.
> 
> I have big database tables, so I would like
>  to create one volume group consisting of the 2
>  unused disks plus the /var. Is this possible
>  without losing what is in /var?
> 2) The reason I need  a lot of space is that mysql
>   which I am using stores the database tables in /var.
>  Can I somehow "name" the volume group /var
>   so that mysql will not be confused?

	I would use pvcreate on your two disks, then vgcreate to bind
them together in a volume group.  A volume group is like a virtual disk
drive.  You have to 'partition' it.  This is what creating a 'logical'
volume us.  lvcreate is used for tihs.  You can create a logical volume
named whatever you want, but that name has nothing to do with where it's
mounted.

	Now, supposing you created a volume group called 'MyOnlyVG' and
created a logical volume on it called 'LVMvar', you now need to do a
mkfs on that logical volume.

mkfs /dev/MyOnlyVG/LVMvar

	After you do this, you should move the contents of /var to your
new filesystem.

mount /dev/MyOnlyVG/LVMvar /mnt/tmp
cp -ax /var /mnt/tmp

	Now, you can try using your new logical volume as '/var'.  I
think you can do this by going to single user mode then doing:

unmount /var
mount /dev/MyOnlyVG/LVMvar /var
init 3  # Goes back to multi-user mode.  init 5 for graphical login

	If everything seems to work fine, your new var should be OK.

	Now you can run pvcreate on your old /var device, run vgextend
to add it to the MyOnlyVG volume group, lvextend to resize the
/dev/MyOnlyVG/LVMvar logical volume/virtual partition, and a file system
resize utility to modifiy the size of the /var filesystem.

Have fun (if at all possible),
-- 
"It does me no injury for my neighbor to say there are twenty gods or no God.
It neither picks my pocket nor breaks my leg."  --- Thomas Jefferson
"Go to Heaven for the climate, Hell for the company."  -- Mark Twain
-- Eric Hopper (hopper at omnifarious.org  http://www.omnifarious.org/~hopper) --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20010720/e9c3a00b/attachment.sig>


More information about the linux-lvm mailing list