How to backup SD card
How to backup SD card
To backup my sd card, is just simply copy all folders and files to my computer? Or do I need to clone it - let’s say I want to put the same content on another card?
Thanks!
-
- Posts: 180
- Joined: Sun May 24, 2020 9:13 pm
- Has thanked: 186 times
- Been thanked: 34 times
Re: How to backup SD card
If you wanted to clone the SD card, I believe Balena's Etcher can now make full disk images of SD cards. You'd probably only want to do this to the same size SD card though as I'm unsure if partition resizing tools are on the Linux install.
Otherwise, you could copy the contents of the filesystem somewhere else, but you would have to flash the MiSTer system to your fresh SD card before copying the files back - there are a few partitions that will be hidden from you.
I think that should cover you. I'd personally go for the second option as I'm likely to go for a larger SD card in the future (for example, if/when PSX hits the scene)
Re: How to backup SD card
If you're running Linux on your PC you can use Rsync, that's how I've started to do mine as it'll only update changes and it just goes straight to my NAS. Set up a cronjob and as long as the MiSTer is on then you won't even need to think about backups.
Not overly necessary I guess with MiSTer if you don't change too much from one day to the next, but it's another option.
-
- Posts: 79
- Joined: Thu Feb 25, 2021 10:19 pm
- Has thanked: 65 times
- Been thanked: 19 times
Re: How to backup SD card
This is a great idea! Since MISTer runs Linux, is this something that could be configured directly on it, instead of proxying the task to a desktop Linux (which I don't have)?
Re: How to backup SD card
And I never tried to see if that worked.
Re: How to backup SD card
I said in my previous post that it be could set as a cronjob, which is the Linux utility that automates commands at specified dates and times. However I was getting a little ahead of myself there as whilst I've sorted the commands for Rsync that I needed for both the SD card and USB storage I haven't actually looked to see if Cron is even in MiSTer Linux, as dark said Sorg strips out a lot of stuff to keep Linux as light as possible.zorrobandito wrote: ↑Sun Sep 05, 2021 11:19 pmThis is a great idea! Since MISTer runs Linux, is this something that could be configured directly on it, instead of proxying the task to a desktop Linux (which I don't have)?
If not then it'd have to be ran when wanted, you can do that from Windows using a program like Putty.
I'll report back when I get a chance to test.
- INT806
- Posts: 9
- Joined: Sat Oct 29, 2022 4:46 pm
- Location: Munich, Germany
- Has thanked: 7 times
- Been thanked: 12 times
Re: How to backup SD card
A friend was kind enough to burn a copy of his entire "MISTer_Data" micro SD card (his card is only 512GB) on my 1000GB (1TB) Micro SD card. He did not install a fresh MISTer system on my card first (with Mr. Fusion), so now only his 512GB partition is on my 1000GB card (and 512GB are currently unused/wasted). I would of course like to have the whole 1000GB so my question is: is it enough if I copy all the files from this card to my HDD, then use Mr. Fusion to create a whole new MISTer system on it (this time with 1TB) and then simply copy all the files form my HDD back on the micro SD card? I think in theory, this should work, right? Or am I missing something important here? Would I 'miss' some files or hidden partitions?
- Waifu4Life
- Posts: 271
- Joined: Fri Jun 19, 2020 5:30 am
- Has thanked: 21 times
- Been thanked: 47 times
Re: How to backup SD card
Personally, I backup everything but the Linux folder, I'll just let MiSTer Fusion remake it.
- pgimeno
- Top Contributor
- Posts: 709
- Joined: Thu Jun 11, 2020 9:44 am
- Has thanked: 277 times
- Been thanked: 226 times
Re: How to backup SD card
INT806 wrote: ↑Fri Sep 20, 2024 7:20 amA friend was kind enough to burn a copy of his entire "MISTer_Data" micro SD card (his card is only 512GB) on my 1000GB (1TB) Micro SD card. He did not install a fresh MISTer system on my card first (with Mr. Fusion), so now only his 512GB partition is on my 1000GB card (and 512GB are currently unused/wasted). I would of course like to have the whole 1000GB so my question is: is it enough if I copy all the files from this card to my HDD, then use Mr. Fusion to create a whole new MISTer system on it (this time with 1TB) and then simply copy all the files form my HDD back on the micro SD card? I think in theory, this should work, right? Or am I missing something important here? Would I 'miss' some files or hidden partitions?
You'll miss symbolic links, if you have any (unless you're backing up the files using Linux and your destination filesystem supports symbolic links).
You can check which symbolic links you have by running this command on the MiSTer's Linux (other linux systems won't recognize the symbolic links in the MiSTer's exFAT, as that's a hack made for MiSTer's linux only):
Code: Select all
find /media/fat/ -print0 | xargs -0 ls -ld | grep ^l
The shorter find /media/fat/ -type l -ls
doesn't work for some reason, probably related to the fact that symbolic links in exFAT are a hack.
- pgimeno
- Top Contributor
- Posts: 709
- Joined: Thu Jun 11, 2020 9:44 am
- Has thanked: 277 times
- Been thanked: 226 times
Re: How to backup SD card
No, you'll have to do it manually. List them with the above, saving the result to a file. You can do that with this:
find /media/fat/ -xdev -print0 | xargs -0 ls -ld | grep ^l > symlinks.txt
(I forgot the -xdev
in the previous post, though I don't think it would be an issue to omit it in this case). Copy the symlinks.txt file to your computer. Then after restoring the files, for each file in the list which was a symlink (which will be converted to a regular file containing just the link destination path), do this in the MiSTer's Linux command line:
Code: Select all
ln -sf <link value> <link name>
For example, if you have this:
lrwxr-xr-x 1 root root 39 Apr 18 2022 /media/fat/linux/timezone -> /usr/share/zoneinfo/posix/Europe/Madrid
then do:
Code: Select all
ln -sf /usr/share/zoneinfo/posix/Europe/Madrid /media/fat/linux/timezone
Note the arguments swapped with respect to what ls
lists.
It's not likely you will have many of these, or maybe any at all.
- dickhardpill
- Posts: 285
- Joined: Tue Apr 09, 2024 9:28 pm
- Location: Not Portland, OR
- Has thanked: 73 times
- Been thanked: 59 times
- Contact:
Re: How to backup SD card
Windows Subsystem for Linux (WSL) is probably my favorite Windows feature. Highly recommended. Great way for someone to dip their toes if they don’t have experience with or an extra PC to install Linux.
I has a you tube
Analog IO
USB board
VGA > Component
HDMI > FPM
- pgimeno
- Top Contributor
- Posts: 709
- Joined: Thu Jun 11, 2020 9:44 am
- Has thanked: 277 times
- Been thanked: 226 times
Re: How to backup SD card
dickhardpill wrote: ↑Sat Sep 21, 2024 10:47 amWindows Subsystem for Linux (WSL) is probably my favorite Windows feature. Highly recommended. Great way for someone to dip their toes if they don’t have experience with or an extra PC to install Linux.
This option is not for the faint of heart, though. The symlinks in the SD card won't be visible in systems other than MiSTer, because it has a custom exFAT driver that adds explicit support for symlinks (added by Sorgelig). So, plugging the SD card into your PC and using Linux is not enough per se to copy the symlinks. The only option I can think of that allows it to work, is to use sshfs to remotely mount MiSTer's filesystem, and do the backup to another Linux system that way, which will include symlinks.
Identifying the symlinks (which there will probably be few) and rebuilding them after the restoring is probably simpler for users that are not Linux regulars.
As for how many there are, YMMV but probably very few if any. My case is this: I have a mix of partitions, with a very short exFAT partition able to hold the bare minimum (linux, the MiSTer main executable, the menu core and little else), and then everything else symlinks to the other partition, which is formatted in ext4. So I have all the main folders (_Arcade, _Computer, games, settings, etc) as symlinks to the ext4 partition. I also have a few soundfonts pointing to their right place in the ext4 partition. Besides that, the only other symlinks I have in the exFAT partition are the timezone (which I used as an example in the previous post) and the menu's background image, and that's all.