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

    [SOLVED] How do I resize the filesystem?

    Scheduled Pinned Locked Moved Help and Support
    upgraderesizebackup
    17 Posts 10 Posters 46.8k 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.
    • D
      Dochartaigh @soulfunkdjx
      last edited by

      @soulfunkdjx said in How do I resize the filesystem?:

      I have a backup image of my retropie from a 32 gb sdcard and i want to restore this backup to a new 128gb sdcard so i can add more roms.
      Do i only have to add this command line -> sudo raspi-config and then just press expand the file system and reboot?
      Will this work?

      In theory yes, but from my above post you can see that it doesn't always work...don't know if my image was bad or what...I had to start ALL over.

      1 Reply Last reply Reply Quote 0
      • BuZzB
        BuZz administrators @Dochartaigh
        last edited by BuZz

        @Dochartaigh Sounds like you have filesystem corruption there - you should not get an error like that. Probably badly cloned/written image (unless the card has developed problems).

        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

        D 1 Reply Last reply Reply Quote 0
        • D
          Dochartaigh @BuZz
          last edited by

          @BuZz said in How do I resize the filesystem?:

          @Dochartaigh Sounds like you have filesystem corruption there - you should not get error like that. Probably badly clones/written image (unless the card has developed problems).

          My thoughts too. Totally stinks. This is why I always used BerryBoot for super-easy backups (until you told me the BerryBoot kernels were outdated ;) I may try to find some other program than ApplePi-Baker program on my mac and see if that does it correctly (i know the built-in Disk Utility can make images - but I've never tried it on an SD card)...and I'm afraid I don't have a 2nd 128gb card that the new RetroPie install is now on to test it - and don't want to take the chance of formatting my one card and trying to restore that backup in case it's corrupted again.

          1 Reply Last reply Reply Quote 0
          • F
            frob
            last edited by frob

            Most of these programs are just a GUI that runs the dd command. Checkout the official doc on creating images https://www.raspberrypi.org/documentation/installation/installing-images/mac.md and look at the Command Line options.

            dd is used in the unix world to create/restore images of drives. It is normally pretty reliable, but always remember to image and manually backup the retropie directory.

            Also, if you are using dd directly, always double check your command. A typo here and it can easily start to image retropie over your main hdd.

            1 Reply Last reply Reply Quote 0
            • CybermenC
              Cybermen
              last edited by

              another question would be whether it is also reversed? so from a 128GB card to a 64GB card? my complete system even has only 32GB.

              ByteThisB mituM 2 Replies Last reply Reply Quote 0
              • ByteThisB
                ByteThis @Cybermen
                last edited by

                @cybermen No reverse.You would have to shrink the image down to fit on a smaller card.

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

                  @cybermen said in [SOLVED] How do I resize the filesystem?:

                  another question would be whether it is also reversed? so from a 128GB card to a 64GB card? my complete system even has only 32GB.

                  You might try using https://github.com/billw2/rpi-clone - it seems to support synchronising the current image to a new media with a different size.
                  You could get a new sd card, put the standard RetroPie image on it, then use an USD card reader to synchronise the running SD card to it.

                  1 Reply Last reply Reply Quote 0
                  • CybermenC
                    Cybermen
                    last edited by

                    thanks for the reply, it will try it.

                    1 Reply Last reply Reply Quote 0
                    • J
                      jessco
                      last edited by

                      For mac users of sierra, I use a program called Etcher it burns image files perfectly!

                      1 Reply Last reply Reply Quote 0
                      • R
                        RetroRains
                        last edited by RetroRains

                        RetroPie will give you an LBS error trying to resize on boot with retropie 4.4 with berryboot. It will also not allow you to resize it from retropie raspi-config nor while you have retropie booted and using the command line.

                        If you are using berryboot with retropie you will need to reboot the pie and do this from berryboots terminal via the berry boot menu with ctrl + alt + F2. I was able to resize an image I took of a 16G SD card written to a 64G card and resize it to expand all available space to the SD.

                        Links~
                        https://raspberry-projects.com/pi/pi-operating-systems/raspbian/troubleshooting/expand-filesystem-issues
                        https://www.chrisnewland.com/resize-raspberry-pi-sd-card-partition-to-fill-32gb-card-from-a-running-raspberry-pi-245

                        I cannot take credit for this, but will link what helped me after I spent a few hours trying to figure it out. Back up your SD pay no attention to drive space numbers in the examples below.

                        Backup your SD card to an image file first!

                        Enter this to see the current partition usage:
                        df

                        E.g.
                        Filesystem 1K-blocks Used Available Use% Mounted on
                        rootfs 3698504 3351472 146524 96% /
                        /dev/root 3698504 3351472 146524 96% /
                        devtmpfs 494800 0 494800 0% /dev
                        tmpfs 99820 240 99580 1% /run
                        tmpfs 5120 0 5120 0% /run/lock
                        tmpfs 199620 0 199620 0% /run/shm
                        /dev/mmcblk0p1 57288 19400 37888 34% /boot

                        The rootfs and /dev/root is the same thing, its just a debian thing the have them both appear as separate

                        Enter this:
                        sudo fdisk /dev/mmcblk0

                        Then press 'p' to see the current partitions on the disk. E.g.

                        Disk /dev/mmcblk0: 7860 MB, 7860125696 bytes
                        4 heads, 16 sectors/track, 239872 cylinders, total 15351808 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
                        Disk identifier: 0xa6202af7
                        Device Boot Start End Blocks Id System
                        /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
                        /dev/mmcblk0p2 122880 15351807 7614464 83 Linux

                        Now delete the 2nd partition (it won't actually delete the data on it)
                        Press 'd' > Enter
                        Press '2' > Enter

                        Now re-create it:
                        Press 'n' > Enter
                        Press 'p' > Enter
                        Press '2' > Enter

                        Enter the First sector and the same value as the original /dev/mmcblk0p2 partition (122880 from the above example).

                        For the Last sector just press enter to use the maximum value.

                        Now press 'p' > Enter to see the new partition setup.
                        Finally press 'w' > Enter to write it

                        Now reboot:
                        sudo shutdown -r now

                        Once its back do the resize:
                        sudo resize2fs /dev/mmcblk0p2

                        This may take a little while to complete…

                        Now enter the command
                        df

                        and hey presto, you've expanded to use all the space :-)

                        Filesystem 1K-blocks Used Available Use% Mounted on
                        rootfs 7513804 3352360 3810208 47% /
                        /dev/root 7513804 3352360 3810208 47% /
                        devtmpfs 494800 0 494800 0% /dev
                        tmpfs 99820 240 99580 1% /run
                        tmpfs 5120 0 5120 0% /run/lock
                        tmpfs 199620 0 199620 0% /run/shm
                        /dev/mmcblk0p1 57288 19400 37888 34% /boot

                        1 Reply Last reply Reply Quote 0
                        • dankcushionsD dankcushions referenced this topic on
                        • 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.