LVM and Storage Model

maxprox

Renowned Member
Aug 23, 2011
423
60
93
Germany - Nordhessen
fair-comp.de
Hello,

I have a question about the Storage Model and LVM LVs.
I will create a Linux Small Business Server, maybe SME-Server or zentyal (Ubuntu LTS).
The Proxmox 1.8 host has two local 2TB hdd's (no Raid).
The first hdd with the standard LVM, VG=pve.
The second drive with one Physical Volume and a new Volume Group, VG=>hdd2.
My plan was to install the Linux SB-Server like the standard on hdd1 with a VM image around 30 GB.
The whole working Data around 300 GB I would save in the second drive and second VG=>hdd2 in
a separate Logical Volume "lv-home" for example as the mount point /home. So I can dump the
VM image (weekly, monthly) and backup the whole Data nigthly on an other machine ...

In the wiki I only found a way to install the whole VM in a (new) Volume Group,
which will create a new Logical Volume, but no way for my plan.
But I will have a "small" VM Image and a big Logical Volume for the files.


My Questions:
Is there a way for my plan?
Perhaps I have to mount the new Logical Volume "lv-home" in the Proxmox
host and integrate it as a directory?

Question2:
after all what I have read ext3 is surely the best filesystem at present - this correkt?

greetings

maxprox
 
Last edited:
I am not sure if I understand your questions but just install the OS using a disk image on the default local storage (mounted on /var/lib/vz).

and as you got a second storage (LVM, using the second phyicical drive), just add a second hard disk to your VM via the hardware tab.
 
I am not sure if I understand your questions but just install the OS using a disk image on the default local storage (mounted on /var/lib/vz).

Hello tom,

the first thing is clear and is done (install in /var/lib/vz/image/102)

and as you got a second storage (LVM, using the second phyicical drive), just add a second hard disk to your VM via the hardware tab.
Yes, that is what I don't find. On the second storage with a 2TB VG I will take a 300GB Logical Volume for this Server (102). How can I do it?
In the "Storage List" I only can add the whole VG (=> the whole 2TB storage). And also in the Hardware List for VM102 I can take than the whole VG.
How can I add a (e.g. a 300GB Logical Volume in this Server? For my part as a new storage, to mount it on e.g. /home in the VM102 (the SB-Server).
 
Last edited:
I have read it, but not understand all ...
Nevertheless the next step is done
Like the guide I build a new Storage (LVM-VG=2TB in Proxmox /dev/sdb EDIT: it is /dev/sdb1 not /dev/sdb ) then I have assigned 500 GB
from the VG to the VM (=>SB-Server)
In the VM appears a new 500GB hard drive /dev/vdb. With parted I Build a new Partition:
---------------
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 537GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17,4kB 537GB 537GB lvhome lvm
---------------------
And Build a Filesystem:
mkfs.ext3 -cc /dev/vdb1
---------------------

Is the option "-cc" in the VM nonsens?
Is the other correct?

My next question (sorry I'm new in Proxmox)
where In Proxmox I can find these virtual Storage:
--------------
proxmox:~# ls -alh /dev/platte2/
total 0
lrwxrwxrwx 1 root root 36 Aug 23 17:07 vm-102-disk-1 -> /dev/mapper/platte2-vm--102--disk--1
----------------
where "platte2" ist the VG, "platte2-vm--102--disk--1" is the new virtual Storage name.
But where I find the Image of it? Maybe I habe to mount something?
 
Last edited:
I have read it, but not understand all ...
Nevertheless the next step is done
Like the guide I build a new Storage (LVM-VG=2TB in Proxmox /dev/sdb)

you should not use /dev/sdb as a physical volume for LVM, create a big partition first and use /dev/sdb1 for LVM physical volume.

then I have assigned 500 GB
from the VG to the VM (=>SB-Server)
In the VM appears a new 500GB hard drive /dev/vdb. With parted I Build a new Partition:
---------------
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 537GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17,4kB 537GB 537GB lvhome lvm
---------------------
And Build a Filesystem:
mkfs.ext3 -cc /dev/vdb1
---------------------

Is the option "-cc" in the VM nonsens?
Is the other correct?

see 'man mkfs.ext3' for explanation. I assume it would be ok to use mkfs.ext3 without options.

My next question (sorry I'm new in Proxmox)
where In Proxmox I can find these virtual Storage:
--------------
proxmox:~# ls -alh /dev/platte2/
total 0
lrwxrwxrwx 1 root root 36 Aug 23 17:07 vm-102-disk-1 -> /dev/mapper/platte2-vm--102--disk--1
----------------
where "platte2" ist the VG, "platte2-vm--102--disk--1" is the new virtual Storage name.
But where I find the Image of it? Maybe I habe to mount something?

this is a LVM volume, a block device like /dev/sdxx. if you mount this also on the host you will corrupt your data as ext3 is no cluster filesystem.
 
...
But where I find the Image of it? Maybe I habe to mount something?
Hi,
look with "pvdisplay", "vgdisplay" and "lvdisplay" and you will see your lvm-config and also your vm-disk. It's not a filesystem which are filled with raw-disk-files.

You should also not mount the lv from the host when the VM is running! Due to the partition inside the lv it's not so easy to mount an lv inside the host (but possible with kpartx).

Udo
 
Hi,
look with "pvdisplay", "vgdisplay" and "lvdisplay" and you will see your lvm-config and also your vm-disk. It's not a filesystem which are filled with raw-disk-files.
You should also not mount the lv from the host when the VM is running! Due to the partition inside the lv it's not so easy to mount an lv inside the host (but possible with kpartx).
Udo

okay, I understand.

Thank you Tom and thank you Udo for the answer,

I know the LVM commands (have a book about it ;-)
@Tom: first I have build (with parted) one partition /dev/sdb1 of the whole second storage => 1:1 build a Physical Volume => and then a new
Volume Group:
Code:
vgdisplay -v platte2
...
VG Name               platte2
...
VG Size               1.82 TB
...
--- Logical volume ---
  LV Name                /dev/platte2/vm-102-disk-1
LV Size                500.00 GB
--- Physical volumes ---
  PV Name               /dev/sdb1
That is okay I think

My question is not related to LVM. I try it with my bad english in other words:

I am on the Proxmox host:
If I go to /var/lib/vz/image I see all the directorys of the VM Images
Code:
proxmox:~# ls -alh /var/lib/vz/images/
total 28K
drwxr-xr-x  7 root root 4.0K Aug 23 00:08 .
drwxr-xr-x 11 root root 4.0K Aug  4 23:20 ..
drwxr-xr-x  2 root root 4.0K Aug 23 00:08 102
drwxr-xr-x  2 root root 4.0K Aug 12 23:45 107
drwxrwxrwx  2 root root 4.0K Aug  4 22:47 205
drwxrwxrwx  2 root root 4.0K Aug  5 02:27 210
...
Also it is possible, for example by vzdump to backup these images, etc.
My question is, whether it is just one way to look at the image of the logical volumes (On Proxmox host: /dev/platte2/vm-102-disk-1
on the VM: the virtual disk =>/dev/vdb1) and to backup it by vzdump?

The images of the VMs are still in individual files in / var / lib / vz / images / ...
Aren't the virtual disks based on LVM (the logical volumes on Proxmox) also placed in such big files?
So that I can save, copy or vzdum them? Thats my question, which I don't understand?

Thank you for your patience
 
...
Also it is possible, for example by vzdump to backup these images, etc.
My question is, whether it is just one way to look at the image of the logical volumes (On Proxmox host: /dev/platte2/vm-102-disk-1
on the VM: the virtual disk =>/dev/vdb1) and to backup it by vzdump?

The images of the VMs are still in individual files in / var / lib / vz / images / ...
Aren't the virtual disks based on LVM (the logical volumes on Proxmox) also placed in such big files?
So that I can save, copy or vzdum them? Thats my question, which I don't understand?

Thank you for your patience
Hi,
vzdump backuped the whole lv - before that it's create an lvm-snapshot (so you need free space in the vg).
See the content of an backup:
Code:
tar tvzf vzdump-qemu-117-2011_08_23-02_00_02.tgz
-rw-r--r-- root/root       419 2011-08-23 02:00 qemu-server.conf
-rw-r--r-- root/root 12884901888 2011-08-23 02:00 vm-disk-virtio0.raw

grep disk-  /etc/qemu-server/117.conf
virtio0: a_sas_r0:vm-117-disk-1

Udo
 
Hi,
vzdump backuped the whole lv - before that it's create an lvm-snapshot (so you need free space in the vg).
See the content of an backup:
Code:
tar tvzf vzdump-qemu-117-2011_08_23-02_00_02.tgz
-rw-r--r-- root/root       419 2011-08-23 02:00 qemu-server.conf
-rw-r--r-- root/root 12884901888 2011-08-23 02:00 vm-disk-virtio0.raw

grep disk-  /etc/qemu-server/117.conf
virtio0: a_sas_r0:vm-117-disk-1
Udo

okay.
But you have ONE image file *.raw
(You have the whole VM in one logical volume, the System and Data - right?)
I would like to have the system (Linux) and the data (/home) separately, with separately backup methods.
My virtual machine is based and install on a normal proxmox Image
Code:
proxmox:/var/lib/vz/images# ls -alh 102/
total 2.3G
drwxr-xr-x 2 root root 4.0K Aug 23 00:08 .
drwxr-xr-x 7 root root 4.0K Aug 23 00:08 ..
-rw-r--r-- 1 root root 2.3G Aug 23 20:47 vm-102-disk-1.qcow2

Then I added a second hard disk, I will mount in the VM as /home
Code:
In Proxmox host:
--- Logical volume ---
  LV Name   /dev/platte2/vm-102-disk-1
In the VM:
second disk /dev/vdb1: 537GB ext3  with mount point /home

The first and main question:
Is it possible with vzdump only the first disk (vm-102-disk-1.qcow2) WITHOUT the second hard drive (/dev/platte2/vm-102-disk-1) to back up?

Just to understand better, the question still remains (but not so importent- I have to work with ... ;-) :
The standard virtual disks for the VMs are in individual files in /var/lib/vz/images/ ...
Aren't the virtual disks based on LVM (logical volumes on Proxmox) also placed in such big files?
So that I can save, copy or vzdump them separately? Thats my question?

I'm trying to give myself the answer:
NO! I have to work here with the LVM tools and commands.
Right?
 
Last edited by a moderator:
..
The first and main question:
Is it possible with vzdump only the first disk (vm-102-disk-1.qcow2) WITHOUT the second hard drive (/dev/platte2/vm-102-disk-1) to back up?

yes, using the flag 'backup=no' (you need to add this in your VMID.conf file of your VM, see also 'man vzdump')

Just to understand better, the question still remains (but not so importent- I have to work with ... ;-) :
The standard virtual disks for the VMs are in individual files in /var/lib/vz/images/ ...
Aren't the virtual disks based on LVM (logical volumes on Proxmox) also placed in such big files?

no, a lvm logical volumes is just a block devices, means they are not on the base file system and you cannot access them on the host on the file level. only tools like dd can access them (like vzdump).

So that I can save, copy or vzdump them separately? Thats my question?

I'm trying to give myself the answer:
NO! I have to work here with the LVM tools and commands.
Right?

the tool you need is vzdump.
 
Tom, you say: "you should not use /dev/sdb as a physical volume for LVM, create a big partition first and use /dev/sdb1 for LVM physical volume."
Why? "pvcreate - initialize a disk or partition for use by LVM", I thought that was just a matter of which situation fits your needs better. What problem will I face using the entire disk?
Thanks
 
Tom, you say: "you should not use /dev/sdb as a physical volume for LVM, create a big partition first and
use /dev/sdb1 for LVM physical volume."
Why? "pvcreate - initialize a disk or partition for use by LVM", I thought that was just a matter of which situation fits your needs better. What problem will I face using the entire disk?
Thanks

Hello mmenaz,

with /dev/sdb1 I also have the entire disk.
1 I create a physical partition (with parted, Partition Table: gpt, you also can set the Part. Flag = lvm)
Code:
parted -l 
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  2000GB  2000GB               primary  lvm

2 create a physical volume
Code:
pvcreate -v /dev/sdb1
proxmox:~# pvdisplay /dev/sdb1
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               platte2
  PV Size               1.82 TB / not usable 1.05 MB


3 create the volume group
Code:
vgcreate -v newVG name /dev/sdb1 
oxmox:~# vgdisplay platte2  
  --- Volume group ---
  VG Name               platte2
  Format                lvm2
 ......
  VG Size               1.82 TB   => the whole second hdd

whole second hdd => one partition => one PV => in one VG = one new Storage in Proxmox

About the Web interface I can now, fom this VG (in proxmox a storage in the storage list), assign to each virtual machine, the amount I want. Also one everything. This then results in the logical volume ...
(if I have understood correctly ;-)

maxprox
 
Last edited:
one more question:
When I perform a backup with vzdump on the remote ssh console. Including the entire virtual machine, including the second hard disk (the VM is not active - shut down).
in proxmox:
Code:
 vzdump --compress --stop --dumpdir smeserver/ 103
...
INFO: adding '/var/lib/vz/images/103/vm-103-disk-1.qcow2' to archive ('vm-disk-virtio0.qcow2')
INFO: adding '/dev/platte2/vm-103-disk-1' to archive ('vm-disk-virtio1.raw')
...

If this vzdump works, how can I determine the current memory usage?
I have tried the commands du, df and the LVM xxdisplay commands, but I see no change in memory consumption during vzdump runs.

regards
maxprox