Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In my laptop, I have a single hard drive (/dev/sda). On this hard drive, I have an EFI partition (/dev/sda1), a boot partition (/dev/sda2), and an encrypted partition containing / (/dev/sda3). Inside the encrypted partition is an LVM volume group, which contains a couple of logical volumes (/, a swap partiton, etc.).

All of this works fine; my initrd sets everything up correctly, and the system boots without any issues. However, after booting, I wanted to be able to manage the volume group. When I tried to do so, I got the following output:

# pvdisplay /dev/mapper/root 
  --- Physical volume --- 
  PV Name               /dev/mapper/root 
  VG Name               localdisk 
  PV Size               931.31 GiB / not usable 1.69 MiB 
  Allocatable           yes (but full) 
  PE Size               4.00 MiB 
  Total PE              238416 
  Free PE               0 
  Allocated PE          238416 
  PV UUID               I3wArE-g6yl-9ywx-Df8d-3w1N-wuuQ-FrQjoK 

# vgdisplay localdisk 
  Volume group "localdisk" not found 
  Skipping volume group localdisk 

How is it possible that pvdisplay reports that the physical device is a member of the volume group localdisk, however vgdisplay insists that the very same volume group doesn't exist? What's going wrong here?

I can provide more information about my system as required / as relevant to the question. Because I am not sure what's wrong, I'm not sure what to add at this point.

These are the device mapper entries I have setup. Note the two LVM logical volumes, as well as "root" (i.e., /dev/mapper/root), which is the LUKS-encrypted parent partition.

# dmsetup info 
Name:              localdisk-swap 
State:             ACTIVE 
Read Ahead:        256 
Tables present:    LIVE 
Open count:        2 
Event number:      0 
Major, minor:      251, 1 
Number of targets: 1 
UUID: LVM-75jhqCBBFayCVQECgTH8NOFfkrjYCqiHa0oIafGLgBOZbuhrYISOHQo97Gamy74E 

Name:              localdisk-root 
State:             ACTIVE 
Read Ahead:        256 
Tables present:    LIVE 
Open count:        1 
Event number:      0 
Major, minor:      251, 2 
Number of targets: 1 
UUID: LVM-75jhqCBBFayCVQECgTH8NOFfkrjYCqiHzpANUdFbPYfliL6gmKoBdhol2zj9Gl6z 

Name:              root 
State:             ACTIVE 
Read Ahead:        256 
Tables present:    LIVE 
Open count:        2 
Event number:      0 
Major, minor:      251, 0 
Number of targets: 1 
UUID: CRYPT-LUKS1-d5f7cc568cc74201be3fde108e37162e-root 

Here are the filesystems I have mounted (note /dev/mapper/localdisk-root on /):

# mount 
rootfs on / type rootfs (rw) 
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) 
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=1006523,mode=755) 
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620) 
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) 
/dev/mapper/localdisk-root on / type ext4 (rw,noatime,commit=0) 
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=805564k,mode=755) 
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime) 
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime) 
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime) 
cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755) 
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime) 
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime) 
openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc) 
cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu) 
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nodev,noexec,nosuid) 
share|improve this question
    
what does vgdisplay (without arguments) show? –  Faheem Mitha Mar 25 at 6:02
    
It gives me No volume groups found. –  CmdrMoozy Mar 25 at 6:17
1  
Weird. Do vgs and vgscan also return nothing? Also, can you post your mount output? df -h. Also post the output of fdisk -l. I'm a little puzzled by the pvdisplay /dev/mapper/root. In my experience the devices in /dev/mapper are logical volumes. –  Faheem Mitha Mar 25 at 9:16
    
I added some more information to the OP. vgscan does indeed say that there are no volume groups found. /dev/mapper/root is the LUKS-encrypted physical volume which contains the LVM volume group - it's in /dev/mapper via dm_crypt. –  CmdrMoozy Mar 25 at 15:26
1  
Try the command vgs to see what VG's you have. –  slm Mar 25 at 16:51

1 Answer 1

up vote 3 down vote accepted

If you look in /etc/lvm/lvm.conf, there is a devices { ... } section. You probably need to adjust the filter to accept /dev/mapper/root as a valid location. The easiest filter would be to accept all devices: filter = [ "a/.*/" ]. You could also accept only the device you're interested in: filter = [ "a|^/dev/mapper/root$|", "r/.*/" ].

Your initramfs probably has a different LVM configuration.

(BTW: vgscan -vvv is the troubleshooting tool to use here. That should show each block device it checked, and if it found anything there.)

share|improve this answer
    
This actually makes a lot of sense. I'll give it a go later tonight. Thanks! :) –  CmdrMoozy Mar 25 at 17:19
    
@CmdrMoozy if it doesn't work, that vgscan -vvv should tell you what's going on... –  derobert Mar 25 at 17:30
    
This was exactly the right answer. It hadn't occurred to me, since it was being mounted by the initrd, but you're right - it needs to be initialized after booting as well, and different filters were being used. Thanks! :) –  CmdrMoozy Mar 26 at 1:57
    
For the record, I changed my lvm.conf configuration to: scan = [ "/dev", "/dev/mapper" ] and filter = [ "r|/dev/nbd.*|", "a|^/dev/sd|", "a|^/dev/md|", "a|^/dev/mapper/root$|" ], which seems to be working great. –  CmdrMoozy Mar 26 at 2:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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