• When adding a disk to LVM by pvcreate one gets the message Can't open /dev/sdXy exclusively. Mounted filesystem or when creating a new filesystem one gets Permission denied while trying to determine filesystem size, this means that disk is locked. That is:

    • The device is locked because it's already mounted. Double check, if it's not the case.
    • The device is locked by multipathd. This was my case. This can be checked by sudo multipath -l. If your device is listed, then double check, if you aren't trying to use a wrong device.

    If the device is locked by *multipath* and if this is an error, then to remove the device from multipath's control, issue sudo multipath -f /dev/sdX to remove the device.

    After this, the device can use for LVM or a partition on it can formated.


Post your comment

Simple HTML markup is allowed.