0

I was wondering why I can't create a physical volume? Every settings are default for lvm just installed ( For cat /etc/lvm/lvm.conf see https://paste.ubuntu.com/p/QqrszWR8M9/).

Is it because of "Failed to start lvm2.service: Unit lvm2.service is masked"? Thanks.

$ sudo parted -l
Model: ATA TOSHIBA MQ01ABF0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name                  Flags
 1      1049kB  538MB  537MB  fat32        EFI System Partition  boot, esp
 2      538MB   500GB  500GB  ext4
$ sudo lvmdiskscan
  /dev/sda1 [     512.00 MiB] 
  /dev/sda2 [    <465.26 GiB] 
  0 disks
  2 partitions
  0 LVM physical volume whole disks
  0 LVM physical volumes

$ sudo pvcreate /dev/sda
  Device /dev/sda excluded by a filter.

$ sudo lvmdiskscan
  /dev/sda1 [     512.00 MiB] 
  /dev/sda2 [    <465.26 GiB] 
  0 disks
  2 partitions
  0 LVM physical volume whole disks
  0 LVM physical volumes


$ sudo pvcreate /dev/sda2
  Can't open /dev/sda2 exclusively.  Mounted filesystem?
  • I do not. Why default configurations do that? – Tim Feb 22 at 23:46
  • It is in lvm.conf – Rui F Ribeiro Feb 22 at 23:48
1

You're trying to use the entire /dev/sda for a PV. But you've got (at least) two partitions on that disk (sda1 and sda2), so LVM is rightly refusing to honour your request.

  • Thanks. sudo pvcreate /dev/sda2 doesn't work either – Tim Feb 22 at 23:57
  • It's got a filesystem on it. LVM is doing its best to stop you breaking your system. – roaima Feb 22 at 23:57
  • Must a physical volume be created from a partition without filesystem? – Tim Feb 22 at 23:58
  • Yes. Absolutely. – roaima Feb 22 at 23:59
  • Where is that mentioned in documentation? – Tim Feb 22 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.