I'm planning to use LVM for KVM, and when I try to create a VG it fails, so how can I create my VG and LV ?
Thanks
[root@server ~]# vgcreate virtual-machines /dev/sda
Device /dev/sda not found (or ignored by filtering).
Unable to add physical volume '/dev/sda' to volume group 'virtual-machines'.
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 2.0T 929G 976G 49% /
tmpfs 3.9G 124K 3.9G 1% /dev/shm
/dev/sda1 194M 57M 128M 31% /boot
[root@server ~]# pvscan
No matching physical volumes found
You need to have free space in your HD
Example
WRITE
CREATE PHYSICAL VOLUME
DISPLAY PHYSICAL VOLUMEN
CREATE A VOLUME GROUP
DISPLAY VOLUMEN GROUP
AND THEN CREATE YOUR LOGICAL VOLUMENS (to be used as the virtual disk for the DomU) INSIDE YOUR VOLUME GROUP
EXAMPLE (create a vaolume group of 50G for your centos virual machine)
:) Alex Dávila
vgcreate
just saved you from accidentally destroying all your data. Don't try this again until you fully understand what's going on.I recommend you familiarize yourself with at least these parts of the LVM HOWTO:
Remember that
/dev/sda
is already in use, so attempting to create LVM volumes on it will destroy any data currently there. You will need another hard drive, or at least another hard drive partition.Unfortunately, without knowing your setup, it's impossible for me to give more specific advice.
See also:
You can't use all of sda for LVM since you're already using several partitions on it for non-LVM uses. If you have a 3 TB drive, and you want to use the remaining space not used by sda1-3 (i'm assuming sda2 is swap), then you should create an extra partition (sda4, let's say), flag it as type 0x8e (Linux LVM), then run
pvcreate /dev/sda4
andvgcreate virtual-machines /dev/sda4
.I got the same error. But, after one reboot, the issue resolved. but other replies could be also the case.