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

    Backup SD Card by copying out files?

    Scheduled Pinned Locked Moved Help and Support
    sd card failurebackupimage
    87 Posts 10 Posters 34.3k 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.
    • herb_fargusH
      herb_fargus administrators @TMNTturtlguy
      last edited by herb_fargus

      @TMNTturtlguy as long as you have direct access to the file system.

      Though I'm only thinking of files I think you'd still have to make the sd bootable perhaps so I am not sure. I have tried to be honest

      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

      TMNTturtlguyT I 2 Replies Last reply Reply Quote 0
      • TMNTturtlguyT
        TMNTturtlguy @herb_fargus
        last edited by

        @herb_fargus i might give it a go...i am thinking that i install the my base image and make it bootable. Once it is up and running, i go into the file structure and replace files that have been modified, like the retroarch, emulationstation, and other config folders and files for the roms and controller settings.

        1 Reply Last reply Reply Quote 0
        • mediamogulM
          mediamogul Global Moderator @TMNTturtlguy
          last edited by mediamogul

          @TMNTturtlguy

          Has anyone tried to backup all of their files by simply copying all of the folders off of the SD card onto their hard drive and then installing a fresh image of retropie and copying all of the files back onto the new installation?

          I've done this several times now without any issue. I wrote a script that runs every night and makes a backup of the necessary files to a thumbdrive and only keeps the two most recent backups. I prefer to do it this way for space reasons, as well as knowing that I can more easily move up to a new Raspbian whenever the time comes.

          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

          TMNTturtlguyT S 2 Replies Last reply Reply Quote 1
          • TMNTturtlguyT
            TMNTturtlguy @mediamogul
            last edited by

            @mediamogul Sweet! I thought it might work. Do you by chance have a list of files/folders that you backup that you could send my way?

            mediamogulM 1 Reply Last reply Reply Quote 0
            • mediamogulM
              mediamogul Global Moderator @TMNTturtlguy
              last edited by mediamogul

              @TMNTturtlguy

              Sure. For me, those files and folders include:

              /boot/config.txt
              /etc/fstab
              /etc/udev/rules.d
              /etc/rc.local
              /etc/samba/smb.conf
              /opt/retropie/configs
              /home/pi/.config
              /home/pi/.local
              /home/pi/.openMSX
              /home/pi/.q3a

              Edit: My /home/pi/Retropie folder is already external, so it's not included.

              RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

              1 Reply Last reply Reply Quote 1
              • S
                steptoe @mediamogul
                last edited by

                @mediamogul said in Backup SD Card by copying out files?:

                @TMNTturtlguy

                Has anyone tried to backup all of their files by simply copying all of the folders off of the SD card onto their hard drive and then installing a fresh image of retropie and copying all of the files back onto the new installation?

                I've done this several times now without any issue. I wrote a script that runs every night and makes a backup of the necessary files to a thumbdrive and only keeps the two most recent backups. I prefer to do it this way for space reasons, as well as knowing that I can more easily move up to a new Raspbian whenever the time comes.

                Could you post your script, this would help a lot of people who don't want to lose all the effort they put it to get RetroPie running how they want it to in case of SD Card corruption or otherwise and add backup support

                Thanks

                mediamogulM 1 Reply Last reply Reply Quote 0
                • mediamogulM
                  mediamogul Global Moderator @steptoe
                  last edited by

                  @steptoe said in Backup SD Card by copying out files?:

                  Could you post your script

                  Can do:

                  #!/bin/sh
                  ##Change the numeral in "head -n -*" to however many backups are to be kept.
                  
                  foldername=$(date +%Y%m%d%H%M%S) && \
                  mkdir -p /media/usb0/Backups/RetroPie/"$foldername" && \
                  sudo cp -rfv \
                  	/boot/config.txt \
                  	/etc/fstab \
                  	/etc/udev/rules.d \
                  	/etc/rc.local \
                  	/etc/samba/smb.conf \
                  	/opt/retropie/configs \
                  	/home/pi/.config \
                  	/home/pi/.local \
                  	/home/pi/.openMSX \
                  	/home/pi/.q3a \
                  	/media/usb0/Backups/RetroPie/"$foldername"/
                  cd /media/usb0/Backups/RetroPie/ && \
                  ls -1tr | head -n -2 | xargs -d '\n' rm -rfv --
                  clear
                  
                  

                  RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                  TMNTturtlguyT 1 Reply Last reply Reply Quote 3
                  • TMNTturtlguyT
                    TMNTturtlguy @mediamogul
                    last edited by

                    @mediamogul this is great! Is this script just a one time copy that I can run every time I want to make a copy? Also, is is possible to change the location form the USB to a location over the network? Or do I need to make the copy to a USB? Thanks for this! It will be very useful!

                    mediamogulM 1 Reply Last reply Reply Quote 0
                    • mediamogulM
                      mediamogul Global Moderator @TMNTturtlguy
                      last edited by mediamogul

                      @TMNTturtlguy

                      is this script just a one time copy that I can run every time I want to make a copy?

                      I run it in two different ways. First, the actual script resides in /home/pi/RetroPie/retropiemenu. That way, I can navigate to the RetroPie menu in Emulation Station and launch it manually whenever I want. Secondly, I have it set as a scheduled Cron task that launches every morning at 4:00am automatically.

                      Also, is is possible to change the location form the USB to a location over the network?

                      Sure. If you have any network shares mounted at boot, you can just point the script in their direction.

                      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                      TMNTturtlguyT 1 Reply Last reply Reply Quote 0
                      • TMNTturtlguyT
                        TMNTturtlguy @mediamogul
                        last edited by

                        @mediamogul probably a dumb question but I am on my phone so I can't test the script right now, but in the last line above clear in you script post the 'n' shows up in green like the "filename" which is Kent to be user modified. Is the 'n' supposed to be modified or is that green just because the forum post sees the ' on either side.

                        Thanks, this is really cool!

                        mediamogulM 1 Reply Last reply Reply Quote 0
                        • mediamogulM
                          mediamogul Global Moderator @TMNTturtlguy
                          last edited by

                          @TMNTturtlguy

                          or is that green just because the forum post sees the ' on either side.

                          It's just the forum post.

                          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                          1 Reply Last reply Reply Quote 0
                          • edmaul69E
                            edmaul69
                            last edited by

                            I personally backup the entire /opt/retropie/ folder. So if i get an emulator that no longer works, i can put the old one on. Example: the new lr-mame2010 no longer works at all. So i have to put the old one on.

                            mediamogulM 1 Reply Last reply Reply Quote 0
                            • mediamogulM
                              mediamogul Global Moderator @edmaul69
                              last edited by

                              @edmaul69

                              Very wise. I've thought about doing the same.

                              RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                              edmaul69E 1 Reply Last reply Reply Quote 0
                              • edmaul69E
                                edmaul69 @mediamogul
                                last edited by

                                @mediamogul i actually backup files as i add/change stuff. Then i do a backup of all my selected files and folders everytime i do a retropie update. I have about 10-15 major backups.

                                mediamogulM 1 Reply Last reply Reply Quote 0
                                • mediamogulM
                                  mediamogul Global Moderator @edmaul69
                                  last edited by

                                  @edmaul69

                                  Wow. If luck favors the prepared, I should be asking you for lottery numbers.

                                  RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                                  edmaul69E 1 Reply Last reply Reply Quote 0
                                  • edmaul69E
                                    edmaul69 @mediamogul
                                    last edited by

                                    @mediamogul I just deleted my 2.6 backup a couple months ago. Still have all my updates after that

                                    1 Reply Last reply Reply Quote 0
                                    • pjftP
                                      pjft
                                      last edited by

                                      For backing up without doing a full image backup, I'd recommend looking up the rpi-clone script, provided you can plug the destination card via USB to your Pi.

                                      TMNTturtlguyT 1 Reply Last reply Reply Quote 1
                                      • TMNTturtlguyT
                                        TMNTturtlguy @pjft
                                        last edited by

                                        @pjft Thanks for the info, i looked into that but it looks like i would have to have another 128gb SD card to make that work. I have a good base image for my system already saved on my computer, so my thought is that I can just copy off the folders with updates like @mediamogul has provided and then dump those back into the build once I reinstall my base image on the SD Card.

                                        @mediamogul, i am a little green when it comes to installing scripts, i was just going to run it from putty, but i like the idea of having the script right on the retropie menu. Forgive me for this beginner question, but do i just save the script code you posted in a .xml and then save that file to /home/pi/RetroPie/retropiemenu? That seems to easy.......Thanks

                                        mediamogulM pjftP 2 Replies Last reply Reply Quote 0
                                        • mediamogulM
                                          mediamogul Global Moderator @TMNTturtlguy
                                          last edited by mediamogul

                                          @TMNTturtlguy

                                          but do i just save the script code you posted in a .xml and then save that file to /home/pi/RetroPie/retropiemenu? That seems to easy.......Thanks

                                          It's just about that easy. Save it with the extension .sh and then run:

                                          chmod +x /home/pi/RetroPie/retropiemenu/name-of-script.sh
                                          

                                          After that it should be good to go.

                                          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                                          TMNTturtlguyT 1 Reply Last reply Reply Quote 1
                                          • TMNTturtlguyT
                                            TMNTturtlguy @mediamogul
                                            last edited by

                                            @mediamogul Awesome, you are the best and made my day!

                                            1 Reply Last reply Reply Quote 1
                                            • 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.