Can't create LVM due to: not found (or ignored by filtering)

Solution 1:

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:

  • Anatomy of LVM
  • Common tasks

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:

  • A simple introduction to working with LVM

Solution 2:

You need to have free space in your HD

Example

# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a3dd7

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     4196351     2097152   83  Linux
/dev/sda2         4196352   172148735    83976192   8e  Linux LVM

CREATE NEW PARTITION
Command (m for help): n
Partition type:
p   primary (2 primary, 0 extended, 2 free)
e   extended
Select (default p): p
Partition number (1-4, default 3):
Using default value 3
First sector (172148736-1953525167, default 172148736):
Using default value 172148736
Last sector, +sectors or +size{K,M,G} (172148736-1953525167, default 1953525167):
Using default value 1953525167
Partition 3 of type Linux and of size 849.4 GiB is set

WRITE

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

# partprobe

CREATE PHYSICAL VOLUME

# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created

DISPLAY PHYSICAL VOLUMEN

# pvdisplay
--- Physical volume ---
PV Name               /dev/sda2
VG Name               fedora_fed18
PV Size               80.09 GiB / not usable 4.00 MiB
Allocatable           yes
PE Size               4.00 MiB
Total PE              20501
Free PE               1
Allocated PE          20500
PV UUID               1BWm7E-M3Z8-WFJQ-vLRI-eUqa-MfPm-6x2mef

"/dev/sda3" is a new physical volume of "849.43 GiB"
--- NEW Physical volume ---
PV Name               /dev/sda3
VG Name              
PV Size               849.43 GiB
Allocatable           NO
PE Size               0  
Total PE              0
Free PE               0
Allocated PE          0
PV UUID               xo8Xrp-MpKE-MVE1-fkJr-Hebe-NSwo-4w502f

CREATE A VOLUME GROUP

# vgcreate virtual-machines /dev/sda3
Volume group "virtual-machines" successfully created

DISPLAY VOLUMEN GROUP

# vgdisplay
--- Volume group ---
VG Name               virtual-machines
System ID            
Format                lvm2
Metadata Areas        1
Metadata Sequence No  1
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                0
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               849.42 GiB
PE Size               4.00 MiB
Total PE              217452
Alloc PE / Size       0 / 0  
Free  PE / Size       217452 / 849.42 GiB
VG UUID               M69gwe-S5e9-1ZXM-zlxg-L3yc-pR0P-mhW6Vi

--- Volume group ---
VG Name               fedora_fed18
System ID            
Format                lvm2
Metadata Areas        1
Metadata Sequence No  3
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                2
Open LV               2
Max PV                0
Cur PV                1
Act PV                1
VG Size               80.08 GiB
PE Size               4.00 MiB
Total PE              20501
Alloc PE / Size       20500 / 80.08 GiB
Free  PE / Size       1 / 4.00 MiB
VG UUID               r0LXYG-BQdo-WN7w-GcPa-uKxE-68mC-li3HFm

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)

lvcreate -nfedora64-1 -L50G /dev/virtual-machines
Logical volume "fedora64-1" created

:) Alex Dávila

Solution 3:

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 and vgcreate virtual-machines /dev/sda4.