Unable to remove stale volumeLVM2 can not wake up suspended logical volumeafter adding one more physical volume and enlarging logical volume, grub failsWhy my encrypted LVM volume (LUKS device) won't mount at boot time?device mapper on RHEL6 unable to create devs for LVM logical volumeLVM - failed to install bootloaderMount encrypted volume in DebianLogical Volumes fails to mount with dmsetup and no table presentLVM Volume Group MetaData Corruption - Please Helpchange designated name of encrypted lvm root? from sdo to sdn in crypttab?LVM: PV missing after reboot

What does the "remote control" for a QF-4 look like?

Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?

What is the word for reserving something for yourself before others do?

Why is consensus so controversial in Britain?

DC-DC converter from low voltage at high current, to high voltage at low current

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

Is it unprofessional to ask if a job posting on GlassDoor is real?

What would happen to a modern skyscraper if it rains micro blackholes?

LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function

Why can't I see bouncing of switch on oscilloscope screen?

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

Why do I get two different answers for this counting problem?

NMaximize is not converging to a solution

Codimension of non-flat locus

Paid for article while in US on F-1 visa?

Important Resources for Dark Age Civilizations?

What is a clear way to write a bar that has an extra beat?

meaning of に in 本当に?

Is it legal for company to use my work email to pretend I still work there?

How is it possible to have an ability score that is less than 3?

How does one intimidate enemies without having the capacity for violence?

Can a monk's single staff be considered dual wielded, as per the Dual Wielder feat?

What's that red-plus icon near a text?

Does detail obscure or enhance action?



Unable to remove stale volume


LVM2 can not wake up suspended logical volumeafter adding one more physical volume and enlarging logical volume, grub failsWhy my encrypted LVM volume (LUKS device) won't mount at boot time?device mapper on RHEL6 unable to create devs for LVM logical volumeLVM - failed to install bootloaderMount encrypted volume in DebianLogical Volumes fails to mount with dmsetup and no table presentLVM Volume Group MetaData Corruption - Please Helpchange designated name of encrypted lvm root? from sdo to sdn in crypttab?LVM: PV missing after reboot






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have an external hard drive connected to my Ubuntu laptop via USB. The whole hard drive is LUKS encrypted. Next to the encryption layer sits an LVM volume which I mount to /mnt/es. Once opened, lsblk sees it all as:



sdc 8:32 0 2.7T 0 disk 
└─es (dm-6) 252:6 0 2.7T 0 crypt
└─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm /mnt/es


Sometimes somehow the hard drive gets "detached" from the volumes, in which case the data becomes inaccessible:



sdc 8:32 0 2.7T 0 disk 
es (dm-6) 252:6 0 2.7T 0 crypt
└─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm


I noted that it typically happens when the laptop goes to sleep.



Now, the problem is that once sdc has [been?] detached, I cannot get rid of the two stale volumes es and externalstorage-externalstorage in order to reuse their names again. The first thing I do is umount /mnt/es which goes fine. But then, even though the volume is not mounted, I cannot remove it:



dmsetup remove --force /dev/mapper/externalstorage-externalstorage
device-mapper: resume ioctl on externalstorage-externalstorage failed: Invalid argument
device-mapper: remove ioctl on externalstorage-externalstorage failed: Device or resource busy
Command failed


The info command shows that the volume is opened:



dmsetup info -c /dev/mapper/externalstorage-externalstorage
Name Maj Min Stat Open Targ Event UUID
externalstorage-externalstorage 252 7 L--w 1 1 0 LVM-R4bAWzxJ8Cy3MBIjmPps60Rd3cFVyBStxTeKaR6gBHdefTYfJNWhHfA8tzqOBHns


Here is what seems to be holding the volume but it does not tell me much:



fuser -m /dev/mapper/externalstorage-externalstorage
Cannot stat file /proc/5687/fd/4: Stale file handle
Cannot stat file /proc/5687/fd/5: Stale file handle
Cannot stat file /proc/5687/fd/6: Stale file handle
Cannot stat file /proc/5687/fd/7: Stale file handle
Cannot stat file /proc/5687/fd/11: Stale file handle


From LVM point of view it is not accessible either:



pvdisplay
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error


Interestingly, at this point, cryptsetup luksClose es can be repeated any number of times without any visible impact or error message.



So how can I get rid of those stale volumes (apart from rebooting)? And is there any way to prevent the problem happening in the first place, i.e. why does sdc detach now and again?



[Ubuntu 14.04.3 LTS, kernel 3.19.0-42-generic]



Update



vgchange -an yields similar errors as above:



/dev/mapper/es: read failed after 0 of 4096 at 3000590794752: Input/output error
/dev/mapper/es: read failed after 0 of 4096 at 3000590876672: Input/output error
/dev/mapper/es: read failed after 0 of 4096 at 0: Input/output error
/dev/mapper/es: read failed after 0 of 4096 at 4096: Input/output error
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
/dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error









share|improve this question






























    1















    I have an external hard drive connected to my Ubuntu laptop via USB. The whole hard drive is LUKS encrypted. Next to the encryption layer sits an LVM volume which I mount to /mnt/es. Once opened, lsblk sees it all as:



    sdc 8:32 0 2.7T 0 disk 
    └─es (dm-6) 252:6 0 2.7T 0 crypt
    └─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm /mnt/es


    Sometimes somehow the hard drive gets "detached" from the volumes, in which case the data becomes inaccessible:



    sdc 8:32 0 2.7T 0 disk 
    es (dm-6) 252:6 0 2.7T 0 crypt
    └─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm


    I noted that it typically happens when the laptop goes to sleep.



    Now, the problem is that once sdc has [been?] detached, I cannot get rid of the two stale volumes es and externalstorage-externalstorage in order to reuse their names again. The first thing I do is umount /mnt/es which goes fine. But then, even though the volume is not mounted, I cannot remove it:



    dmsetup remove --force /dev/mapper/externalstorage-externalstorage
    device-mapper: resume ioctl on externalstorage-externalstorage failed: Invalid argument
    device-mapper: remove ioctl on externalstorage-externalstorage failed: Device or resource busy
    Command failed


    The info command shows that the volume is opened:



    dmsetup info -c /dev/mapper/externalstorage-externalstorage
    Name Maj Min Stat Open Targ Event UUID
    externalstorage-externalstorage 252 7 L--w 1 1 0 LVM-R4bAWzxJ8Cy3MBIjmPps60Rd3cFVyBStxTeKaR6gBHdefTYfJNWhHfA8tzqOBHns


    Here is what seems to be holding the volume but it does not tell me much:



    fuser -m /dev/mapper/externalstorage-externalstorage
    Cannot stat file /proc/5687/fd/4: Stale file handle
    Cannot stat file /proc/5687/fd/5: Stale file handle
    Cannot stat file /proc/5687/fd/6: Stale file handle
    Cannot stat file /proc/5687/fd/7: Stale file handle
    Cannot stat file /proc/5687/fd/11: Stale file handle


    From LVM point of view it is not accessible either:



    pvdisplay
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error


    Interestingly, at this point, cryptsetup luksClose es can be repeated any number of times without any visible impact or error message.



    So how can I get rid of those stale volumes (apart from rebooting)? And is there any way to prevent the problem happening in the first place, i.e. why does sdc detach now and again?



    [Ubuntu 14.04.3 LTS, kernel 3.19.0-42-generic]



    Update



    vgchange -an yields similar errors as above:



    /dev/mapper/es: read failed after 0 of 4096 at 3000590794752: Input/output error
    /dev/mapper/es: read failed after 0 of 4096 at 3000590876672: Input/output error
    /dev/mapper/es: read failed after 0 of 4096 at 0: Input/output error
    /dev/mapper/es: read failed after 0 of 4096 at 4096: Input/output error
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
    /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error









    share|improve this question


























      1












      1








      1








      I have an external hard drive connected to my Ubuntu laptop via USB. The whole hard drive is LUKS encrypted. Next to the encryption layer sits an LVM volume which I mount to /mnt/es. Once opened, lsblk sees it all as:



      sdc 8:32 0 2.7T 0 disk 
      └─es (dm-6) 252:6 0 2.7T 0 crypt
      └─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm /mnt/es


      Sometimes somehow the hard drive gets "detached" from the volumes, in which case the data becomes inaccessible:



      sdc 8:32 0 2.7T 0 disk 
      es (dm-6) 252:6 0 2.7T 0 crypt
      └─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm


      I noted that it typically happens when the laptop goes to sleep.



      Now, the problem is that once sdc has [been?] detached, I cannot get rid of the two stale volumes es and externalstorage-externalstorage in order to reuse their names again. The first thing I do is umount /mnt/es which goes fine. But then, even though the volume is not mounted, I cannot remove it:



      dmsetup remove --force /dev/mapper/externalstorage-externalstorage
      device-mapper: resume ioctl on externalstorage-externalstorage failed: Invalid argument
      device-mapper: remove ioctl on externalstorage-externalstorage failed: Device or resource busy
      Command failed


      The info command shows that the volume is opened:



      dmsetup info -c /dev/mapper/externalstorage-externalstorage
      Name Maj Min Stat Open Targ Event UUID
      externalstorage-externalstorage 252 7 L--w 1 1 0 LVM-R4bAWzxJ8Cy3MBIjmPps60Rd3cFVyBStxTeKaR6gBHdefTYfJNWhHfA8tzqOBHns


      Here is what seems to be holding the volume but it does not tell me much:



      fuser -m /dev/mapper/externalstorage-externalstorage
      Cannot stat file /proc/5687/fd/4: Stale file handle
      Cannot stat file /proc/5687/fd/5: Stale file handle
      Cannot stat file /proc/5687/fd/6: Stale file handle
      Cannot stat file /proc/5687/fd/7: Stale file handle
      Cannot stat file /proc/5687/fd/11: Stale file handle


      From LVM point of view it is not accessible either:



      pvdisplay
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error


      Interestingly, at this point, cryptsetup luksClose es can be repeated any number of times without any visible impact or error message.



      So how can I get rid of those stale volumes (apart from rebooting)? And is there any way to prevent the problem happening in the first place, i.e. why does sdc detach now and again?



      [Ubuntu 14.04.3 LTS, kernel 3.19.0-42-generic]



      Update



      vgchange -an yields similar errors as above:



      /dev/mapper/es: read failed after 0 of 4096 at 3000590794752: Input/output error
      /dev/mapper/es: read failed after 0 of 4096 at 3000590876672: Input/output error
      /dev/mapper/es: read failed after 0 of 4096 at 0: Input/output error
      /dev/mapper/es: read failed after 0 of 4096 at 4096: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error









      share|improve this question
















      I have an external hard drive connected to my Ubuntu laptop via USB. The whole hard drive is LUKS encrypted. Next to the encryption layer sits an LVM volume which I mount to /mnt/es. Once opened, lsblk sees it all as:



      sdc 8:32 0 2.7T 0 disk 
      └─es (dm-6) 252:6 0 2.7T 0 crypt
      └─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm /mnt/es


      Sometimes somehow the hard drive gets "detached" from the volumes, in which case the data becomes inaccessible:



      sdc 8:32 0 2.7T 0 disk 
      es (dm-6) 252:6 0 2.7T 0 crypt
      └─externalstorage-externalstorage (dm-7) 252:7 0 2.7T 0 lvm


      I noted that it typically happens when the laptop goes to sleep.



      Now, the problem is that once sdc has [been?] detached, I cannot get rid of the two stale volumes es and externalstorage-externalstorage in order to reuse their names again. The first thing I do is umount /mnt/es which goes fine. But then, even though the volume is not mounted, I cannot remove it:



      dmsetup remove --force /dev/mapper/externalstorage-externalstorage
      device-mapper: resume ioctl on externalstorage-externalstorage failed: Invalid argument
      device-mapper: remove ioctl on externalstorage-externalstorage failed: Device or resource busy
      Command failed


      The info command shows that the volume is opened:



      dmsetup info -c /dev/mapper/externalstorage-externalstorage
      Name Maj Min Stat Open Targ Event UUID
      externalstorage-externalstorage 252 7 L--w 1 1 0 LVM-R4bAWzxJ8Cy3MBIjmPps60Rd3cFVyBStxTeKaR6gBHdefTYfJNWhHfA8tzqOBHns


      Here is what seems to be holding the volume but it does not tell me much:



      fuser -m /dev/mapper/externalstorage-externalstorage
      Cannot stat file /proc/5687/fd/4: Stale file handle
      Cannot stat file /proc/5687/fd/5: Stale file handle
      Cannot stat file /proc/5687/fd/6: Stale file handle
      Cannot stat file /proc/5687/fd/7: Stale file handle
      Cannot stat file /proc/5687/fd/11: Stale file handle


      From LVM point of view it is not accessible either:



      pvdisplay
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error


      Interestingly, at this point, cryptsetup luksClose es can be repeated any number of times without any visible impact or error message.



      So how can I get rid of those stale volumes (apart from rebooting)? And is there any way to prevent the problem happening in the first place, i.e. why does sdc detach now and again?



      [Ubuntu 14.04.3 LTS, kernel 3.19.0-42-generic]



      Update



      vgchange -an yields similar errors as above:



      /dev/mapper/es: read failed after 0 of 4096 at 3000590794752: Input/output error
      /dev/mapper/es: read failed after 0 of 4096 at 3000590876672: Input/output error
      /dev/mapper/es: read failed after 0 of 4096 at 0: Input/output error
      /dev/mapper/es: read failed after 0 of 4096 at 4096: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981780979712: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 2981781037056: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 0: Input/output error
      /dev/externalstorage/externalstorage: read failed after 0 of 4096 at 4096: Input/output error






      lvm usb-drive luks cryptsetup volume






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 6 '16 at 9:42







      Greendrake

















      asked Jan 4 '16 at 5:21









      GreendrakeGreendrake

      1286




      1286




















          2 Answers
          2






          active

          oldest

          votes


















          2














          It's more like a guesswork, but it looks like you will need to deactive the lvm before you can remove the crypt mapping, basically working your way back out from the inside:



          First, you'll need to umount any stale fs on the lvm:



          umount -f /mnt/es


          Then deactivate the lvm that you appear to have on top of cryptsetup. Even if you have other vgs, the following should deactivate anything it can, without harming the system if it using any other vg:



          vgchange -an


          After this, you can use dmsetup to remove the mapping created by cryptsetup(!)



          dmsetup remove externalstorage


          (I may have mistook some of the names, feel free to correct it)



          It seems the basic problem that during sleep, your USB drive is dropping off the bus, and when it comes back, the block system finds that sdb disappeared, though there is an sdc now.






          share|improve this answer























          • Thanks for your input but vgchange -an yields the same sort of "Input/output error" errors as pvdisplay (shown in the question).

            – Greendrake
            Jan 6 '16 at 9:39


















          1














          1. Close all users of the device and backup device data as needed.

          2. Use umount to unmount any file systems that mounted the device.

          3. Remove the device from any md and LVM volume using it. If the device is a member of an LVM Volume group, then it may be necessary to move data off the device using the pvmove command, then use the vgreduce command to remove the physical volume, and (optionally) pvremove to remove the LVM metadata from the disk.

          4. If the device uses multipathing, run multipath -l and note all the paths to the device. Afterwards, remove the multipathed device using multipath -f device.

          5. Run blockdev –flushbufs device to flush any outstanding I/O to all paths to the device. This is particularly important for raw devices, where there is no umount or vgreduce operation to cause an I/O flush.

          6. Remove any reference to the device's path-based name, like /dev/sd, /dev/disk/by-path or the major:minor number, in applications, scripts, or utilities on the system. This is important in ensuring that different devices added in the future will not be mistaken for the current device.

          7. Finally, remove each path to the device from the SCSI subsystem. To do so, use the command echo 1 > /sys/block/device-name/device/delete where device-name may be sde, for example.
            Another variation of this operation is echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete, where h is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN.

          For more details refer Red Hat documentation!



          Also you can use sg_utils script to remove stale volume using rescan-scsi-bus.sh!






          share|improve this answer








          New contributor




          Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f253104%2funable-to-remove-stale-volume%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            It's more like a guesswork, but it looks like you will need to deactive the lvm before you can remove the crypt mapping, basically working your way back out from the inside:



            First, you'll need to umount any stale fs on the lvm:



            umount -f /mnt/es


            Then deactivate the lvm that you appear to have on top of cryptsetup. Even if you have other vgs, the following should deactivate anything it can, without harming the system if it using any other vg:



            vgchange -an


            After this, you can use dmsetup to remove the mapping created by cryptsetup(!)



            dmsetup remove externalstorage


            (I may have mistook some of the names, feel free to correct it)



            It seems the basic problem that during sleep, your USB drive is dropping off the bus, and when it comes back, the block system finds that sdb disappeared, though there is an sdc now.






            share|improve this answer























            • Thanks for your input but vgchange -an yields the same sort of "Input/output error" errors as pvdisplay (shown in the question).

              – Greendrake
              Jan 6 '16 at 9:39















            2














            It's more like a guesswork, but it looks like you will need to deactive the lvm before you can remove the crypt mapping, basically working your way back out from the inside:



            First, you'll need to umount any stale fs on the lvm:



            umount -f /mnt/es


            Then deactivate the lvm that you appear to have on top of cryptsetup. Even if you have other vgs, the following should deactivate anything it can, without harming the system if it using any other vg:



            vgchange -an


            After this, you can use dmsetup to remove the mapping created by cryptsetup(!)



            dmsetup remove externalstorage


            (I may have mistook some of the names, feel free to correct it)



            It seems the basic problem that during sleep, your USB drive is dropping off the bus, and when it comes back, the block system finds that sdb disappeared, though there is an sdc now.






            share|improve this answer























            • Thanks for your input but vgchange -an yields the same sort of "Input/output error" errors as pvdisplay (shown in the question).

              – Greendrake
              Jan 6 '16 at 9:39













            2












            2








            2







            It's more like a guesswork, but it looks like you will need to deactive the lvm before you can remove the crypt mapping, basically working your way back out from the inside:



            First, you'll need to umount any stale fs on the lvm:



            umount -f /mnt/es


            Then deactivate the lvm that you appear to have on top of cryptsetup. Even if you have other vgs, the following should deactivate anything it can, without harming the system if it using any other vg:



            vgchange -an


            After this, you can use dmsetup to remove the mapping created by cryptsetup(!)



            dmsetup remove externalstorage


            (I may have mistook some of the names, feel free to correct it)



            It seems the basic problem that during sleep, your USB drive is dropping off the bus, and when it comes back, the block system finds that sdb disappeared, though there is an sdc now.






            share|improve this answer













            It's more like a guesswork, but it looks like you will need to deactive the lvm before you can remove the crypt mapping, basically working your way back out from the inside:



            First, you'll need to umount any stale fs on the lvm:



            umount -f /mnt/es


            Then deactivate the lvm that you appear to have on top of cryptsetup. Even if you have other vgs, the following should deactivate anything it can, without harming the system if it using any other vg:



            vgchange -an


            After this, you can use dmsetup to remove the mapping created by cryptsetup(!)



            dmsetup remove externalstorage


            (I may have mistook some of the names, feel free to correct it)



            It seems the basic problem that during sleep, your USB drive is dropping off the bus, and when it comes back, the block system finds that sdb disappeared, though there is an sdc now.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 4 '16 at 6:48









            chexumchexum

            73479




            73479












            • Thanks for your input but vgchange -an yields the same sort of "Input/output error" errors as pvdisplay (shown in the question).

              – Greendrake
              Jan 6 '16 at 9:39

















            • Thanks for your input but vgchange -an yields the same sort of "Input/output error" errors as pvdisplay (shown in the question).

              – Greendrake
              Jan 6 '16 at 9:39
















            Thanks for your input but vgchange -an yields the same sort of "Input/output error" errors as pvdisplay (shown in the question).

            – Greendrake
            Jan 6 '16 at 9:39





            Thanks for your input but vgchange -an yields the same sort of "Input/output error" errors as pvdisplay (shown in the question).

            – Greendrake
            Jan 6 '16 at 9:39













            1














            1. Close all users of the device and backup device data as needed.

            2. Use umount to unmount any file systems that mounted the device.

            3. Remove the device from any md and LVM volume using it. If the device is a member of an LVM Volume group, then it may be necessary to move data off the device using the pvmove command, then use the vgreduce command to remove the physical volume, and (optionally) pvremove to remove the LVM metadata from the disk.

            4. If the device uses multipathing, run multipath -l and note all the paths to the device. Afterwards, remove the multipathed device using multipath -f device.

            5. Run blockdev –flushbufs device to flush any outstanding I/O to all paths to the device. This is particularly important for raw devices, where there is no umount or vgreduce operation to cause an I/O flush.

            6. Remove any reference to the device's path-based name, like /dev/sd, /dev/disk/by-path or the major:minor number, in applications, scripts, or utilities on the system. This is important in ensuring that different devices added in the future will not be mistaken for the current device.

            7. Finally, remove each path to the device from the SCSI subsystem. To do so, use the command echo 1 > /sys/block/device-name/device/delete where device-name may be sde, for example.
              Another variation of this operation is echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete, where h is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN.

            For more details refer Red Hat documentation!



            Also you can use sg_utils script to remove stale volume using rescan-scsi-bus.sh!






            share|improve this answer








            New contributor




            Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.
























              1














              1. Close all users of the device and backup device data as needed.

              2. Use umount to unmount any file systems that mounted the device.

              3. Remove the device from any md and LVM volume using it. If the device is a member of an LVM Volume group, then it may be necessary to move data off the device using the pvmove command, then use the vgreduce command to remove the physical volume, and (optionally) pvremove to remove the LVM metadata from the disk.

              4. If the device uses multipathing, run multipath -l and note all the paths to the device. Afterwards, remove the multipathed device using multipath -f device.

              5. Run blockdev –flushbufs device to flush any outstanding I/O to all paths to the device. This is particularly important for raw devices, where there is no umount or vgreduce operation to cause an I/O flush.

              6. Remove any reference to the device's path-based name, like /dev/sd, /dev/disk/by-path or the major:minor number, in applications, scripts, or utilities on the system. This is important in ensuring that different devices added in the future will not be mistaken for the current device.

              7. Finally, remove each path to the device from the SCSI subsystem. To do so, use the command echo 1 > /sys/block/device-name/device/delete where device-name may be sde, for example.
                Another variation of this operation is echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete, where h is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN.

              For more details refer Red Hat documentation!



              Also you can use sg_utils script to remove stale volume using rescan-scsi-bus.sh!






              share|improve this answer








              New contributor




              Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                1












                1








                1







                1. Close all users of the device and backup device data as needed.

                2. Use umount to unmount any file systems that mounted the device.

                3. Remove the device from any md and LVM volume using it. If the device is a member of an LVM Volume group, then it may be necessary to move data off the device using the pvmove command, then use the vgreduce command to remove the physical volume, and (optionally) pvremove to remove the LVM metadata from the disk.

                4. If the device uses multipathing, run multipath -l and note all the paths to the device. Afterwards, remove the multipathed device using multipath -f device.

                5. Run blockdev –flushbufs device to flush any outstanding I/O to all paths to the device. This is particularly important for raw devices, where there is no umount or vgreduce operation to cause an I/O flush.

                6. Remove any reference to the device's path-based name, like /dev/sd, /dev/disk/by-path or the major:minor number, in applications, scripts, or utilities on the system. This is important in ensuring that different devices added in the future will not be mistaken for the current device.

                7. Finally, remove each path to the device from the SCSI subsystem. To do so, use the command echo 1 > /sys/block/device-name/device/delete where device-name may be sde, for example.
                  Another variation of this operation is echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete, where h is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN.

                For more details refer Red Hat documentation!



                Also you can use sg_utils script to remove stale volume using rescan-scsi-bus.sh!






                share|improve this answer








                New contributor




                Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                1. Close all users of the device and backup device data as needed.

                2. Use umount to unmount any file systems that mounted the device.

                3. Remove the device from any md and LVM volume using it. If the device is a member of an LVM Volume group, then it may be necessary to move data off the device using the pvmove command, then use the vgreduce command to remove the physical volume, and (optionally) pvremove to remove the LVM metadata from the disk.

                4. If the device uses multipathing, run multipath -l and note all the paths to the device. Afterwards, remove the multipathed device using multipath -f device.

                5. Run blockdev –flushbufs device to flush any outstanding I/O to all paths to the device. This is particularly important for raw devices, where there is no umount or vgreduce operation to cause an I/O flush.

                6. Remove any reference to the device's path-based name, like /dev/sd, /dev/disk/by-path or the major:minor number, in applications, scripts, or utilities on the system. This is important in ensuring that different devices added in the future will not be mistaken for the current device.

                7. Finally, remove each path to the device from the SCSI subsystem. To do so, use the command echo 1 > /sys/block/device-name/device/delete where device-name may be sde, for example.
                  Another variation of this operation is echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete, where h is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN.

                For more details refer Red Hat documentation!



                Also you can use sg_utils script to remove stale volume using rescan-scsi-bus.sh!







                share|improve this answer








                New contributor




                Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 2 days ago









                Chhatragun ShindeChhatragun Shinde

                111




                111




                New contributor




                Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Chhatragun Shinde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f253104%2funable-to-remove-stale-volume%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                    Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                    NetworkManager fails with “Could not find source connection”Trouble connecting to VPN using network-manager, while command line worksHow can I be notified about state changes to a VPN adapterBacktrack 5 R3 - Refuses to connect to VPNFeed all traffic through OpenVPN for a specific network namespace onlyRun daemon on startup in Debian once openvpn connection establishedpfsense tcp connection between openvpn and lan is brokenInternet connection problem with web browsers onlyWhy does NetworkManager explicitly support tun/tap devices?Browser issues with VPNTwo IP addresses assigned to the same network card - OpenVPN issues?Cannot connect to WiFi with nmcli, although secrets are provided