Ubuntu - mount image file with r/w permissionExt3 drive will not mount after power failure; how to recover...

Count repetitions of an array

Website seeing my Facebook data?

Describe a span of time of 1 or 2 years, without being too literal

How to politely refuse in-office gym instructor for steroids and protein

Should I cite R or RStudio?

What is the difference between "...", '...', $'...', and $"..." quotes?

Why did Luke use his left hand to shoot?

When obtaining gender reassignment/plastic surgery overseas, is an emergency travel document required to return home?

Is there a way to store 9th-level spells in a Glyph of Warding or similar method?

Do authors have to be politically correct in article-writing?

The No-Straight Maze

I have trouble understanding this fallacy: "If A, then B. Therefore if not-B, then not-A."

Why didn't the 2019 Oscars have a host?

Is a creature that sees a Medusa's eyes automatically subjected to a saving throw?

Why is the "Domain users" group missing from this Powershell AD Query?

Cat is tipping over bed-side lamps during the night

Equivalent of "illegal" for violating civil law

Calculate of total length of edges in Voronoi diagram

What is the industry term for house wiring diagrams?

Why does 0.-5 evaluate to -5?

Possible issue with my W4 and tax return

Will rerolling initiative each round stop meta-gaming about initiative?

Can we "borrow" our answers to populate our own websites?

Is there a way to not have to poll the UART of an AVR?



Ubuntu - mount image file with r/w permission


Ext3 drive will not mount after power failure; how to recover files?mounting minix filesystem on ubuntuUbuntu 6.06: Mounting /root/sda1 /root failed: No such devicehard drive broken?Recovering DATA from HDD pulled from failed NASRestore access to Linux partition after wiping Windows partition through Windows installerUnrecognized mount option “fmask=0111” or missing valuelinux refused to mount a valid partitionI connected my usb hdd driver. CentOS7 don't mount itRecover Data from ext4 Volume (Structure Needs Cleaning, etc.)













3















Host: Ubuntu 15.04



With Disk Image Mounter, I can mount the test.img and three directories popped up.




  1. system-a

  2. system-b

  3. writable


As I've searched around, I can not edit the directories since those are read-only.



The possible solution I found so far is to copy these directories to another new place and generate a new image file.



However, since the image file contains these three directories, how can I do it?



=============post update=============



mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or helper program, or other error

In some cases useful info is found in syslog - try
dmesg | tail or so.


=====================================



Device                Start     End Sectors  Size Type
test_custom2.img1 8192 16383 8192 4M BIOS boot
test_custom2.img2 16384 147455 131072 64M EFI System
test_custom2.img3 147456 2244607 2097152 1G Linux filesystem
test_custom2.img4 2244608 4341759 2097152 1G Linux filesystem
test_custom2.img5 4341760 7614463 3272704 1.6G Linux filesystem









share|improve this question















migrated from stackoverflow.com Dec 28 '15 at 17:06


This question came from our site for professional and enthusiast programmers.



















  • What type of filesystem does the image hold?

    – andreas-hofmann
    Dec 28 '15 at 9:16











  • @andreas-hofmann ext4

    – Sam
    Dec 28 '15 at 9:37











  • Are there any partitions in the image? What does the output of fdisk -l image.img say?

    – andreas-hofmann
    Dec 28 '15 at 10:16











  • @andreas-hofmann post updated.

    – Sam
    Dec 28 '15 at 10:18
















3















Host: Ubuntu 15.04



With Disk Image Mounter, I can mount the test.img and three directories popped up.




  1. system-a

  2. system-b

  3. writable


As I've searched around, I can not edit the directories since those are read-only.



The possible solution I found so far is to copy these directories to another new place and generate a new image file.



However, since the image file contains these three directories, how can I do it?



=============post update=============



mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or helper program, or other error

In some cases useful info is found in syslog - try
dmesg | tail or so.


=====================================



Device                Start     End Sectors  Size Type
test_custom2.img1 8192 16383 8192 4M BIOS boot
test_custom2.img2 16384 147455 131072 64M EFI System
test_custom2.img3 147456 2244607 2097152 1G Linux filesystem
test_custom2.img4 2244608 4341759 2097152 1G Linux filesystem
test_custom2.img5 4341760 7614463 3272704 1.6G Linux filesystem









share|improve this question















migrated from stackoverflow.com Dec 28 '15 at 17:06


This question came from our site for professional and enthusiast programmers.



















  • What type of filesystem does the image hold?

    – andreas-hofmann
    Dec 28 '15 at 9:16











  • @andreas-hofmann ext4

    – Sam
    Dec 28 '15 at 9:37











  • Are there any partitions in the image? What does the output of fdisk -l image.img say?

    – andreas-hofmann
    Dec 28 '15 at 10:16











  • @andreas-hofmann post updated.

    – Sam
    Dec 28 '15 at 10:18














3












3








3


2






Host: Ubuntu 15.04



With Disk Image Mounter, I can mount the test.img and three directories popped up.




  1. system-a

  2. system-b

  3. writable


As I've searched around, I can not edit the directories since those are read-only.



The possible solution I found so far is to copy these directories to another new place and generate a new image file.



However, since the image file contains these three directories, how can I do it?



=============post update=============



mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or helper program, or other error

In some cases useful info is found in syslog - try
dmesg | tail or so.


=====================================



Device                Start     End Sectors  Size Type
test_custom2.img1 8192 16383 8192 4M BIOS boot
test_custom2.img2 16384 147455 131072 64M EFI System
test_custom2.img3 147456 2244607 2097152 1G Linux filesystem
test_custom2.img4 2244608 4341759 2097152 1G Linux filesystem
test_custom2.img5 4341760 7614463 3272704 1.6G Linux filesystem









share|improve this question
















Host: Ubuntu 15.04



With Disk Image Mounter, I can mount the test.img and three directories popped up.




  1. system-a

  2. system-b

  3. writable


As I've searched around, I can not edit the directories since those are read-only.



The possible solution I found so far is to copy these directories to another new place and generate a new image file.



However, since the image file contains these three directories, how can I do it?



=============post update=============



mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or helper program, or other error

In some cases useful info is found in syslog - try
dmesg | tail or so.


=====================================



Device                Start     End Sectors  Size Type
test_custom2.img1 8192 16383 8192 4M BIOS boot
test_custom2.img2 16384 147455 131072 64M EFI System
test_custom2.img3 147456 2244607 2097152 1G Linux filesystem
test_custom2.img4 2244608 4341759 2097152 1G Linux filesystem
test_custom2.img5 4341760 7614463 3272704 1.6G Linux filesystem






linux ubuntu






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 11 '16 at 14:47









Chenmunka

2,79481931




2,79481931










asked Dec 28 '15 at 7:54









SamSam

12116




12116




migrated from stackoverflow.com Dec 28 '15 at 17:06


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Dec 28 '15 at 17:06


This question came from our site for professional and enthusiast programmers.















  • What type of filesystem does the image hold?

    – andreas-hofmann
    Dec 28 '15 at 9:16











  • @andreas-hofmann ext4

    – Sam
    Dec 28 '15 at 9:37











  • Are there any partitions in the image? What does the output of fdisk -l image.img say?

    – andreas-hofmann
    Dec 28 '15 at 10:16











  • @andreas-hofmann post updated.

    – Sam
    Dec 28 '15 at 10:18



















  • What type of filesystem does the image hold?

    – andreas-hofmann
    Dec 28 '15 at 9:16











  • @andreas-hofmann ext4

    – Sam
    Dec 28 '15 at 9:37











  • Are there any partitions in the image? What does the output of fdisk -l image.img say?

    – andreas-hofmann
    Dec 28 '15 at 10:16











  • @andreas-hofmann post updated.

    – Sam
    Dec 28 '15 at 10:18

















What type of filesystem does the image hold?

– andreas-hofmann
Dec 28 '15 at 9:16





What type of filesystem does the image hold?

– andreas-hofmann
Dec 28 '15 at 9:16













@andreas-hofmann ext4

– Sam
Dec 28 '15 at 9:37





@andreas-hofmann ext4

– Sam
Dec 28 '15 at 9:37













Are there any partitions in the image? What does the output of fdisk -l image.img say?

– andreas-hofmann
Dec 28 '15 at 10:16





Are there any partitions in the image? What does the output of fdisk -l image.img say?

– andreas-hofmann
Dec 28 '15 at 10:16













@andreas-hofmann post updated.

– Sam
Dec 28 '15 at 10:18





@andreas-hofmann post updated.

– Sam
Dec 28 '15 at 10:18










3 Answers
3






active

oldest

votes


















1














The problem is that there are multiple partitions in your image. A plain old mount looks for filesystem information at offset 0, which in your case apparently points to some bios boot information, but not to the desired ext4 fs. You should succeed by creating the loopback-device with an offset to the desired partition.



This link may help you out.






share|improve this answer































    3














    You need to make sure that your current user directory has read and write access to your operation



    sudo mkdir -p /tmp/test && sudo mount -o loop,rw,sync image.img /tmp/test





    share|improve this answer


























    • thanks, but I got the error by typing your command

      – Sam
      Dec 28 '15 at 8:19











    • I've updated the post, please let me know if you have any further idea.

      – Sam
      Dec 28 '15 at 9:01



















    0














    Here's the full process, based on the answer here:



    Your .img file is not an image of a partition, but of a whole disk. That means it starts with a bootloader and a partition table. You have to detect the offset of the partition and mount it specifically. So you have to do math, but it's easy. Here's the process:



    fdisk -l raspberry_pi.img


    Which gives the output below. Note the sector size in bytes (512 in this case) and the Start sector of the partition (94208 for the Linux partition in this case).



    Disk raspberry_pi.img: 7.3 GiB, 7826571264 bytes, 15286272 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0xbeb1a7ff

    Device Boot Start End Sectors Size Id Type
    raspberry_pi.img1 8192 93813 85622 41.8M c W95 FAT32 (LBA)
    raspberry_pi.img2 94208 15069183 14974976 7.1G 83 Linux


    Now, manually multiply the start sector * sector size to get the offset bytes that the mount command needs. In this case, 94208 * 512 = 48234496



    sudo mkdir /media/sdcard
    sudo mount -o loop,rw,sync,offset=48234496 printer_v5.img /media/sdcard


    Now, the image's Linux partition is mounted at /media/sdcard and the root user can edit its files.



    Finally, when you're finished:



    sudo umount /media/sdcard





    share|improve this answer










    New contributor




    Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.




















      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%2f1018877%2fubuntu-mount-image-file-with-r-w-permission%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      The problem is that there are multiple partitions in your image. A plain old mount looks for filesystem information at offset 0, which in your case apparently points to some bios boot information, but not to the desired ext4 fs. You should succeed by creating the loopback-device with an offset to the desired partition.



      This link may help you out.






      share|improve this answer




























        1














        The problem is that there are multiple partitions in your image. A plain old mount looks for filesystem information at offset 0, which in your case apparently points to some bios boot information, but not to the desired ext4 fs. You should succeed by creating the loopback-device with an offset to the desired partition.



        This link may help you out.






        share|improve this answer


























          1












          1








          1







          The problem is that there are multiple partitions in your image. A plain old mount looks for filesystem information at offset 0, which in your case apparently points to some bios boot information, but not to the desired ext4 fs. You should succeed by creating the loopback-device with an offset to the desired partition.



          This link may help you out.






          share|improve this answer













          The problem is that there are multiple partitions in your image. A plain old mount looks for filesystem information at offset 0, which in your case apparently points to some bios boot information, but not to the desired ext4 fs. You should succeed by creating the loopback-device with an offset to the desired partition.



          This link may help you out.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 28 '15 at 10:23









          andreas-hofmannandreas-hofmann

          1263




          1263

























              3














              You need to make sure that your current user directory has read and write access to your operation



              sudo mkdir -p /tmp/test && sudo mount -o loop,rw,sync image.img /tmp/test





              share|improve this answer


























              • thanks, but I got the error by typing your command

                – Sam
                Dec 28 '15 at 8:19











              • I've updated the post, please let me know if you have any further idea.

                – Sam
                Dec 28 '15 at 9:01
















              3














              You need to make sure that your current user directory has read and write access to your operation



              sudo mkdir -p /tmp/test && sudo mount -o loop,rw,sync image.img /tmp/test





              share|improve this answer


























              • thanks, but I got the error by typing your command

                – Sam
                Dec 28 '15 at 8:19











              • I've updated the post, please let me know if you have any further idea.

                – Sam
                Dec 28 '15 at 9:01














              3












              3








              3







              You need to make sure that your current user directory has read and write access to your operation



              sudo mkdir -p /tmp/test && sudo mount -o loop,rw,sync image.img /tmp/test





              share|improve this answer















              You need to make sure that your current user directory has read and write access to your operation



              sudo mkdir -p /tmp/test && sudo mount -o loop,rw,sync image.img /tmp/test






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 30 '18 at 20:37









              evandrix

              10914




              10914










              answered Dec 28 '15 at 8:10







              Job.F




















              • thanks, but I got the error by typing your command

                – Sam
                Dec 28 '15 at 8:19











              • I've updated the post, please let me know if you have any further idea.

                – Sam
                Dec 28 '15 at 9:01



















              • thanks, but I got the error by typing your command

                – Sam
                Dec 28 '15 at 8:19











              • I've updated the post, please let me know if you have any further idea.

                – Sam
                Dec 28 '15 at 9:01

















              thanks, but I got the error by typing your command

              – Sam
              Dec 28 '15 at 8:19





              thanks, but I got the error by typing your command

              – Sam
              Dec 28 '15 at 8:19













              I've updated the post, please let me know if you have any further idea.

              – Sam
              Dec 28 '15 at 9:01





              I've updated the post, please let me know if you have any further idea.

              – Sam
              Dec 28 '15 at 9:01











              0














              Here's the full process, based on the answer here:



              Your .img file is not an image of a partition, but of a whole disk. That means it starts with a bootloader and a partition table. You have to detect the offset of the partition and mount it specifically. So you have to do math, but it's easy. Here's the process:



              fdisk -l raspberry_pi.img


              Which gives the output below. Note the sector size in bytes (512 in this case) and the Start sector of the partition (94208 for the Linux partition in this case).



              Disk raspberry_pi.img: 7.3 GiB, 7826571264 bytes, 15286272 sectors
              Units: sectors of 1 * 512 = 512 bytes
              Sector size (logical/physical): 512 bytes / 512 bytes
              I/O size (minimum/optimal): 512 bytes / 512 bytes
              Disklabel type: dos
              Disk identifier: 0xbeb1a7ff

              Device Boot Start End Sectors Size Id Type
              raspberry_pi.img1 8192 93813 85622 41.8M c W95 FAT32 (LBA)
              raspberry_pi.img2 94208 15069183 14974976 7.1G 83 Linux


              Now, manually multiply the start sector * sector size to get the offset bytes that the mount command needs. In this case, 94208 * 512 = 48234496



              sudo mkdir /media/sdcard
              sudo mount -o loop,rw,sync,offset=48234496 printer_v5.img /media/sdcard


              Now, the image's Linux partition is mounted at /media/sdcard and the root user can edit its files.



              Finally, when you're finished:



              sudo umount /media/sdcard





              share|improve this answer










              New contributor




              Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                0














                Here's the full process, based on the answer here:



                Your .img file is not an image of a partition, but of a whole disk. That means it starts with a bootloader and a partition table. You have to detect the offset of the partition and mount it specifically. So you have to do math, but it's easy. Here's the process:



                fdisk -l raspberry_pi.img


                Which gives the output below. Note the sector size in bytes (512 in this case) and the Start sector of the partition (94208 for the Linux partition in this case).



                Disk raspberry_pi.img: 7.3 GiB, 7826571264 bytes, 15286272 sectors
                Units: sectors of 1 * 512 = 512 bytes
                Sector size (logical/physical): 512 bytes / 512 bytes
                I/O size (minimum/optimal): 512 bytes / 512 bytes
                Disklabel type: dos
                Disk identifier: 0xbeb1a7ff

                Device Boot Start End Sectors Size Id Type
                raspberry_pi.img1 8192 93813 85622 41.8M c W95 FAT32 (LBA)
                raspberry_pi.img2 94208 15069183 14974976 7.1G 83 Linux


                Now, manually multiply the start sector * sector size to get the offset bytes that the mount command needs. In this case, 94208 * 512 = 48234496



                sudo mkdir /media/sdcard
                sudo mount -o loop,rw,sync,offset=48234496 printer_v5.img /media/sdcard


                Now, the image's Linux partition is mounted at /media/sdcard and the root user can edit its files.



                Finally, when you're finished:



                sudo umount /media/sdcard





                share|improve this answer










                New contributor




                Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  0












                  0








                  0







                  Here's the full process, based on the answer here:



                  Your .img file is not an image of a partition, but of a whole disk. That means it starts with a bootloader and a partition table. You have to detect the offset of the partition and mount it specifically. So you have to do math, but it's easy. Here's the process:



                  fdisk -l raspberry_pi.img


                  Which gives the output below. Note the sector size in bytes (512 in this case) and the Start sector of the partition (94208 for the Linux partition in this case).



                  Disk raspberry_pi.img: 7.3 GiB, 7826571264 bytes, 15286272 sectors
                  Units: sectors of 1 * 512 = 512 bytes
                  Sector size (logical/physical): 512 bytes / 512 bytes
                  I/O size (minimum/optimal): 512 bytes / 512 bytes
                  Disklabel type: dos
                  Disk identifier: 0xbeb1a7ff

                  Device Boot Start End Sectors Size Id Type
                  raspberry_pi.img1 8192 93813 85622 41.8M c W95 FAT32 (LBA)
                  raspberry_pi.img2 94208 15069183 14974976 7.1G 83 Linux


                  Now, manually multiply the start sector * sector size to get the offset bytes that the mount command needs. In this case, 94208 * 512 = 48234496



                  sudo mkdir /media/sdcard
                  sudo mount -o loop,rw,sync,offset=48234496 printer_v5.img /media/sdcard


                  Now, the image's Linux partition is mounted at /media/sdcard and the root user can edit its files.



                  Finally, when you're finished:



                  sudo umount /media/sdcard





                  share|improve this answer










                  New contributor




                  Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  Here's the full process, based on the answer here:



                  Your .img file is not an image of a partition, but of a whole disk. That means it starts with a bootloader and a partition table. You have to detect the offset of the partition and mount it specifically. So you have to do math, but it's easy. Here's the process:



                  fdisk -l raspberry_pi.img


                  Which gives the output below. Note the sector size in bytes (512 in this case) and the Start sector of the partition (94208 for the Linux partition in this case).



                  Disk raspberry_pi.img: 7.3 GiB, 7826571264 bytes, 15286272 sectors
                  Units: sectors of 1 * 512 = 512 bytes
                  Sector size (logical/physical): 512 bytes / 512 bytes
                  I/O size (minimum/optimal): 512 bytes / 512 bytes
                  Disklabel type: dos
                  Disk identifier: 0xbeb1a7ff

                  Device Boot Start End Sectors Size Id Type
                  raspberry_pi.img1 8192 93813 85622 41.8M c W95 FAT32 (LBA)
                  raspberry_pi.img2 94208 15069183 14974976 7.1G 83 Linux


                  Now, manually multiply the start sector * sector size to get the offset bytes that the mount command needs. In this case, 94208 * 512 = 48234496



                  sudo mkdir /media/sdcard
                  sudo mount -o loop,rw,sync,offset=48234496 printer_v5.img /media/sdcard


                  Now, the image's Linux partition is mounted at /media/sdcard and the root user can edit its files.



                  Finally, when you're finished:



                  sudo umount /media/sdcard






                  share|improve this answer










                  New contributor




                  Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer








                  edited 6 hours ago





















                  New contributor




                  Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 6 hours ago









                  LukeLuke

                  1013




                  1013




                  New contributor




                  Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Luke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      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%2f1018877%2fubuntu-mount-image-file-with-r-w-permission%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...