I recently decided to replace the SD card in my Raspberry Pi and reinstall the system. Without any special backups in place, I turned to rsync to duplicate /var/lib/docker
with all my containers, including Nextcloud.
Step #1: I mounted an external hard drive to /mnt/temp
.
Step #2: I used rsync to copy the data to /mnt/tmp
. See the difference?
Step #3: I reformatted the SD card.
Step #4: I realized my mistake.
Moral: no one is immune to their own stupidity 😂
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.
Rules:
Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.
No spam posting.
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.
Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
No trolling.
Resources:
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
The bells of the Gion monastery in India echo with the warning that all things are impermanent.
If you have one backup, you have no backup. That’s a hard lesson to learn, but if you care about those photos it’s possible to recover them if you haven’t written stuff on that sdcard yet.
Also, if you haven’t tried to restore from backup, you have no backup.
At least 3 backups, 2 different media, 1 offsite location.
I like 3-2-1-1-0 better. Like yours, but:
Testdisk and photorec, use them, they even saved my data from bricked Chinese usb flash drive, so it’ll save yours unless you wrote dd if /dev/zero of /*/microsd. Also here’s the tip, don’t attempt to rebuild partition firstly, first step try to copy all files from microsd to another device with these programs and after that try other ways, edit: I’ve seen from your other comments that your data already was overwritten, my condolences
New Lemmy Post: RIP my photos from 2017 and contacts from 2005 (https://lemmy.world/post/12219072)
Tagging: #SelfHosted
(Replying in the OP of this thread (NOT THIS BOT!) will appear as a comment in the lemmy discussion.)
I am a FOSS bot. Check my README: https://github.com/db0/lemmy-tagginator/blob/main/README.md
I’m just impressed an SD card in a Pi lasted since 2017 without losing all your data on its own.
For the future the general guideline is 3 copies of your data at minimum, so definitely set up some backups.
How do you actually do that?
Lots of backup software out there, I use a mix of Veeam Endpoint, Restic w/ Backblaze B2, and iDrive.
This is one of many reasons I set up a backup at my parents’ place. Was an extra $200 or so but my most valuable data is backed up there also.
I also have my favorite photos printed every year.
Sorry to read that.
I’ve
dd
ed an external drive instead of an SD card once by mistake. I’ve never felt more stupid than that day.Classic Disk Destroyer moment.
I know I’m going to get down voted for this but this would be almost impossible to fuck up with a gui. Yet people insist that writing commands manually is superior. I’m sorry for your loss.
Guardrails are absolutely not a reason why people prefer the CLI. We want the guardrails off so we can go faster.
This is on me for sure that I’ve never seen anyone be faster using a CLI compared to a GUI especially for basic operations which is what most of us do 95% of the time. I know there are specific cases where a command just does it better/easier but for me that’s not the case for everyday stuff.
But what about the movies where the actors are typing commands and a visual GUI is moving around and updating on the screen (and making sound effects too).
Isn’t that the best of all worlds? /s
Fair enough.
CLI is not about ease to begin with, it is about versatility.
To play devil’s advocate, tab completion would have also likely caught this. OP could have typed /mnt/t<Tab> and it would autofill temp, or <Tab><Tab> would show the matching options if it’s ambiguous.
There is something to be said about CLI applications being risky by default (“rm” doesn’t prompt to ask,
rsync --delete
will do just that). But I’ve definitely slipped on the mouse button while “drag & dropping” files in a GUI before. And it can be a right mess if you move a bunch of individual files rather than a sub-folder…At least for windows, you can ctrl-z that away and it’ll handle your mouse fumble. Explorer also highlights the files after a copy so if that doesn’t work (and it was a copy action), just delete them immediately.
I haven’t used *nix for daily stuff in years but I’m sure the same abilities are there, surely.
If you haven’t done much writing to the SD card, you may be able to recover the data. Data isn’t really “deleted”, it is just labeled as deleted. There is software that can comb through the raw data and try to make sense of what files were there. I don’t know of any specific software, so if anyone knows, please reply
Edit: Another commenter mentioned some success with DMDE
Edit 2: Worth mentioning that this is true of formats. As long as it doesn’t zero out the entire media, it just edits the file system metadata to say there are no files.
PhotoRec and TestDisk are probably the best, but they don’t recover file structure.
Sorry to hear, I feel you:
I wanted to delete all .m3u-files in my music collection when I learned:
find ./ -name "*.m3u" -delete
-> this would have been the right way, all .m3u in the current folder would have been deleted.find ./ -delete -name "*.m3u
" -> WRONG, this just deletes the current folder and everything in it.Who would have known, that the position of -delete actually matters.
I can recommend fd to everyone frustrated with find, it has a much more intuitive interface imo, and it’s also significantly faster.
fd -tf -e m3u -x rm
loads all cores and nothing works fasterI didn’t know there was a -delete option to find! I’ve been piping to xargs -0 for decades!
Probably because it’s easier to fuck up. With piping to xargs, you are forced to put the delete command last.
deleted by creator
The first one would have deleted nothing as it needs to match the whole name. I recommend running find with an explicit -print before replacing it in place with -delete or -exec. It’s good to remember that find has a complex order dependent language with -or and -and, but not maybe the best idea to try to use those features.
Lemmy interpreted the
*
as something cursive. I try to edit it like I mean it.I use GNU find every day and still have to google about the details. Only learnt about - delete the other day, good to know the position matters.
I did this sort of mistakes too, luckily BTRFS snapshots are always here to save the day !
Fuck up #1: no backups
Fuck up #2: using SD cards for data storage. SD cards and USB drives are ephemeral storage devices, not to be relied on. Most of the time they use file systems like FAT32 which are far less safe than NTFS or ext4. Use reliable storage media, like hard drives.
Fuck up #3: no backups.
Would an SSD be any better than a pen drive or should it be stored on spinning rust?
Much better. SSDs and HDDs do monitor the health of the drives (and you can see many parameters through SMART), while pen drives and SD cards don’t.
Of course, they have their limits which is why raid exists. File systems like ZFS are built on the premise that drives are unreliable. It’s up to you if you want that redundancy. The most important thing to not lose data is to have backups. Ideally at least 3 copies, 1 off site (e.g. on a cloud, or on a disk at some place other than your home).
RAID is not a backup.
Though not every fail state is going to show up. If you start seeing weird intermittent behaviour from a drive, for goodness sake find a way to back it up immediately.
My mum’s new nuc started having some issues, SMART showed perfect drive health. After trying a few things to diagnose, I rebooted to run memtest and check for bad ram, and that was the last time it ever booted into windows. Controller or something on the nvme ssd died. Far too expensive to try and repair for data recovery. Thankfully had a… Somewhat recent backup. Not as recent as we would have liked.
The best way to ensure your data lasts a long time is to use a laser to beam it to the darkest part of the sky. Read speed is abysmal though
SD cards and pen drives are (usally) made from lower quality, cheaper nand (the little memory chips that store the data) and also lack health monitoring, that being said ssds can and do die so it’s important to have backups
In my experience, flash drives are way more reliable than SD cards and I’d put SSD and HDD above both of those.
I wish they’d just ditch the SD card on the Pi already as it’s always the most likely reason why your stuff stops working. For my Pi running Home Assistant, I’ve swapped to an SDD as the boot drive. For the others, I still use SD cards but they’re just doing basic stuff like running Klipper on my 3d printer or a (WIP) live photo frame that can be easily swapped with a replacement SD later.
It really depends how you define reliability. SD cards are physically nigh indestructible, but can show failure when overwritten often. Hence for one off backups it’s actually a good alternative. It will start showing problems when used as a medium that often writes and overwrites the same data often.
I would recommend backups on SD cards in an A/B fashion when you want to give a backup to someone else to store safely.
Reliability in that I’ve used flash drives and SD cards for years but have only ever had issues with corrupt SD cards (probably at least half a dozen times) while I’ve never had any with flash drives.
Constant writes is an issue with them, which is why I think it’s stupid that the Raspberry Pi Foundation continues to use them as the default storage/OS drive. Then again, they continue to make insane choices with power supplies as well, so it shouldn’t be a big surprise.
I really wish they’d just give us an m.2 slot on the back
Oh man, even reading that hurt ':D I’m sorry for your loss.
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:
3 acronyms in this thread; the most compressed thread commented on today has 7 acronyms.
[Thread #537 for this sub, first seen 23rd Feb 2024, 01:55] [FAQ] [Full list] [Contact] [Source code]
There’s an old saying, “Unix is user friendly, it’s just fussy about it’s friends.”
Unix is the kind of friend who won’t bat an eye about holding your beer while you go and do something incredibly stupid
Everyone else is gonna be like “if you don’t have at least 3 backups of something blahblah” but you know, not everyone has the finances for that, so advice from a cheapskate computer nerd: when going through critical transfers/reformats/deletions like you were doing, ALWAYS try actually recovering stuff from the backup before you cross the point of no return. E.g. if the backup is a .zip, extract a few individual files from it and open them in their respective programs.