Skip to contentSkip to conversation

2 LVM questions

linux-lvm [email protected] 5 participants 5 messages Jul 20, 2001

lore
Share & tools
lore
#0 lore raw

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?

Thanks in advance,
S.Alexiou

#1 lore raw

-- [email protected] on 07/20/01 16:34:15 +0300

Quoted 5 lines

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.

Quoted 8 lines

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?

Leave the partitions you need in single user off of LVM. They may be necessary for fixing LVM at some point (unless you enjoy booting from floppies). In general the contents of / (excluding /usr), /var and primary swap are a good bet to keep off of LVM.

Creating the volume groups to hold this data will require blowing it off. Simplest fix is to:

Back the stuff up completely.
Create two PV's from the 2 "extra" drives. Add the two PV'S into a single VG.
Build your file systems (striping might
be a useful idea or mirroring if you need the availability).
Mount the new LV's under wherever the old
partitions were mounted.
Restore the data.

You probably aren't using all of "/var" for the MySQL database. Whatever the directory you now are using (e.g., /var/MySQL) can easily become a mount point without the database even knowing about it.

sl

#2 lore raw
In reply to [email protected]
Quoted 9 lines · On Fri, Jul 20, 2001 at 04:34:15PM +0300, [email protected] 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.

Quoted 8 lines

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),

Signature · 4 lines
"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 ([email protected]  http://www.omnifarious.org/~hopper) --
#3 lore raw
In reply to [email protected]

What I would do is:

1. Create a Volume group using the 2 unused hard disks.
2. Create a file system on the new Logical volume
3. Copy your /var directory to the new filesystem mounted as /var2 (shutdown Mysql first so the data is clean).
4. Move /var to /var3 (mv /var /var3)
5. Mount new file system as /var

When you are satisfied that everything is working on LVM fine you can then delete the partition that /var3 is on (old /var) and use it to extend your logical volume.

Quoted 23 lines · [email protected] 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?

Thanks in advance,
S.Alexiou

_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html

#4 lore raw
In reply to [email protected]
Quoted 3 lines · On Fri, Jul 20, 2001 at 04:34:15PM +0300, [email protected] wrote:

Hi there, new to LVM, so I would appreciate if you can point me to answers to these questions:

First off, if you're new to LVM do not be tempted to try and run root off an LV.

Quoted 9 lines

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?

I suggest you create a volume group from the 2 spare disks.

create an lv big enough for var

format it and copy var into it and adjust /etc/fstab accordingly

at this point the old var can be added to the vg with vgextend, however I would keep it around for a while until you are sure you have set things up correctly.

Quoted 4 lines

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?

mount the logical volume on /var

- Joe