我想知道为什么我无法创建物理卷?每个设置都是刚刚安装的lvm的默认设置(cat /etc/lvm/lvm.conf
参见https://paste.ubuntu.com/p/QqrszWR8M9/)。
是不是因为“无法启动 lvm2.service:单元 lvm2.service 被屏蔽”?谢谢。
$ 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?
答案1
您正尝试将整个内容/dev/sda
用于 PV。但是该磁盘上(至少)有两个分区(sda1
和sda2
),因此 LVM 正确地拒绝满足您的请求。