ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    How can I actively monitor drive usage

    Scheduled Pinned Locked Moved IT Discussion
    11 Posts 3 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by

      Using this on Xen,

       df  | grep "/$" | head -n 1
      

      How could I actively monitor the free/used space. I've excluded -h on purpose

      1 Reply Last reply Reply Quote 1
      • stacksofplatesS
        stacksofplates
        last edited by

        I think you should be able to use monit for that.

        1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller
          last edited by

          In what way do you want to monitor it?

          1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403
            last edited by

            I want to see how much free space my partition has, as it applies updates to Xen.

            I could simply keep tapping up, and hitting enter, and watch the sizes change, but I'd prefer to simply, run the command, and hit Ctlr+C to stop it when I'm satisfied.

            scottalanmillerS 1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller @DustinB3403
              last edited by

              @DustinB3403 said:

              I could simply keep tapping up, and hitting enter, and watch the sizes change, but I'd prefer to simply, run the command, and hit Ctlr+C to stop it when I'm satisfied.

              Oh, okay, that's super easy. Just find the command that you like (which you did) and add the word watch in front of it. Ta da, done. UNIX, the easy way.

              1 Reply Last reply Reply Quote 2
              • DustinB3403D
                DustinB3403
                last edited by DustinB3403

                So:

                watch "df | grep "/$" | head -n 1"
                

                But this doesn't seem to output any information, I'm at the classic stuck console to Ctrl+C out of

                Edited to reflect that quotes are needed.

                1 Reply Last reply Reply Quote 0
                • DustinB3403D
                  DustinB3403
                  last edited by

                  Edit, putting it in quotes works.

                  1 Reply Last reply Reply Quote 1
                  • DustinB3403D
                    DustinB3403
                    last edited by DustinB3403

                    Next one for you is there anyway to actively dump the changes to the session screen, rather than just an updated single line?

                    The above code outputs

                    Every 2.0s: df  | grep / | head -n 1                                                                                                 Thu Sep 24 13:01:05 2015
                    
                    /dev/sda1              4127440   2593592   1324184  67% /
                    

                    And just that results line.

                    What I'd prefer would be:

                     /dev/sda1              4127440   2593592   1324184  67% /
                     /dev/sda1              4127440   2593592   1324184  67% /
                     /dev/sda1              4127440   2593592   1324384  67% /
                     /dev/sda1              4127440   2593592   1324184  67% /
                    
                    1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller
                      last edited by

                      Oh that's completely different. Try this....

                       for i in {1..1000}; do echo $(df | grep / | head -n 1); sleep 5; done
                      
                      1 Reply Last reply Reply Quote 2
                      • DustinB3403D
                        DustinB3403
                        last edited by

                        Wonderful!

                        1 Reply Last reply Reply Quote 0
                        • scottalanmillerS
                          scottalanmiller
                          last edited by

                          Obviously, adjust the "1000" if you want it to do it a different number of times. And adjust the "5" if you want it to update at a different interval than every five seconds.

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post