In udev, what kind of device events match ACTION==“change”?












3















The udev rules I've created so far only deal with devices being added or removed, i.e.:



ACTION=="add"... or ACTION=="remove"...



I've come across an example of a rule that seems to deal with device state changes as well:



ACTION=="add|change", KERNEL=="sd[b-z]", ATTR{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 127 -S 12 /dev/%k"



I take it that the above rule applies whenever a matching device is added OR its state changes.



Question: What kind of state changes are possible (generally and specific to a USB hard drive)?



I've checked all udev documentation I can find and there's barely any mention of, or usage guidance, in respect of device state changes or specifically ACTION="change".










share|improve this question





























    3















    The udev rules I've created so far only deal with devices being added or removed, i.e.:



    ACTION=="add"... or ACTION=="remove"...



    I've come across an example of a rule that seems to deal with device state changes as well:



    ACTION=="add|change", KERNEL=="sd[b-z]", ATTR{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 127 -S 12 /dev/%k"



    I take it that the above rule applies whenever a matching device is added OR its state changes.



    Question: What kind of state changes are possible (generally and specific to a USB hard drive)?



    I've checked all udev documentation I can find and there's barely any mention of, or usage guidance, in respect of device state changes or specifically ACTION="change".










    share|improve this question



























      3












      3








      3








      The udev rules I've created so far only deal with devices being added or removed, i.e.:



      ACTION=="add"... or ACTION=="remove"...



      I've come across an example of a rule that seems to deal with device state changes as well:



      ACTION=="add|change", KERNEL=="sd[b-z]", ATTR{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 127 -S 12 /dev/%k"



      I take it that the above rule applies whenever a matching device is added OR its state changes.



      Question: What kind of state changes are possible (generally and specific to a USB hard drive)?



      I've checked all udev documentation I can find and there's barely any mention of, or usage guidance, in respect of device state changes or specifically ACTION="change".










      share|improve this question
















      The udev rules I've created so far only deal with devices being added or removed, i.e.:



      ACTION=="add"... or ACTION=="remove"...



      I've come across an example of a rule that seems to deal with device state changes as well:



      ACTION=="add|change", KERNEL=="sd[b-z]", ATTR{queue/rotational}=="1", RUN+="/usr/bin/hdparm -B 127 -S 12 /dev/%k"



      I take it that the above rule applies whenever a matching device is added OR its state changes.



      Question: What kind of state changes are possible (generally and specific to a USB hard drive)?



      I've checked all udev documentation I can find and there's barely any mention of, or usage guidance, in respect of device state changes or specifically ACTION="change".







      udev devices






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 2 '15 at 23:42







      misha256

















      asked Nov 2 '15 at 20:45









      misha256misha256

      192211




      192211






















          2 Answers
          2






          active

          oldest

          votes


















          3














          "change" corresponds, for example, to removing or inserting an sdcard in a sdcard reader, or changing the hard disc inside a usb-to-sata enclosure. The device itself is not added nor removed, but the media is no longer the same.






          share|improve this answer































            1














            udev change event gets triggered when media changer (regards to tape - Netbackup like environment) or sd card reader is used in continuation with different media or sd card. When a same device is re-added (a san disk is re-added again or you do switchdisable/enable on the switch side or target port disable/enable from target side )



            Below are the few change udev events that we see on the host side, when I did target port disable (from Vexata VX100 array) for an existing san lun



            KERNEL[34942.047543] change   /devices/virtual/block/dm-0 (block)
            KERNEL[34942.047596] change /devices/virtual/block/dm-1 (block)
            KERNEL[34942.047613] change /devices/virtual/block/dm-2 (block)
            KERNEL[34942.047631] change /devices/virtual/block/dm-3 (block)
            KERNEL[34942.047678] change /devices/virtual/block/dm-4 (block)
            UDEV [34942.053448] change /devices/virtual/block/dm-3 (block)
            UDEV [34942.053486] change /devices/virtual/block/dm-4 (block)
            UDEV [34942.053507] change /devices/virtual/block/dm-0 (block)
            UDEV [34942.053536] change /devices/virtual/block/dm-2 (block)





            share|improve this answer








            New contributor




            Venfah Nazir 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%2f240353%2fin-udev-what-kind-of-device-events-match-action-change%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









              3














              "change" corresponds, for example, to removing or inserting an sdcard in a sdcard reader, or changing the hard disc inside a usb-to-sata enclosure. The device itself is not added nor removed, but the media is no longer the same.






              share|improve this answer




























                3














                "change" corresponds, for example, to removing or inserting an sdcard in a sdcard reader, or changing the hard disc inside a usb-to-sata enclosure. The device itself is not added nor removed, but the media is no longer the same.






                share|improve this answer


























                  3












                  3








                  3







                  "change" corresponds, for example, to removing or inserting an sdcard in a sdcard reader, or changing the hard disc inside a usb-to-sata enclosure. The device itself is not added nor removed, but the media is no longer the same.






                  share|improve this answer













                  "change" corresponds, for example, to removing or inserting an sdcard in a sdcard reader, or changing the hard disc inside a usb-to-sata enclosure. The device itself is not added nor removed, but the media is no longer the same.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 3 '15 at 9:19









                  meuhmeuh

                  31.8k11854




                  31.8k11854

























                      1














                      udev change event gets triggered when media changer (regards to tape - Netbackup like environment) or sd card reader is used in continuation with different media or sd card. When a same device is re-added (a san disk is re-added again or you do switchdisable/enable on the switch side or target port disable/enable from target side )



                      Below are the few change udev events that we see on the host side, when I did target port disable (from Vexata VX100 array) for an existing san lun



                      KERNEL[34942.047543] change   /devices/virtual/block/dm-0 (block)
                      KERNEL[34942.047596] change /devices/virtual/block/dm-1 (block)
                      KERNEL[34942.047613] change /devices/virtual/block/dm-2 (block)
                      KERNEL[34942.047631] change /devices/virtual/block/dm-3 (block)
                      KERNEL[34942.047678] change /devices/virtual/block/dm-4 (block)
                      UDEV [34942.053448] change /devices/virtual/block/dm-3 (block)
                      UDEV [34942.053486] change /devices/virtual/block/dm-4 (block)
                      UDEV [34942.053507] change /devices/virtual/block/dm-0 (block)
                      UDEV [34942.053536] change /devices/virtual/block/dm-2 (block)





                      share|improve this answer








                      New contributor




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

























                        1














                        udev change event gets triggered when media changer (regards to tape - Netbackup like environment) or sd card reader is used in continuation with different media or sd card. When a same device is re-added (a san disk is re-added again or you do switchdisable/enable on the switch side or target port disable/enable from target side )



                        Below are the few change udev events that we see on the host side, when I did target port disable (from Vexata VX100 array) for an existing san lun



                        KERNEL[34942.047543] change   /devices/virtual/block/dm-0 (block)
                        KERNEL[34942.047596] change /devices/virtual/block/dm-1 (block)
                        KERNEL[34942.047613] change /devices/virtual/block/dm-2 (block)
                        KERNEL[34942.047631] change /devices/virtual/block/dm-3 (block)
                        KERNEL[34942.047678] change /devices/virtual/block/dm-4 (block)
                        UDEV [34942.053448] change /devices/virtual/block/dm-3 (block)
                        UDEV [34942.053486] change /devices/virtual/block/dm-4 (block)
                        UDEV [34942.053507] change /devices/virtual/block/dm-0 (block)
                        UDEV [34942.053536] change /devices/virtual/block/dm-2 (block)





                        share|improve this answer








                        New contributor




                        Venfah Nazir 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







                          udev change event gets triggered when media changer (regards to tape - Netbackup like environment) or sd card reader is used in continuation with different media or sd card. When a same device is re-added (a san disk is re-added again or you do switchdisable/enable on the switch side or target port disable/enable from target side )



                          Below are the few change udev events that we see on the host side, when I did target port disable (from Vexata VX100 array) for an existing san lun



                          KERNEL[34942.047543] change   /devices/virtual/block/dm-0 (block)
                          KERNEL[34942.047596] change /devices/virtual/block/dm-1 (block)
                          KERNEL[34942.047613] change /devices/virtual/block/dm-2 (block)
                          KERNEL[34942.047631] change /devices/virtual/block/dm-3 (block)
                          KERNEL[34942.047678] change /devices/virtual/block/dm-4 (block)
                          UDEV [34942.053448] change /devices/virtual/block/dm-3 (block)
                          UDEV [34942.053486] change /devices/virtual/block/dm-4 (block)
                          UDEV [34942.053507] change /devices/virtual/block/dm-0 (block)
                          UDEV [34942.053536] change /devices/virtual/block/dm-2 (block)





                          share|improve this answer








                          New contributor




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










                          udev change event gets triggered when media changer (regards to tape - Netbackup like environment) or sd card reader is used in continuation with different media or sd card. When a same device is re-added (a san disk is re-added again or you do switchdisable/enable on the switch side or target port disable/enable from target side )



                          Below are the few change udev events that we see on the host side, when I did target port disable (from Vexata VX100 array) for an existing san lun



                          KERNEL[34942.047543] change   /devices/virtual/block/dm-0 (block)
                          KERNEL[34942.047596] change /devices/virtual/block/dm-1 (block)
                          KERNEL[34942.047613] change /devices/virtual/block/dm-2 (block)
                          KERNEL[34942.047631] change /devices/virtual/block/dm-3 (block)
                          KERNEL[34942.047678] change /devices/virtual/block/dm-4 (block)
                          UDEV [34942.053448] change /devices/virtual/block/dm-3 (block)
                          UDEV [34942.053486] change /devices/virtual/block/dm-4 (block)
                          UDEV [34942.053507] change /devices/virtual/block/dm-0 (block)
                          UDEV [34942.053536] change /devices/virtual/block/dm-2 (block)






                          share|improve this answer








                          New contributor




                          Venfah Nazir 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




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









                          answered 13 hours ago









                          Venfah NazirVenfah Nazir

                          112




                          112




                          New contributor




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





                          New contributor





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






                          Venfah Nazir 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%2f240353%2fin-udev-what-kind-of-device-events-match-action-change%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

                              Loup dans la culture

                              How to solve the problem of ntp “Unable to contact time server” from KDE?

                              ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux