How to ensure that a USB drive is mounted only during the execution of a script? The 2019...

Is an up-to-date browser secure on an out-of-date OS?

Why is the maximum length of OpenWrt’s root password 8 characters?

What do hard-Brexiteers want with respect to the Irish border?

Why couldn't they take pictures of a closer black hole?

Is it safe to harvest rainwater that fell on solar panels?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Is Cinnamon a desktop environment or a window manager? (Or both?)

How much of the clove should I use when using big garlic heads?

Worn-tile Scrabble

Are spiders unable to hurt humans, especially very small spiders?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Are there any other methods to apply to solving simultaneous equations?

Is it okay to consider publishing in my first year of PhD?

If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Loose spokes after only a few rides

How did passengers keep warm on sail ships?

I am an eight letter word. What am I?

Button changing its text & action. Good or terrible?

How do you keep chess fun when your opponent constantly beats you?

The difference between dialogue marks

Is bread bad for ducks?

Why doesn't UInt have a toDouble()?

Straighten subgroup lattice



How to ensure that a USB drive is mounted only during the execution of a script?



The 2019 Stack Overflow Developer Survey Results Are InHow do I write files to a USB without being root?How to mount image created with dd?Can't mount usb key filesystemUSB pen drive not getting assigned anything in /dev/control mount order of partitions on a USB disk in linuxProblems with (local) mount at boot (sysvinit)Why is my device only 19Mb?Unable to mount 8TB external hard driveHFS+ formatted drive will not mount on Beaglebone BlackUnmount busy filesystem





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have a Linux (Pop OS 18.1) laptop connected to an external monitor that I use as a docking station. A USB drive is plugged into one of the monitor's USB ports.



I want to use the USB drive for backup purposes. To that end, there is a cron job that runs daily and does the following:



BACKUP_DEVICE=/dev/sda1

umount $BACKUP_DEVICE
pmount -A $BACKUP_DEVICE

# Do the backup

umount $BACKUP_DEVICE


I want the USB drive to be mounted only during the backup. This allows me to unplug the monitor (and hence the drive) safely. To be safe, the backup starts by calling umount to ensure the drive is unmounted, and then mounts it, does the backup, and unmounts again.



The problem is that umount and pmount sometimes go wrong:



umount: /dev/sda1: no mount point specified.
Error: device /dev/sda1 does not exist


1) I don't know how to explain the umount error message. If the USB drive is not mounted and I manually umount, the error message is slightly different: ""umount: /dev/sda1: not mounted." So I don't know what causes the above umount error message.



2) /dev/sda1 doesn't exist?! It's plugged in, and when unmounted, is still listed in /dev.



I seem to be barking up the wrong tree. What is the right way to ensure that a USB drive is mounted only for the duration of my backup script?










share|improve this question





























    0















    I have a Linux (Pop OS 18.1) laptop connected to an external monitor that I use as a docking station. A USB drive is plugged into one of the monitor's USB ports.



    I want to use the USB drive for backup purposes. To that end, there is a cron job that runs daily and does the following:



    BACKUP_DEVICE=/dev/sda1

    umount $BACKUP_DEVICE
    pmount -A $BACKUP_DEVICE

    # Do the backup

    umount $BACKUP_DEVICE


    I want the USB drive to be mounted only during the backup. This allows me to unplug the monitor (and hence the drive) safely. To be safe, the backup starts by calling umount to ensure the drive is unmounted, and then mounts it, does the backup, and unmounts again.



    The problem is that umount and pmount sometimes go wrong:



    umount: /dev/sda1: no mount point specified.
    Error: device /dev/sda1 does not exist


    1) I don't know how to explain the umount error message. If the USB drive is not mounted and I manually umount, the error message is slightly different: ""umount: /dev/sda1: not mounted." So I don't know what causes the above umount error message.



    2) /dev/sda1 doesn't exist?! It's plugged in, and when unmounted, is still listed in /dev.



    I seem to be barking up the wrong tree. What is the right way to ensure that a USB drive is mounted only for the duration of my backup script?










    share|improve this question

























      0












      0








      0








      I have a Linux (Pop OS 18.1) laptop connected to an external monitor that I use as a docking station. A USB drive is plugged into one of the monitor's USB ports.



      I want to use the USB drive for backup purposes. To that end, there is a cron job that runs daily and does the following:



      BACKUP_DEVICE=/dev/sda1

      umount $BACKUP_DEVICE
      pmount -A $BACKUP_DEVICE

      # Do the backup

      umount $BACKUP_DEVICE


      I want the USB drive to be mounted only during the backup. This allows me to unplug the monitor (and hence the drive) safely. To be safe, the backup starts by calling umount to ensure the drive is unmounted, and then mounts it, does the backup, and unmounts again.



      The problem is that umount and pmount sometimes go wrong:



      umount: /dev/sda1: no mount point specified.
      Error: device /dev/sda1 does not exist


      1) I don't know how to explain the umount error message. If the USB drive is not mounted and I manually umount, the error message is slightly different: ""umount: /dev/sda1: not mounted." So I don't know what causes the above umount error message.



      2) /dev/sda1 doesn't exist?! It's plugged in, and when unmounted, is still listed in /dev.



      I seem to be barking up the wrong tree. What is the right way to ensure that a USB drive is mounted only for the duration of my backup script?










      share|improve this question














      I have a Linux (Pop OS 18.1) laptop connected to an external monitor that I use as a docking station. A USB drive is plugged into one of the monitor's USB ports.



      I want to use the USB drive for backup purposes. To that end, there is a cron job that runs daily and does the following:



      BACKUP_DEVICE=/dev/sda1

      umount $BACKUP_DEVICE
      pmount -A $BACKUP_DEVICE

      # Do the backup

      umount $BACKUP_DEVICE


      I want the USB drive to be mounted only during the backup. This allows me to unplug the monitor (and hence the drive) safely. To be safe, the backup starts by calling umount to ensure the drive is unmounted, and then mounts it, does the backup, and unmounts again.



      The problem is that umount and pmount sometimes go wrong:



      umount: /dev/sda1: no mount point specified.
      Error: device /dev/sda1 does not exist


      1) I don't know how to explain the umount error message. If the USB drive is not mounted and I manually umount, the error message is slightly different: ""umount: /dev/sda1: not mounted." So I don't know what causes the above umount error message.



      2) /dev/sda1 doesn't exist?! It's plugged in, and when unmounted, is still listed in /dev.



      I seem to be barking up the wrong tree. What is the right way to ensure that a USB drive is mounted only for the duration of my backup script?







      linux usb mount






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Jack OrensteinJack Orenstein

      132




      132






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fsuperuser.com%2fquestions%2f1423765%2fhow-to-ensure-that-a-usb-drive-is-mounted-only-during-the-execution-of-a-script%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f1423765%2fhow-to-ensure-that-a-usb-drive-is-mounted-only-during-the-execution-of-a-script%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

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

          looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...