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 😂

  • @[email protected]
    link
    fedilink
    English
    11
    edit-2
    1 year ago

    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.

    • @[email protected]
      link
      fedilink
      English
      21 year ago

      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.

    • @[email protected]
      link
      fedilink
      English
      61 year ago

      I didn’t know there was a -delete option to find! I’ve been piping to xargs -0 for decades!

    • @[email protected]
      link
      fedilink
      English
      21 year ago

      I can recommend fd to everyone frustrated with find, it has a much more intuitive interface imo, and it’s also significantly faster.

    • @[email protected]
      link
      fedilink
      English
      21 year ago

      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.

    • Synapse
      link
      fedilink
      English
      51 year ago

      I did this sort of mistakes too, luckily BTRFS snapshots are always here to save the day !

  • @[email protected]B
    link
    fedilink
    English
    3
    edit-2
    1 year ago

    Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

    Fewer Letters More Letters
    RAID Redundant Array of Independent Disks for mass storage
    SSD Solid State Drive mass storage
    ZFS Solaris/Linux filesystem focusing on data integrity

    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]

  • @[email protected]
    link
    fedilink
    English
    1
    edit-2
    1 year ago

    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.

  • @[email protected]
    link
    fedilink
    English
    51 year ago

    Sorry to read that.

    I’ve dded an external drive instead of an SD card once by mistake. I’ve never felt more stupid than that day.

  • @[email protected]
    link
    fedilink
    English
    45
    edit-2
    1 year ago

    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.

      • The Overlord
        link
        fedilink
        English
        21 year ago

        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

      • @[email protected]
        link
        fedilink
        English
        61 year ago

        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).

        • @[email protected]
          link
          fedilink
          English
          11 year ago

          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.

      • @[email protected]
        link
        fedilink
        English
        71 year ago

        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

      • @[email protected]
        link
        fedilink
        English
        9
        edit-2
        1 year ago

        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.

        • @[email protected]
          link
          fedilink
          English
          11 year ago

          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.

          • @[email protected]
            link
            fedilink
            English
            11 year ago

            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.

  • Possibly linux
    link
    fedilink
    English
    21 year ago

    You are probably out of luck. If you are lucky you can use gparted to recover deleted partitions

  • shadowbert
    link
    fedilink
    61 year ago

    My condolences :'(

    I once lost a bunch of data because I accidently left a / at the end of a path… rsync can be dangerous lol

    • @[email protected]
      link
      fedilink
      English
      21 year ago

      Rclone is superior IMHO, you have to explicitly name the output folder. Used to think it was a hassle but in hindsight being explicit about the destination reduces mistakes.

      • shadowbert
        link
        fedilink
        21 year ago

        Sometimes you’re hands are tied by the tools already on the server - but I’ll try to remember to check to see if that’s available next time.

  • @[email protected]
    link
    fedilink
    English
    23
    edit-2
    1 year ago

    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.

  • Outcide
    link
    fedilink
    English
    211 year ago

    There’s an old saying, “Unix is user friendly, it’s just fussy about it’s friends.”

    • @[email protected]
      link
      fedilink
      English
      71 year ago

      Unix is the kind of friend who won’t bat an eye about holding your beer while you go and do something incredibly stupid

  • Bobby Turkalino
    link
    fedilink
    English
    211 year ago

    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.

  • @[email protected]
    link
    fedilink
    English
    71 year ago

    Unlesa you did a full zeroing format the info might still be available. There was an applicarion that attempts to rebuild the partition / Filesystem from left over meta data or inode info. I forget the name unfortunately. Normall the strings command will get your photos but probably not if they were in a docker image database.

      • @[email protected]
        link
        fedilink
        English
        31 year ago

        Those are good for sure. And maybe it was testdisk. There was one that just undeleted the partition table delete. as long as new data had not been written everthing would be intact

  • @[email protected]
    link
    fedilink
    English
    291 year ago

    Unless you’ve used something secure for formatting or wrote data to the SD after, consider attempting data recovery.

    • @[email protected]OP
      link
      fedilink
      English
      111 year ago

      No luck with extundelete (segfault) and testdisk (sees some deleted files, but not /var/lib/docker). At least I can always throws it away and not worry about safety of my data! :)

      • @[email protected]
        link
        fedilink
        English
        161 year ago

        You can always try professional data recovery services. It just depends on how much the data is worth to you.

        • Atemu
          link
          fedilink
          English
          41 year ago

          And how much time you want to put into not getting scammed.

  • @[email protected]
    link
    fedilink
    English
    851 year ago

    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.

    • TWeaK
      link
      fedilink
      English
      371 year ago

      At least 3 backups, 2 different media, 1 offsite location.

      • @[email protected]
        link
        fedilink
        English
        8
        edit-2
        1 year ago

        I like 3-2-1-1-0 better. Like yours, but:

        • the additional 1 is for “offline” (so you have one offsite and offline backup copy).
        • 0 for zero errors. Backups must be tested and verified.