RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    How to best resize an .img file?

    Scheduled Pinned Locked Moved Help and Support
    imagesizeresize
    9 Posts 8 Posters 28.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      exonerated
      last edited by

      I want to copy over my arcade setup for my friend, however, the memory card I ordered him is slightly smaller than mine. They are both 16GB but his is a few sectors smaller. Not even half of the memory card is in use, so there is plenty of free space.

      Is there a simple way to resize the image file to shave off some size so I can copy my setup over?

      Was reading up on resize2fs, but doesn't seem like you can resize a mounted image.

      synackS columboscoatC 2 Replies Last reply Reply Quote 0
      • FloobF
        Floob
        last edited by

        I do this:
        http://smartretro.co.uk/forums/viewtopic.php?f=3&t=58

        Please read the Docs before asking a new question.
        RetroPie Help Guides: https://goo.gl/3gcNsT

        columboscoatC 1 Reply Last reply Reply Quote 0
        • synackS
          synack @exonerated
          last edited by

          @exonerated This script will shrink the .img.

          https://retropie.org.uk/forum/topic/6470/script-to-resize-shrink-win32-disk-imager-retropie-images

          1 Reply Last reply Reply Quote 0
          • columboscoatC
            columboscoat Banned @Floob
            last edited by

            @Floob I actually set up a dual boot on my Windows PC with Debian just so I could do this using gparted. I could have used a live CD/DVD or even a bootable USB but I had the space and wanted to muck about with lunux on a (slightly) more powerful machine than the Pi.

            1 Reply Last reply Reply Quote 0
            • columboscoatC
              columboscoat Banned @exonerated
              last edited by columboscoat

              @exonerated Don't try and shrink a mounted image. 9 times out of 10 you will corrupt it. Or you could get lucky. Get access to a Linux machine or use a live bootable Linux distro CD/DVD and use gparted. It's really simple, once it's all set up.

              cyperghostC 1 Reply Last reply Reply Quote 1
              • cyperghostC
                cyperghost @columboscoat
                last edited by cyperghost

                @columboscoat I totally agree!

                I wrote a guide ..... long long time ago ... how to resize fs (with gparted live) and how to create IMG on Windows PCs
                I used this method and it worked several times. You can get the sector size even on the gparted system.

                Imho you are punished by using Windows systems and doing filesystem operations on Unix systems :)

                1 Reply Last reply Reply Quote 0
                • S
                  spawnreaper
                  last edited by

                  Is there an mac option for this?

                  1 Reply Last reply Reply Quote 0
                  • S
                    Sigmanutz
                    last edited by

                    QUESTION

                    Let's say we are working with a 128gb microSD card. If we are trying to create our own custom 64gb image, and according to the 'dm' command, we appear to be within 64gb image territory: What is the best practice for determining space used prior to writing with Win32 Disk Imager and Shrinking the image? The entire process takes two hours and its extremely frustrating when it Pi Shrink returns a shrunken image thats still too big to fit on a 64gb card.

                    mituM 1 Reply Last reply Reply Quote 0
                    • mituM
                      mitu Global Moderator @Sigmanutz
                      last edited by mitu

                      @sigmanutz Ideally you'd look at the dimension of the 64Gb drive with df and note the number of total blocks of the / partition, then compare to the df output from your 128Gb card (also in blocks) and note the number of blocks used.
                      But, just to make sure, just backup the biggest ROMs folder to your PC and you're sure to get a smaller image and the creation process will also be shorter. You can then move back the ROMs to the new system.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post

                      Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                      Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.