Results 1 to 5 of 5

Thread: Unable to create LVM snapshot (Failed to lock logical volume)

  1. #1

    Question Unable to create LVM snapshot (Failed to lock logical volume)

    I have been migrating a CentOS server to a LEAP15 based one.

    For various reasons (please don't start the BTRFS vs ... debate !) we are using XFS for a certain mount.

    As a result, I was migrating a backup script that uses LVM snapshots to effect a backup of the XFS mount.

    The backup script creates LVM snapshots without problem on Centos, but on openSUSE it fails with the following:

    Code:
    File descriptor 9 (/run/lock/newBackup.sh.lock) leaked on lvcreate invocation. Parent PID 1954: /bin/bash                                                                      
      device-mapper: reload ioctl on  (254:5) failed: Input/output error                                                                                                               
      Failed to lock logical volume some_data/some_data_lv.                                                                                                                              
      Aborting. Manual intervention required.
    If I try to execute the lvcreate commands manually (outside of the script) they fail too:
    Code:
      device-mapper: reload ioctl on  (254:4) failed: Input/output error
      Failed to lock logical volume some_data/some_data_lv.
      Aborting. Manual intervention required.

    I have tried two formats of command, both of these fail:
    Code:
    lvcreate -q --type snapshot -pr -l 10%ORIGIN --snapshot --name "test123" /dev/some_data/some_data_lv
    lvcreate -pr --size "15G" --snapshot --name "test123" /dev/some_data/some_data_lv

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,273
    Blog Entries
    2

    Default Re: Unable to create LVM snapshot (Failed to lock logical volume)

    Is probably fairly obvious that there is a file lock, and the lock is imposed by a security policy.
    Am not familiar enough with LVM to know how to troubleshoot this, but for starters I'd suggest the verbose (-v) option when running lvcreate.
    It should be obvious that you should minimize the file I/O on anything before you can successfully create a snapshot.

    I don't see anything relevant in the LEAP documentation, but <maybe> you might find something relevant in the following SUSE Storage documentation

    https://www.suse.com/documentation/s...a/btx9jxu.html

    Good Luck,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,273
    Blog Entries
    2

    Default Re: Unable to create LVM snapshot (Failed to lock logical volume)

    As I was doing a review on YaST Modules,

    I noticed that the Snapshot module supports both BTRFS and LVM snapshots.
    Could be really informative if you tried to create and read a snapshot using the YaST mdoule... If successful, you can then take a look at what it's doing.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  4. #4

    Default Re: Unable to create LVM snapshot (Failed to lock logical volume)

    tsu2

    I am not sure you read my original post fully ?

    In summary:
    1) I know how to use lvm snapshots. This script comes from a known-good server (but one running Centos not openSUSE).
    2) As I said in my post, the same command works in standard BASH shell, but not in a .sh script. Therefore I don't need to spend time debugging my script or commands, those are fine. The problem is with LVM.

  5. #5
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,273
    Blog Entries
    2

    Default Re: Unable to create LVM snapshot (Failed to lock logical volume)

    Quote Originally Posted by devrandom View Post
    tsu2

    I am not sure you read my original post fully ?

    In summary:
    1) I know how to use lvm snapshots. This script comes from a known-good server (but one running Centos not openSUSE).
    2) As I said in my post, the same command works in standard BASH shell, but not in a .sh script. Therefore I don't need to spend time debugging my script or commands, those are fine. The problem is with LVM.
    Your last statement doesn't make sense.
    If you execute the lvmcreate command in a BASH shell, it's no different than running the same command in a BASH script.

    And, the YaST snapshot module would likely do the same,execute lvm commands to perform lvm functionality.

    And,despite what you may say about the script being "known good," there is of course something about the script that isn't compatible.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •