How to remove a block device from lsblk list on CentOS 7?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












Here is my lsblk -a list:



NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 9G 0 part
├─cl-root 253:0 0 8G 0 lvm /
└─cl-swap 253:1 0 1G 0 lvm [SWAP]
sdb 8:32 0 16G 0 disk
sr0 11:0 1 1024M 0 rom
drbd0 147:0 0 2G 0 disk


I want to remove drbd0. How to do?










share|improve this question























  • Have you try to stop drdb daemon?
    – Romeo Ninov
    Jul 21 '17 at 8:45










  • @RomeoNinov Yes. After I ran systemctl stop drbd and check lsblk -a again, drbd0 also exists.
    – cloud_cloud
    Jul 21 '17 at 8:48














up vote
2
down vote

favorite












Here is my lsblk -a list:



NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 9G 0 part
├─cl-root 253:0 0 8G 0 lvm /
└─cl-swap 253:1 0 1G 0 lvm [SWAP]
sdb 8:32 0 16G 0 disk
sr0 11:0 1 1024M 0 rom
drbd0 147:0 0 2G 0 disk


I want to remove drbd0. How to do?










share|improve this question























  • Have you try to stop drdb daemon?
    – Romeo Ninov
    Jul 21 '17 at 8:45










  • @RomeoNinov Yes. After I ran systemctl stop drbd and check lsblk -a again, drbd0 also exists.
    – cloud_cloud
    Jul 21 '17 at 8:48












up vote
2
down vote

favorite









up vote
2
down vote

favorite











Here is my lsblk -a list:



NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 9G 0 part
├─cl-root 253:0 0 8G 0 lvm /
└─cl-swap 253:1 0 1G 0 lvm [SWAP]
sdb 8:32 0 16G 0 disk
sr0 11:0 1 1024M 0 rom
drbd0 147:0 0 2G 0 disk


I want to remove drbd0. How to do?










share|improve this question















Here is my lsblk -a list:



NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 9G 0 part
├─cl-root 253:0 0 8G 0 lvm /
└─cl-swap 253:1 0 1G 0 lvm [SWAP]
sdb 8:32 0 16G 0 disk
sr0 11:0 1 1024M 0 rom
drbd0 147:0 0 2G 0 disk


I want to remove drbd0. How to do?







centos hard-disk disk block-device delete






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 21 '17 at 12:39









sourcejedi

20.9k43092




20.9k43092










asked Jul 21 '17 at 8:37









cloud_cloud

13927




13927











  • Have you try to stop drdb daemon?
    – Romeo Ninov
    Jul 21 '17 at 8:45










  • @RomeoNinov Yes. After I ran systemctl stop drbd and check lsblk -a again, drbd0 also exists.
    – cloud_cloud
    Jul 21 '17 at 8:48
















  • Have you try to stop drdb daemon?
    – Romeo Ninov
    Jul 21 '17 at 8:45










  • @RomeoNinov Yes. After I ran systemctl stop drbd and check lsblk -a again, drbd0 also exists.
    – cloud_cloud
    Jul 21 '17 at 8:48















Have you try to stop drdb daemon?
– Romeo Ninov
Jul 21 '17 at 8:45




Have you try to stop drdb daemon?
– Romeo Ninov
Jul 21 '17 at 8:45












@RomeoNinov Yes. After I ran systemctl stop drbd and check lsblk -a again, drbd0 also exists.
– cloud_cloud
Jul 21 '17 at 8:48




@RomeoNinov Yes. After I ran systemctl stop drbd and check lsblk -a again, drbd0 also exists.
– cloud_cloud
Jul 21 '17 at 8:48










3 Answers
3






active

oldest

votes

















up vote
2
down vote



accepted










rm'ing nodes in /dev/ will not do what I suggested and remove the DRBD device. E.g. you should see that the kernel view of block devices in /sys/class/block is not affected by such changes.



Removing the device node will hide it from lsblk, but it would not cause any claimed resources to be released! This seems like a bad idea.



Rebooting should remove any weird DRBD devices that you're not using any more. (E.g. removed from drbd config, but still exist for some unknown reason).



"module load/unload" would be a way to avoid a reboot, if that's what you wanted. modprobe -r drbd to unload. It would require that you have no other DRBD devices in use.




If you believed the drbd daemon was messing around with creating or renaming devices in /dev at the same time as udev / devtmpfs is running, and genuinely had a bug which left behind a stale device node (and some stale cache in lsblk), then you'd better do a full reboot to clear up the mess. Because that would be some really broken software, nothing should be doing that anymore.






share|improve this answer






















  • deleting anything in dev falls into the "don't unless you know better" category. In many years of linux use, I've never known better.
    – Dan Farrell
    1 hour ago










  • @DanFarrell I guess you've never typo'ed the destination of a dd command then :-P.
    – sourcejedi
    3 mins ago


















up vote
2
down vote













As you have stopped drdb you may want to check the thread and follow the recommendation and just remove the device file in /dev. Here is extract from the mentioned page:





and we also have the drbd device in /dev/ directory, we want to delete
de drbd1 from /dev.



brw-rw---- 1 root disk 147, 0 2009-03-18 15:34 /dev/drbd0



brw-rw---- 1 root disk 147, 1 2009-03-18 15:34 /dev/drbd1



brw-rw---- 1 root disk 147, 2 2009-03-18 15:34 /dev/drbd2



brw-rw---- 1 root disk 147, 3 2009-03-18 15:41 /dev/drbd3



brw-rw---- 1 root disk 147, 4 2009-03-18 15:41 /dev/drbd4




you can of course delete the device nodes, if it makes you happy. only
it won't magically re-appear in case you want to use it again, (unless
you do a reboot or module unload/load). so you would need to mknod it
again, if you need it again.







share|improve this answer



























    up vote
    1
    down vote













    lsblk has a -e option to exclude devices by major device numbers.



    The drbd devices in your lsblk output above have a major number of 147, so this will exclude them from the list:



    lsblk -a -e 147


    This will not remove any drbd device nodes from your system or interact in any way with the DRBD service, it will just exclude the drbd devices from lsblk's output.






    share|improve this answer




















      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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      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%2f379900%2fhow-to-remove-a-block-device-from-lsblk-list-on-centos-7%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      rm'ing nodes in /dev/ will not do what I suggested and remove the DRBD device. E.g. you should see that the kernel view of block devices in /sys/class/block is not affected by such changes.



      Removing the device node will hide it from lsblk, but it would not cause any claimed resources to be released! This seems like a bad idea.



      Rebooting should remove any weird DRBD devices that you're not using any more. (E.g. removed from drbd config, but still exist for some unknown reason).



      "module load/unload" would be a way to avoid a reboot, if that's what you wanted. modprobe -r drbd to unload. It would require that you have no other DRBD devices in use.




      If you believed the drbd daemon was messing around with creating or renaming devices in /dev at the same time as udev / devtmpfs is running, and genuinely had a bug which left behind a stale device node (and some stale cache in lsblk), then you'd better do a full reboot to clear up the mess. Because that would be some really broken software, nothing should be doing that anymore.






      share|improve this answer






















      • deleting anything in dev falls into the "don't unless you know better" category. In many years of linux use, I've never known better.
        – Dan Farrell
        1 hour ago










      • @DanFarrell I guess you've never typo'ed the destination of a dd command then :-P.
        – sourcejedi
        3 mins ago















      up vote
      2
      down vote



      accepted










      rm'ing nodes in /dev/ will not do what I suggested and remove the DRBD device. E.g. you should see that the kernel view of block devices in /sys/class/block is not affected by such changes.



      Removing the device node will hide it from lsblk, but it would not cause any claimed resources to be released! This seems like a bad idea.



      Rebooting should remove any weird DRBD devices that you're not using any more. (E.g. removed from drbd config, but still exist for some unknown reason).



      "module load/unload" would be a way to avoid a reboot, if that's what you wanted. modprobe -r drbd to unload. It would require that you have no other DRBD devices in use.




      If you believed the drbd daemon was messing around with creating or renaming devices in /dev at the same time as udev / devtmpfs is running, and genuinely had a bug which left behind a stale device node (and some stale cache in lsblk), then you'd better do a full reboot to clear up the mess. Because that would be some really broken software, nothing should be doing that anymore.






      share|improve this answer






















      • deleting anything in dev falls into the "don't unless you know better" category. In many years of linux use, I've never known better.
        – Dan Farrell
        1 hour ago










      • @DanFarrell I guess you've never typo'ed the destination of a dd command then :-P.
        – sourcejedi
        3 mins ago













      up vote
      2
      down vote



      accepted







      up vote
      2
      down vote



      accepted






      rm'ing nodes in /dev/ will not do what I suggested and remove the DRBD device. E.g. you should see that the kernel view of block devices in /sys/class/block is not affected by such changes.



      Removing the device node will hide it from lsblk, but it would not cause any claimed resources to be released! This seems like a bad idea.



      Rebooting should remove any weird DRBD devices that you're not using any more. (E.g. removed from drbd config, but still exist for some unknown reason).



      "module load/unload" would be a way to avoid a reboot, if that's what you wanted. modprobe -r drbd to unload. It would require that you have no other DRBD devices in use.




      If you believed the drbd daemon was messing around with creating or renaming devices in /dev at the same time as udev / devtmpfs is running, and genuinely had a bug which left behind a stale device node (and some stale cache in lsblk), then you'd better do a full reboot to clear up the mess. Because that would be some really broken software, nothing should be doing that anymore.






      share|improve this answer














      rm'ing nodes in /dev/ will not do what I suggested and remove the DRBD device. E.g. you should see that the kernel view of block devices in /sys/class/block is not affected by such changes.



      Removing the device node will hide it from lsblk, but it would not cause any claimed resources to be released! This seems like a bad idea.



      Rebooting should remove any weird DRBD devices that you're not using any more. (E.g. removed from drbd config, but still exist for some unknown reason).



      "module load/unload" would be a way to avoid a reboot, if that's what you wanted. modprobe -r drbd to unload. It would require that you have no other DRBD devices in use.




      If you believed the drbd daemon was messing around with creating or renaming devices in /dev at the same time as udev / devtmpfs is running, and genuinely had a bug which left behind a stale device node (and some stale cache in lsblk), then you'd better do a full reboot to clear up the mess. Because that would be some really broken software, nothing should be doing that anymore.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 2 mins ago

























      answered Jul 21 '17 at 12:11









      sourcejedi

      20.9k43092




      20.9k43092











      • deleting anything in dev falls into the "don't unless you know better" category. In many years of linux use, I've never known better.
        – Dan Farrell
        1 hour ago










      • @DanFarrell I guess you've never typo'ed the destination of a dd command then :-P.
        – sourcejedi
        3 mins ago

















      • deleting anything in dev falls into the "don't unless you know better" category. In many years of linux use, I've never known better.
        – Dan Farrell
        1 hour ago










      • @DanFarrell I guess you've never typo'ed the destination of a dd command then :-P.
        – sourcejedi
        3 mins ago
















      deleting anything in dev falls into the "don't unless you know better" category. In many years of linux use, I've never known better.
      – Dan Farrell
      1 hour ago




      deleting anything in dev falls into the "don't unless you know better" category. In many years of linux use, I've never known better.
      – Dan Farrell
      1 hour ago












      @DanFarrell I guess you've never typo'ed the destination of a dd command then :-P.
      – sourcejedi
      3 mins ago





      @DanFarrell I guess you've never typo'ed the destination of a dd command then :-P.
      – sourcejedi
      3 mins ago













      up vote
      2
      down vote













      As you have stopped drdb you may want to check the thread and follow the recommendation and just remove the device file in /dev. Here is extract from the mentioned page:





      and we also have the drbd device in /dev/ directory, we want to delete
      de drbd1 from /dev.



      brw-rw---- 1 root disk 147, 0 2009-03-18 15:34 /dev/drbd0



      brw-rw---- 1 root disk 147, 1 2009-03-18 15:34 /dev/drbd1



      brw-rw---- 1 root disk 147, 2 2009-03-18 15:34 /dev/drbd2



      brw-rw---- 1 root disk 147, 3 2009-03-18 15:41 /dev/drbd3



      brw-rw---- 1 root disk 147, 4 2009-03-18 15:41 /dev/drbd4




      you can of course delete the device nodes, if it makes you happy. only
      it won't magically re-appear in case you want to use it again, (unless
      you do a reboot or module unload/load). so you would need to mknod it
      again, if you need it again.







      share|improve this answer
























        up vote
        2
        down vote













        As you have stopped drdb you may want to check the thread and follow the recommendation and just remove the device file in /dev. Here is extract from the mentioned page:





        and we also have the drbd device in /dev/ directory, we want to delete
        de drbd1 from /dev.



        brw-rw---- 1 root disk 147, 0 2009-03-18 15:34 /dev/drbd0



        brw-rw---- 1 root disk 147, 1 2009-03-18 15:34 /dev/drbd1



        brw-rw---- 1 root disk 147, 2 2009-03-18 15:34 /dev/drbd2



        brw-rw---- 1 root disk 147, 3 2009-03-18 15:41 /dev/drbd3



        brw-rw---- 1 root disk 147, 4 2009-03-18 15:41 /dev/drbd4




        you can of course delete the device nodes, if it makes you happy. only
        it won't magically re-appear in case you want to use it again, (unless
        you do a reboot or module unload/load). so you would need to mknod it
        again, if you need it again.







        share|improve this answer






















          up vote
          2
          down vote










          up vote
          2
          down vote









          As you have stopped drdb you may want to check the thread and follow the recommendation and just remove the device file in /dev. Here is extract from the mentioned page:





          and we also have the drbd device in /dev/ directory, we want to delete
          de drbd1 from /dev.



          brw-rw---- 1 root disk 147, 0 2009-03-18 15:34 /dev/drbd0



          brw-rw---- 1 root disk 147, 1 2009-03-18 15:34 /dev/drbd1



          brw-rw---- 1 root disk 147, 2 2009-03-18 15:34 /dev/drbd2



          brw-rw---- 1 root disk 147, 3 2009-03-18 15:41 /dev/drbd3



          brw-rw---- 1 root disk 147, 4 2009-03-18 15:41 /dev/drbd4




          you can of course delete the device nodes, if it makes you happy. only
          it won't magically re-appear in case you want to use it again, (unless
          you do a reboot or module unload/load). so you would need to mknod it
          again, if you need it again.







          share|improve this answer












          As you have stopped drdb you may want to check the thread and follow the recommendation and just remove the device file in /dev. Here is extract from the mentioned page:





          and we also have the drbd device in /dev/ directory, we want to delete
          de drbd1 from /dev.



          brw-rw---- 1 root disk 147, 0 2009-03-18 15:34 /dev/drbd0



          brw-rw---- 1 root disk 147, 1 2009-03-18 15:34 /dev/drbd1



          brw-rw---- 1 root disk 147, 2 2009-03-18 15:34 /dev/drbd2



          brw-rw---- 1 root disk 147, 3 2009-03-18 15:41 /dev/drbd3



          brw-rw---- 1 root disk 147, 4 2009-03-18 15:41 /dev/drbd4




          you can of course delete the device nodes, if it makes you happy. only
          it won't magically re-appear in case you want to use it again, (unless
          you do a reboot or module unload/load). so you would need to mknod it
          again, if you need it again.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 21 '17 at 10:03









          Romeo Ninov

          4,48321625




          4,48321625




















              up vote
              1
              down vote













              lsblk has a -e option to exclude devices by major device numbers.



              The drbd devices in your lsblk output above have a major number of 147, so this will exclude them from the list:



              lsblk -a -e 147


              This will not remove any drbd device nodes from your system or interact in any way with the DRBD service, it will just exclude the drbd devices from lsblk's output.






              share|improve this answer
























                up vote
                1
                down vote













                lsblk has a -e option to exclude devices by major device numbers.



                The drbd devices in your lsblk output above have a major number of 147, so this will exclude them from the list:



                lsblk -a -e 147


                This will not remove any drbd device nodes from your system or interact in any way with the DRBD service, it will just exclude the drbd devices from lsblk's output.






                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  lsblk has a -e option to exclude devices by major device numbers.



                  The drbd devices in your lsblk output above have a major number of 147, so this will exclude them from the list:



                  lsblk -a -e 147


                  This will not remove any drbd device nodes from your system or interact in any way with the DRBD service, it will just exclude the drbd devices from lsblk's output.






                  share|improve this answer












                  lsblk has a -e option to exclude devices by major device numbers.



                  The drbd devices in your lsblk output above have a major number of 147, so this will exclude them from the list:



                  lsblk -a -e 147


                  This will not remove any drbd device nodes from your system or interact in any way with the DRBD service, it will just exclude the drbd devices from lsblk's output.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 22 '17 at 4:03









                  cas

                  38k44696




                  38k44696



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f379900%2fhow-to-remove-a-block-device-from-lsblk-list-on-centos-7%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay