[linux-lvm] pvremove won't work

Bryn M. Reeves bmr at redhat.com
Tue Jun 9 09:46:23 UTC 2009


On Tue, 2009-06-09 at 09:04 +0200, Stefan Radovanovici wrote:
> 
> On 6/9/2009 8:54 AM, Luca Berra wrote:
> >> However, I can't remove /dev/sda4 (the partition on the failing disk)
> >> from the group:
> >> root at neriak:~# pvremove /dev/sda4
> >>  Can't open /dev/sda4 exclusively - not removing. Mounted filesystem?
> > what is the use of doing pvremove on sda4?? you just rip the disk off
> > and dump it in the wastebin.
> 
> Well, yeah, I just wanted to make sure that removing the disk while
>  some of its partitions are part of the LVM won't cause any problems. I
>  can't remove it just yet anyway, the OS is also installed on other
>  partitions on sda. So basically as long as I did a vgreduce, I can
>  take the disk out, is that right? I am assuming /dev/sda4 is still
>  showing in the pvdisplay output because it's still a LVM-type
>  partition. 

It is still labeled. LVM2 PV metadata has two components; a label in the
2nd sector that identifies the device as an LVM2 PV and includes the
UUID and a metadata buffer further into the device that stores details
like the VG the PV belongs to and the LVs that are allocated.

Running vgreduce for a PV edits the metadata on all PVs in the
appropriate VG to remove references to the PV being removed.

The pvremove command just wipes the label from the PV.

> > check /sys/block/sda/sda4/holders
> 
> I did: 
> 
> root at neriak:/sys/block/sda/sda4/holders# l
> total 0
> drwxr-xr-x 2 root root 0 2009-06-09 08:55 .
> drwxr-xr-x 4 root root 0 2009-06-09 08:43 ..
> lrwxrwxrwx 1 root root 0 2009-06-09 08:55 dm-1 -> ../../../../../../../../../virtual/block/dm-1
> root at neriak:/sys/block/sda/sda4/holders# cd dm-1
> root at neriak:/sys/block/sda/sda4/holders/dm-1# l
> total 0

> lrwxrwxrwx  1 root root    0 2009-06-09 08:55 bdi -> ../../bdi/252:1

> I have to admit I don't know what I am looking at. What's the dm-1 ?

Use dmsetup:

$ dmsetup info --maj 252 --min 1

(the output above shows dm is using 252 as its major number for this
device on your system).

At a guess it looks like you somehow removed the PV from the VG while a
logical volume was mapped on it.

Regards,
Bryn.





More information about the linux-lvm mailing list