Permanently mounting loop device

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












2














I created a file



touch /datastore/virtual/pseudoblock


created a loop device with it



sudo losetup /dev/loop0 /datastore/virtual/pseudoblock


(although I got a warning about its size)



and then initialized it with random data



dd if=/dev/urandom of=/dev/loop0 bs=1M count=100


My questions are



a) why is it not displayed yet in my block devices' list?



NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 489.1G 0 disk
├─sdb2 8:18 0 488M 0 part /boot
├─sdb3 8:19 0 488.1G 0 part
│ └─sdb3_crypt 253:0 0 488.1G 0 crypt
│ ├─ubuntu--vg-root 253:1 0 472.2G 0 lvm /
│ └─ubuntu--vg-swap_1 253:2 0 15.9G 0 lvm [SWAP]
└─sdb1 8:17 0 512M 0 part /boot/efi
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
└─sda1_crypt 253:3 0 931.5G 0 crypt
└─store--vg-store1tb 253:4 0 931.5G 0 lvm /datastore


b) how can I permanently mount it via /etc/fstab since I cannot get its UUID?



$ blkid
/dev/mapper/sdb3_crypt: UUID="fSHjbj-51K2-QfhI-G0Wb-o3lN-4pE1-BB4wCP" TYPE="LVM2_member"
/dev/mapper/ubuntu--vg-root: UUID="9e452886-4d8g-fj54-854c-80bc171826e8" TYPE="ext4"


working on



$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial


with



$ uname -a
Linux pkara-pc01 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux









share|improve this question




























    2














    I created a file



    touch /datastore/virtual/pseudoblock


    created a loop device with it



    sudo losetup /dev/loop0 /datastore/virtual/pseudoblock


    (although I got a warning about its size)



    and then initialized it with random data



    dd if=/dev/urandom of=/dev/loop0 bs=1M count=100


    My questions are



    a) why is it not displayed yet in my block devices' list?



    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sdb 8:16 0 489.1G 0 disk
    ├─sdb2 8:18 0 488M 0 part /boot
    ├─sdb3 8:19 0 488.1G 0 part
    │ └─sdb3_crypt 253:0 0 488.1G 0 crypt
    │ ├─ubuntu--vg-root 253:1 0 472.2G 0 lvm /
    │ └─ubuntu--vg-swap_1 253:2 0 15.9G 0 lvm [SWAP]
    └─sdb1 8:17 0 512M 0 part /boot/efi
    sda 8:0 0 931.5G 0 disk
    └─sda1 8:1 0 931.5G 0 part
    └─sda1_crypt 253:3 0 931.5G 0 crypt
    └─store--vg-store1tb 253:4 0 931.5G 0 lvm /datastore


    b) how can I permanently mount it via /etc/fstab since I cannot get its UUID?



    $ blkid
    /dev/mapper/sdb3_crypt: UUID="fSHjbj-51K2-QfhI-G0Wb-o3lN-4pE1-BB4wCP" TYPE="LVM2_member"
    /dev/mapper/ubuntu--vg-root: UUID="9e452886-4d8g-fj54-854c-80bc171826e8" TYPE="ext4"


    working on



    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 16.04.5 LTS
    Release: 16.04
    Codename: xenial


    with



    $ uname -a
    Linux pkara-pc01 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux









    share|improve this question


























      2












      2








      2







      I created a file



      touch /datastore/virtual/pseudoblock


      created a loop device with it



      sudo losetup /dev/loop0 /datastore/virtual/pseudoblock


      (although I got a warning about its size)



      and then initialized it with random data



      dd if=/dev/urandom of=/dev/loop0 bs=1M count=100


      My questions are



      a) why is it not displayed yet in my block devices' list?



      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      sdb 8:16 0 489.1G 0 disk
      ├─sdb2 8:18 0 488M 0 part /boot
      ├─sdb3 8:19 0 488.1G 0 part
      │ └─sdb3_crypt 253:0 0 488.1G 0 crypt
      │ ├─ubuntu--vg-root 253:1 0 472.2G 0 lvm /
      │ └─ubuntu--vg-swap_1 253:2 0 15.9G 0 lvm [SWAP]
      └─sdb1 8:17 0 512M 0 part /boot/efi
      sda 8:0 0 931.5G 0 disk
      └─sda1 8:1 0 931.5G 0 part
      └─sda1_crypt 253:3 0 931.5G 0 crypt
      └─store--vg-store1tb 253:4 0 931.5G 0 lvm /datastore


      b) how can I permanently mount it via /etc/fstab since I cannot get its UUID?



      $ blkid
      /dev/mapper/sdb3_crypt: UUID="fSHjbj-51K2-QfhI-G0Wb-o3lN-4pE1-BB4wCP" TYPE="LVM2_member"
      /dev/mapper/ubuntu--vg-root: UUID="9e452886-4d8g-fj54-854c-80bc171826e8" TYPE="ext4"


      working on



      $ lsb_release -a
      No LSB modules are available.
      Distributor ID: Ubuntu
      Description: Ubuntu 16.04.5 LTS
      Release: 16.04
      Codename: xenial


      with



      $ uname -a
      Linux pkara-pc01 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux









      share|improve this question















      I created a file



      touch /datastore/virtual/pseudoblock


      created a loop device with it



      sudo losetup /dev/loop0 /datastore/virtual/pseudoblock


      (although I got a warning about its size)



      and then initialized it with random data



      dd if=/dev/urandom of=/dev/loop0 bs=1M count=100


      My questions are



      a) why is it not displayed yet in my block devices' list?



      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      sdb 8:16 0 489.1G 0 disk
      ├─sdb2 8:18 0 488M 0 part /boot
      ├─sdb3 8:19 0 488.1G 0 part
      │ └─sdb3_crypt 253:0 0 488.1G 0 crypt
      │ ├─ubuntu--vg-root 253:1 0 472.2G 0 lvm /
      │ └─ubuntu--vg-swap_1 253:2 0 15.9G 0 lvm [SWAP]
      └─sdb1 8:17 0 512M 0 part /boot/efi
      sda 8:0 0 931.5G 0 disk
      └─sda1 8:1 0 931.5G 0 part
      └─sda1_crypt 253:3 0 931.5G 0 crypt
      └─store--vg-store1tb 253:4 0 931.5G 0 lvm /datastore


      b) how can I permanently mount it via /etc/fstab since I cannot get its UUID?



      $ blkid
      /dev/mapper/sdb3_crypt: UUID="fSHjbj-51K2-QfhI-G0Wb-o3lN-4pE1-BB4wCP" TYPE="LVM2_member"
      /dev/mapper/ubuntu--vg-root: UUID="9e452886-4d8g-fj54-854c-80bc171826e8" TYPE="ext4"


      working on



      $ lsb_release -a
      No LSB modules are available.
      Distributor ID: Ubuntu
      Description: Ubuntu 16.04.5 LTS
      Release: 16.04
      Codename: xenial


      with



      $ uname -a
      Linux pkara-pc01 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux






      filesystems block-device loop-device






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 14 at 7:38

























      asked Dec 14 at 7:22









      pkaramol

      449216




      449216




















          1 Answer
          1






          active

          oldest

          votes


















          3














          You're missing steps about creating a filesystem.



          dd if=/dev/urandom of=pseudoblock bs=1M count=100
          losetup /dev/loop0 pseudoblock


          Now you can create a filesystem on it.



          mkfs.ext4 /dev/loop0


          Once this is done, I can get an UUID (this identifies the filesystem, so if you haven't created one, you won't get an UUID), and then find it.



          blkid
          /dev/vda1: UUID="a76b548b-f4e4-4616-bea0-469775cb852d" TYPE="ext4" PARTUUID="8395c684-01"
          /dev/loop0: UUID="bb784e83-8484-4822-8930-20e02f689450" TYPE="ext4"


          Then I mount it, and I can write things in it.



          mount /dev/loop0 /mnt/loop


          And once that pseudo block device is initialized with a filesystem you can mount it directly with the fstab using a line like (no need to use losetup anymore, and there's no really need for an UUID, the file is not like /dev devices that could get probed in different order, it won't move, so it's no problem using its absolute path).



          /root/pseudoblock /mnt/loop auto loop 0 0





          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',
            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%2f487919%2fpermanently-mounting-loop-device%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            You're missing steps about creating a filesystem.



            dd if=/dev/urandom of=pseudoblock bs=1M count=100
            losetup /dev/loop0 pseudoblock


            Now you can create a filesystem on it.



            mkfs.ext4 /dev/loop0


            Once this is done, I can get an UUID (this identifies the filesystem, so if you haven't created one, you won't get an UUID), and then find it.



            blkid
            /dev/vda1: UUID="a76b548b-f4e4-4616-bea0-469775cb852d" TYPE="ext4" PARTUUID="8395c684-01"
            /dev/loop0: UUID="bb784e83-8484-4822-8930-20e02f689450" TYPE="ext4"


            Then I mount it, and I can write things in it.



            mount /dev/loop0 /mnt/loop


            And once that pseudo block device is initialized with a filesystem you can mount it directly with the fstab using a line like (no need to use losetup anymore, and there's no really need for an UUID, the file is not like /dev devices that could get probed in different order, it won't move, so it's no problem using its absolute path).



            /root/pseudoblock /mnt/loop auto loop 0 0





            share|improve this answer



























              3














              You're missing steps about creating a filesystem.



              dd if=/dev/urandom of=pseudoblock bs=1M count=100
              losetup /dev/loop0 pseudoblock


              Now you can create a filesystem on it.



              mkfs.ext4 /dev/loop0


              Once this is done, I can get an UUID (this identifies the filesystem, so if you haven't created one, you won't get an UUID), and then find it.



              blkid
              /dev/vda1: UUID="a76b548b-f4e4-4616-bea0-469775cb852d" TYPE="ext4" PARTUUID="8395c684-01"
              /dev/loop0: UUID="bb784e83-8484-4822-8930-20e02f689450" TYPE="ext4"


              Then I mount it, and I can write things in it.



              mount /dev/loop0 /mnt/loop


              And once that pseudo block device is initialized with a filesystem you can mount it directly with the fstab using a line like (no need to use losetup anymore, and there's no really need for an UUID, the file is not like /dev devices that could get probed in different order, it won't move, so it's no problem using its absolute path).



              /root/pseudoblock /mnt/loop auto loop 0 0





              share|improve this answer

























                3












                3








                3






                You're missing steps about creating a filesystem.



                dd if=/dev/urandom of=pseudoblock bs=1M count=100
                losetup /dev/loop0 pseudoblock


                Now you can create a filesystem on it.



                mkfs.ext4 /dev/loop0


                Once this is done, I can get an UUID (this identifies the filesystem, so if you haven't created one, you won't get an UUID), and then find it.



                blkid
                /dev/vda1: UUID="a76b548b-f4e4-4616-bea0-469775cb852d" TYPE="ext4" PARTUUID="8395c684-01"
                /dev/loop0: UUID="bb784e83-8484-4822-8930-20e02f689450" TYPE="ext4"


                Then I mount it, and I can write things in it.



                mount /dev/loop0 /mnt/loop


                And once that pseudo block device is initialized with a filesystem you can mount it directly with the fstab using a line like (no need to use losetup anymore, and there's no really need for an UUID, the file is not like /dev devices that could get probed in different order, it won't move, so it's no problem using its absolute path).



                /root/pseudoblock /mnt/loop auto loop 0 0





                share|improve this answer














                You're missing steps about creating a filesystem.



                dd if=/dev/urandom of=pseudoblock bs=1M count=100
                losetup /dev/loop0 pseudoblock


                Now you can create a filesystem on it.



                mkfs.ext4 /dev/loop0


                Once this is done, I can get an UUID (this identifies the filesystem, so if you haven't created one, you won't get an UUID), and then find it.



                blkid
                /dev/vda1: UUID="a76b548b-f4e4-4616-bea0-469775cb852d" TYPE="ext4" PARTUUID="8395c684-01"
                /dev/loop0: UUID="bb784e83-8484-4822-8930-20e02f689450" TYPE="ext4"


                Then I mount it, and I can write things in it.



                mount /dev/loop0 /mnt/loop


                And once that pseudo block device is initialized with a filesystem you can mount it directly with the fstab using a line like (no need to use losetup anymore, and there's no really need for an UUID, the file is not like /dev devices that could get probed in different order, it won't move, so it's no problem using its absolute path).



                /root/pseudoblock /mnt/loop auto loop 0 0






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 14 at 10:19

























                answered Dec 14 at 9:57









                Pierre-Alain TORET

                38618




                38618



























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f487919%2fpermanently-mounting-loop-device%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

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

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?