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 😂

  • Nibodhika@lemmy.world
    link
    fedilink
    English
    arrow-up
    45
    ·
    10 months 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@lemm.ee
      link
      fedilink
      English
      arrow-up
      20
      ·
      10 months ago

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

      • krash@lemmy.ml
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        10 months 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.
  • space@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    31
    arrow-down
    1
    ·
    edit-2
    10 months 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.

    • AtariDump@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      10 months ago

      Would an SSD be any better than a pen drive or should it be stored on spinning rust?

      • space@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        6
        ·
        10 months 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).

        • Starayo@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          10 months 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.

      • bbuez@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        arrow-down
        2
        ·
        10 months 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

  • ducking_donuts@lemm.ee
    link
    fedilink
    English
    arrow-up
    16
    ·
    10 months ago

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

    • summerof69@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      10 months 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! :)

  • xlash123@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    14
    ·
    edit-2
    10 months 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.

  • bruhduh@lemmy.world
    link
    fedilink
    English
    arrow-up
    14
    ·
    edit-2
    10 months ago

    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

  • Outcide@lemmy.world
    link
    fedilink
    English
    arrow-up
    13
    ·
    10 months ago

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

    • lando55@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      10 months 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

  • Geth@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    13
    arrow-down
    1
    ·
    10 months ago

    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.

    • jkrtn@lemmy.ml
      link
      fedilink
      English
      arrow-up
      3
      ·
      10 months ago

      Guardrails are absolutely not a reason why people prefer the CLI. We want the guardrails off so we can go faster.

      • Geth@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        4
        ·
        10 months ago

        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.

    • atzanteol@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      3
      ·
      10 months ago

      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…

      • Midnight Wolf@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        10 months ago

        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.

  • Bobby Turkalino
    link
    fedilink
    English
    arrow-up
    12
    ·
    10 months 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.

  • TORFdot0@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    10 months ago

    I think everyone has done this. I know I have. I believe I used dmda to recover all my photos back. Unfortunately I lost all the metadata for about 3000 photos. It took years to manually retap and redate them all but at least I didn’t lose them forever

    • d_ohlin@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      10 months ago

      This. I made a similarly boneheaded mistake a few months back and lost a fair amount of stuff. Thankfully 95+% of it was ancient program files and such that gave me a good excuse to go through and make some much needed cleanup actually happen for once.