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

    Guide to move your home directory to a USB stick.

    Scheduled Pinned Locked Moved Help and Support
    homeusb-stickfstab
    2 Posts 1 Posters 2.1k 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.
    • S
      surfrock66
      last edited by surfrock66

      I have a Pi1B and have built an arcade...I see myself upgrading to a pi3 in the near future. Because of that, I'd like to keep as much configuration on the 128GB USB drive I'm using (and off the 4GB SD card).

      I hope to move /home or /home/pi to the usb key, but I haven't seen any guides on how to do that with retropie. I see many guides for moving roms to a USB key, but not the whole home directory.

      I'm a unix sysadmin, shouldn't be an issue right? My plan was to move the contents of /home/pi to /media/usb0 (the location of my drive), then create a fstab entry to mount the usb key at /home/pi.

      Moving the files isn't going so great; there's a bunch that straight up won't move. So, don't use 'mv', here's what I did to make it work:

      rsync -av --remove-source-files /home/pi/ /media/usb0/
      

      You'll get some errors in the output pointing to some broken symlinks, this is your trigger to fix it later:

      sending incremental file list
      rsync: symlink "/media/usb0/.emulationstation" -> "/opt/retropie/configs/all/emulationstation" failed: Operation not     permitted (1)
      rsync: symlink "/media/usb0/RetroPie/roms/genesis" -> "megadrive" failed: Operation not permitted (1)
      ....
      rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
      

      So, to fix that:

      ln -s /opt/retropie/configs/all/emulationstation/ /media/usb0/.emulationstation
      ln -s /media/usb0/RetroPie/roms/megadrive /media/usb0/RetroPie/roms/genesis
      

      If you're like me, those will fail, saying "Operation Not Permitted" even if you're root. This is because my usb stick is vfat, and symlinks aren't supported. More on this later.

      The rsync will leave some stuff, so at the end you may need to run:

      rm -Rf /home/pi/*
      

      But that's a pretty dangerous command, so do so at your own discretion.

      So, now we prepare to mount the USB key over /home/pi. Run:

      sudo blkid
      

      To get the UUID of your drive, the actual device address (/dev/sda1 for me) and the TYPE. My Type is vfat. If it's ntfs or exfat, consider this:

      sudo apt-get update; sudo apt-get install exfat-utils ntfs-3g -y
      

      First, test your mount by unmounting the usb driver and then re-mounting it with this:

      sudo umount /media/usb0
      sudo mount -o uid=pi,gid=pi /dev/sda1 /home/pi
      

      If this works, you're good to go creating the fstab rule.

      vi /etc/fstab
      

      And add this line (with your own UUID):

      UUID=2965-5D60	/home/pi	vfat	nofail,uid=pi,gid=pi	0	0
      

      Reboot to test it. If you run the following and see the mount, then run the 2nd one and see your files, you should be good:

      mount | grep "/home/pi"
      ls -as1l /home/pi
      

      Ok. All is well for me. There's still the issue of the 2 symlinks. When it comes back up, /home/pi/.emulationstation will be automatically created. Now...if you've already set up emulation station, rather than symlink, you can just copy the content:

      cp -R /opt/retropie/configs/all/emulationstation/* /home/pi/.emulationstation/
      

      If you HAVEN'T set it up already, just set it up now. It'll go where it needs to go. For the other symlink, if you're not on vfat or exfat:

      cd /home/pi/RetroPie/roms/
      ln -s megadrive genesis
      

      If you are using a filesystem type that won't work, just remember that you have to use megadrive over genesis, or do this:

      mv /home/pi/RetroPie/roms/megadrive /home/pi/RetroPie/roms/genesis
      

      And that should do it!

      1 Reply Last reply Reply Quote 2
      • S
        surfrock66
        last edited by

        I should mention...I did that for about 10 seconds before realizing vfat sucks and committing the drive to ext4. Same principle though.

        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.