How can I pin a mount folder to a specific serial number, so that the same disk gets mounted in the same place every-time?

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











up vote
0
down vote

favorite
1












I have many hard-disks that need to be mounted on restarts some have have NTFS file-systems other have EXT4, some are USB and some are SATA, some have the same label names, and they don't get mounted in the same place.



Is there a way that I pin a mount folder to a specific serial number, so that the same disk gets mounted in the same place every-time ?










share|improve this question

























    up vote
    0
    down vote

    favorite
    1












    I have many hard-disks that need to be mounted on restarts some have have NTFS file-systems other have EXT4, some are USB and some are SATA, some have the same label names, and they don't get mounted in the same place.



    Is there a way that I pin a mount folder to a specific serial number, so that the same disk gets mounted in the same place every-time ?










    share|improve this question























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      I have many hard-disks that need to be mounted on restarts some have have NTFS file-systems other have EXT4, some are USB and some are SATA, some have the same label names, and they don't get mounted in the same place.



      Is there a way that I pin a mount folder to a specific serial number, so that the same disk gets mounted in the same place every-time ?










      share|improve this question













      I have many hard-disks that need to be mounted on restarts some have have NTFS file-systems other have EXT4, some are USB and some are SATA, some have the same label names, and they don't get mounted in the same place.



      Is there a way that I pin a mount folder to a specific serial number, so that the same disk gets mounted in the same place every-time ?







      linux mount usb ntfs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 25 at 12:56









      Eduard Florinescu

      2,964103751




      2,964103751




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          First, have a look at the various symlinks in /dev/disk/.... Symlinks exist for different criteria (volume label, serial number of disk, ...), and you can pick those that best describe the partition you are interested in.



          Second, you can edit /etc/fstab to mount those partitions wherever you'd like them to be mounted. Including to directories with some serial number. Yes, you need one entry for every partition.



          If instead you are talking about auto-mounting, and want some general scheme for autom-mounting, that will depend on your auto mounter. One way would be to write custom udev-rules with high priority than whatever your auto-mounter uses.






          share|improve this answer




















          • now I see in /dev/disk/ i have this folders by-id/ by-path/ by-uuid/ so you say I can mount like this mount /dev/disk/by-id/serial /myfolder
            – Eduard Florinescu
            Sep 25 at 14:04






          • 1




            Yes, exactly. And after you edited /etc/fstab, you can just mount /myfolder.
            – dirkt
            Sep 25 at 14:17

















          up vote
          0
          down vote













          A quick fix would be to unmount all already mounted and mount them all in folders having the uuid serial:



          cd /media/$USER
          ls -1 | xargs -L1 -I sudo umount /media/$USER/
          sudo mkdir /media/amounted
          cd /media/amounted
          ls -1 /dev/disk/by-uuid/ | xargs sudo mkdir
          ls -1 | xargs -L1 -I sudo mount /dev/disk/by-uuid/ /media/amounted/


          Then list the drive with the corresponding mount folder uuid etc:



          sudo lsblk -o name,mountpoint,tran,fstype,label,size,uuid





          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%2f471315%2fhow-can-i-pin-a-mount-folder-to-a-specific-serial-number-so-that-the-same-disk%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            First, have a look at the various symlinks in /dev/disk/.... Symlinks exist for different criteria (volume label, serial number of disk, ...), and you can pick those that best describe the partition you are interested in.



            Second, you can edit /etc/fstab to mount those partitions wherever you'd like them to be mounted. Including to directories with some serial number. Yes, you need one entry for every partition.



            If instead you are talking about auto-mounting, and want some general scheme for autom-mounting, that will depend on your auto mounter. One way would be to write custom udev-rules with high priority than whatever your auto-mounter uses.






            share|improve this answer




















            • now I see in /dev/disk/ i have this folders by-id/ by-path/ by-uuid/ so you say I can mount like this mount /dev/disk/by-id/serial /myfolder
              – Eduard Florinescu
              Sep 25 at 14:04






            • 1




              Yes, exactly. And after you edited /etc/fstab, you can just mount /myfolder.
              – dirkt
              Sep 25 at 14:17














            up vote
            2
            down vote



            accepted










            First, have a look at the various symlinks in /dev/disk/.... Symlinks exist for different criteria (volume label, serial number of disk, ...), and you can pick those that best describe the partition you are interested in.



            Second, you can edit /etc/fstab to mount those partitions wherever you'd like them to be mounted. Including to directories with some serial number. Yes, you need one entry for every partition.



            If instead you are talking about auto-mounting, and want some general scheme for autom-mounting, that will depend on your auto mounter. One way would be to write custom udev-rules with high priority than whatever your auto-mounter uses.






            share|improve this answer




















            • now I see in /dev/disk/ i have this folders by-id/ by-path/ by-uuid/ so you say I can mount like this mount /dev/disk/by-id/serial /myfolder
              – Eduard Florinescu
              Sep 25 at 14:04






            • 1




              Yes, exactly. And after you edited /etc/fstab, you can just mount /myfolder.
              – dirkt
              Sep 25 at 14:17












            up vote
            2
            down vote



            accepted







            up vote
            2
            down vote



            accepted






            First, have a look at the various symlinks in /dev/disk/.... Symlinks exist for different criteria (volume label, serial number of disk, ...), and you can pick those that best describe the partition you are interested in.



            Second, you can edit /etc/fstab to mount those partitions wherever you'd like them to be mounted. Including to directories with some serial number. Yes, you need one entry for every partition.



            If instead you are talking about auto-mounting, and want some general scheme for autom-mounting, that will depend on your auto mounter. One way would be to write custom udev-rules with high priority than whatever your auto-mounter uses.






            share|improve this answer












            First, have a look at the various symlinks in /dev/disk/.... Symlinks exist for different criteria (volume label, serial number of disk, ...), and you can pick those that best describe the partition you are interested in.



            Second, you can edit /etc/fstab to mount those partitions wherever you'd like them to be mounted. Including to directories with some serial number. Yes, you need one entry for every partition.



            If instead you are talking about auto-mounting, and want some general scheme for autom-mounting, that will depend on your auto mounter. One way would be to write custom udev-rules with high priority than whatever your auto-mounter uses.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 25 at 13:13









            dirkt

            15k21032




            15k21032











            • now I see in /dev/disk/ i have this folders by-id/ by-path/ by-uuid/ so you say I can mount like this mount /dev/disk/by-id/serial /myfolder
              – Eduard Florinescu
              Sep 25 at 14:04






            • 1




              Yes, exactly. And after you edited /etc/fstab, you can just mount /myfolder.
              – dirkt
              Sep 25 at 14:17
















            • now I see in /dev/disk/ i have this folders by-id/ by-path/ by-uuid/ so you say I can mount like this mount /dev/disk/by-id/serial /myfolder
              – Eduard Florinescu
              Sep 25 at 14:04






            • 1




              Yes, exactly. And after you edited /etc/fstab, you can just mount /myfolder.
              – dirkt
              Sep 25 at 14:17















            now I see in /dev/disk/ i have this folders by-id/ by-path/ by-uuid/ so you say I can mount like this mount /dev/disk/by-id/serial /myfolder
            – Eduard Florinescu
            Sep 25 at 14:04




            now I see in /dev/disk/ i have this folders by-id/ by-path/ by-uuid/ so you say I can mount like this mount /dev/disk/by-id/serial /myfolder
            – Eduard Florinescu
            Sep 25 at 14:04




            1




            1




            Yes, exactly. And after you edited /etc/fstab, you can just mount /myfolder.
            – dirkt
            Sep 25 at 14:17




            Yes, exactly. And after you edited /etc/fstab, you can just mount /myfolder.
            – dirkt
            Sep 25 at 14:17












            up vote
            0
            down vote













            A quick fix would be to unmount all already mounted and mount them all in folders having the uuid serial:



            cd /media/$USER
            ls -1 | xargs -L1 -I sudo umount /media/$USER/
            sudo mkdir /media/amounted
            cd /media/amounted
            ls -1 /dev/disk/by-uuid/ | xargs sudo mkdir
            ls -1 | xargs -L1 -I sudo mount /dev/disk/by-uuid/ /media/amounted/


            Then list the drive with the corresponding mount folder uuid etc:



            sudo lsblk -o name,mountpoint,tran,fstype,label,size,uuid





            share|improve this answer


























              up vote
              0
              down vote













              A quick fix would be to unmount all already mounted and mount them all in folders having the uuid serial:



              cd /media/$USER
              ls -1 | xargs -L1 -I sudo umount /media/$USER/
              sudo mkdir /media/amounted
              cd /media/amounted
              ls -1 /dev/disk/by-uuid/ | xargs sudo mkdir
              ls -1 | xargs -L1 -I sudo mount /dev/disk/by-uuid/ /media/amounted/


              Then list the drive with the corresponding mount folder uuid etc:



              sudo lsblk -o name,mountpoint,tran,fstype,label,size,uuid





              share|improve this answer
























                up vote
                0
                down vote










                up vote
                0
                down vote









                A quick fix would be to unmount all already mounted and mount them all in folders having the uuid serial:



                cd /media/$USER
                ls -1 | xargs -L1 -I sudo umount /media/$USER/
                sudo mkdir /media/amounted
                cd /media/amounted
                ls -1 /dev/disk/by-uuid/ | xargs sudo mkdir
                ls -1 | xargs -L1 -I sudo mount /dev/disk/by-uuid/ /media/amounted/


                Then list the drive with the corresponding mount folder uuid etc:



                sudo lsblk -o name,mountpoint,tran,fstype,label,size,uuid





                share|improve this answer














                A quick fix would be to unmount all already mounted and mount them all in folders having the uuid serial:



                cd /media/$USER
                ls -1 | xargs -L1 -I sudo umount /media/$USER/
                sudo mkdir /media/amounted
                cd /media/amounted
                ls -1 /dev/disk/by-uuid/ | xargs sudo mkdir
                ls -1 | xargs -L1 -I sudo mount /dev/disk/by-uuid/ /media/amounted/


                Then list the drive with the corresponding mount folder uuid etc:



                sudo lsblk -o name,mountpoint,tran,fstype,label,size,uuid






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Sep 25 at 20:45

























                answered Sep 25 at 19:56









                Eduard Florinescu

                2,964103751




                2,964103751



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471315%2fhow-can-i-pin-a-mount-folder-to-a-specific-serial-number-so-that-the-same-disk%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