Backup the information with rsync to generate a mountable image?

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












0















Looking for some program to create a file of image of the information (.img) to later be able to mount it, I have not found anything simple. In the case of Clonezilla, it requires additional space to unzip the images and then assemble them. And if I need to access the image file and the size has already exceeded the storage space of my disk?



Then I came up with the following idea to create a mountable .img with the information, maybe with some additional commands or utilities it could be improved: It could be that I could create an empty .img image, format it with fsck and I ' m not sure if it would be a good idea, but I could use rsync to synchronize all the current data to the .img image (previously mounted). What do you think of this solution? I'm sure others will like it too because I've seen that later they want to mount their images.



How should I use rsync to do this?










share|improve this question


























    0















    Looking for some program to create a file of image of the information (.img) to later be able to mount it, I have not found anything simple. In the case of Clonezilla, it requires additional space to unzip the images and then assemble them. And if I need to access the image file and the size has already exceeded the storage space of my disk?



    Then I came up with the following idea to create a mountable .img with the information, maybe with some additional commands or utilities it could be improved: It could be that I could create an empty .img image, format it with fsck and I ' m not sure if it would be a good idea, but I could use rsync to synchronize all the current data to the .img image (previously mounted). What do you think of this solution? I'm sure others will like it too because I've seen that later they want to mount their images.



    How should I use rsync to do this?










    share|improve this question
























      0












      0








      0








      Looking for some program to create a file of image of the information (.img) to later be able to mount it, I have not found anything simple. In the case of Clonezilla, it requires additional space to unzip the images and then assemble them. And if I need to access the image file and the size has already exceeded the storage space of my disk?



      Then I came up with the following idea to create a mountable .img with the information, maybe with some additional commands or utilities it could be improved: It could be that I could create an empty .img image, format it with fsck and I ' m not sure if it would be a good idea, but I could use rsync to synchronize all the current data to the .img image (previously mounted). What do you think of this solution? I'm sure others will like it too because I've seen that later they want to mount their images.



      How should I use rsync to do this?










      share|improve this question














      Looking for some program to create a file of image of the information (.img) to later be able to mount it, I have not found anything simple. In the case of Clonezilla, it requires additional space to unzip the images and then assemble them. And if I need to access the image file and the size has already exceeded the storage space of my disk?



      Then I came up with the following idea to create a mountable .img with the information, maybe with some additional commands or utilities it could be improved: It could be that I could create an empty .img image, format it with fsck and I ' m not sure if it would be a good idea, but I could use rsync to synchronize all the current data to the .img image (previously mounted). What do you think of this solution? I'm sure others will like it too because I've seen that later they want to mount their images.



      How should I use rsync to do this?







      mount backup cloning






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 10:41









      MarianoMMarianoM

      165




      165




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I don't know of any soft being able to achieve this, but you can do it using loopdevices.



          # Create an image file (100 M in the example, change the count to 1000 for 1G, etc)
          dd if=/dev/urandom of=/path/to/image.img bs=1M count=100
          # Now we use it as a loop device
          sudo losetup /dev/loop0 /path/to/image.img
          # Format it using the filesystem of your choice (I'm using ext4 here for the example).
          mkfs.ext4 /dev/loop0

          # Mount that new filesystem.
          mkdir /mnt/loop && mount /dev/loop0 /mnt/loop

          # Now we can transfer things to the image using rsync (for example /var/log content)
          rsync -avz /var/log/ /mnt/loop/

          # Unmount the filesystem and remove the loop device.
          umount /mnt/loop
          losetup -D /dev/loop0


          You can now move image.img and use it somewhere else (or you can just store it on some remote device like you would for a regular file).



          In order to use it on an other computer for example :



          # Copy image.img using the tool you want (scp, etc...)
          # Mount the image
          mount -o loop /path/to/image.img /mnt/loop
          # Alter content of the image
          # Safely unmount the filesystem
          umount /mnt/loop





          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%2f492210%2fbackup-the-information-with-rsync-to-generate-a-mountable-image%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









            0














            I don't know of any soft being able to achieve this, but you can do it using loopdevices.



            # Create an image file (100 M in the example, change the count to 1000 for 1G, etc)
            dd if=/dev/urandom of=/path/to/image.img bs=1M count=100
            # Now we use it as a loop device
            sudo losetup /dev/loop0 /path/to/image.img
            # Format it using the filesystem of your choice (I'm using ext4 here for the example).
            mkfs.ext4 /dev/loop0

            # Mount that new filesystem.
            mkdir /mnt/loop && mount /dev/loop0 /mnt/loop

            # Now we can transfer things to the image using rsync (for example /var/log content)
            rsync -avz /var/log/ /mnt/loop/

            # Unmount the filesystem and remove the loop device.
            umount /mnt/loop
            losetup -D /dev/loop0


            You can now move image.img and use it somewhere else (or you can just store it on some remote device like you would for a regular file).



            In order to use it on an other computer for example :



            # Copy image.img using the tool you want (scp, etc...)
            # Mount the image
            mount -o loop /path/to/image.img /mnt/loop
            # Alter content of the image
            # Safely unmount the filesystem
            umount /mnt/loop





            share|improve this answer



























              0














              I don't know of any soft being able to achieve this, but you can do it using loopdevices.



              # Create an image file (100 M in the example, change the count to 1000 for 1G, etc)
              dd if=/dev/urandom of=/path/to/image.img bs=1M count=100
              # Now we use it as a loop device
              sudo losetup /dev/loop0 /path/to/image.img
              # Format it using the filesystem of your choice (I'm using ext4 here for the example).
              mkfs.ext4 /dev/loop0

              # Mount that new filesystem.
              mkdir /mnt/loop && mount /dev/loop0 /mnt/loop

              # Now we can transfer things to the image using rsync (for example /var/log content)
              rsync -avz /var/log/ /mnt/loop/

              # Unmount the filesystem and remove the loop device.
              umount /mnt/loop
              losetup -D /dev/loop0


              You can now move image.img and use it somewhere else (or you can just store it on some remote device like you would for a regular file).



              In order to use it on an other computer for example :



              # Copy image.img using the tool you want (scp, etc...)
              # Mount the image
              mount -o loop /path/to/image.img /mnt/loop
              # Alter content of the image
              # Safely unmount the filesystem
              umount /mnt/loop





              share|improve this answer

























                0












                0








                0







                I don't know of any soft being able to achieve this, but you can do it using loopdevices.



                # Create an image file (100 M in the example, change the count to 1000 for 1G, etc)
                dd if=/dev/urandom of=/path/to/image.img bs=1M count=100
                # Now we use it as a loop device
                sudo losetup /dev/loop0 /path/to/image.img
                # Format it using the filesystem of your choice (I'm using ext4 here for the example).
                mkfs.ext4 /dev/loop0

                # Mount that new filesystem.
                mkdir /mnt/loop && mount /dev/loop0 /mnt/loop

                # Now we can transfer things to the image using rsync (for example /var/log content)
                rsync -avz /var/log/ /mnt/loop/

                # Unmount the filesystem and remove the loop device.
                umount /mnt/loop
                losetup -D /dev/loop0


                You can now move image.img and use it somewhere else (or you can just store it on some remote device like you would for a regular file).



                In order to use it on an other computer for example :



                # Copy image.img using the tool you want (scp, etc...)
                # Mount the image
                mount -o loop /path/to/image.img /mnt/loop
                # Alter content of the image
                # Safely unmount the filesystem
                umount /mnt/loop





                share|improve this answer













                I don't know of any soft being able to achieve this, but you can do it using loopdevices.



                # Create an image file (100 M in the example, change the count to 1000 for 1G, etc)
                dd if=/dev/urandom of=/path/to/image.img bs=1M count=100
                # Now we use it as a loop device
                sudo losetup /dev/loop0 /path/to/image.img
                # Format it using the filesystem of your choice (I'm using ext4 here for the example).
                mkfs.ext4 /dev/loop0

                # Mount that new filesystem.
                mkdir /mnt/loop && mount /dev/loop0 /mnt/loop

                # Now we can transfer things to the image using rsync (for example /var/log content)
                rsync -avz /var/log/ /mnt/loop/

                # Unmount the filesystem and remove the loop device.
                umount /mnt/loop
                losetup -D /dev/loop0


                You can now move image.img and use it somewhere else (or you can just store it on some remote device like you would for a regular file).



                In order to use it on an other computer for example :



                # Copy image.img using the tool you want (scp, etc...)
                # Mount the image
                mount -o loop /path/to/image.img /mnt/loop
                # Alter content of the image
                # Safely unmount the filesystem
                umount /mnt/loop






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 3 at 13:47









                Pierre-Alain TORETPierre-Alain TORET

                39618




                39618



























                    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%2f492210%2fbackup-the-information-with-rsync-to-generate-a-mountable-image%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?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay