this post was submitted on 05 Jul 2023
4 points (100.0% liked)

TIFU

7958 readers
1 users here now

Welcome to TIFU.

This community will stand as a tribute to the fuck up in all of us. We all do something stupid from time to time, this is your place to share and laugh about it with folks on the internet!

Da Rules:

  1. Use proper formatting

A. All titles must start with TIFU.

B. All posts must have a TL;DR at the end. Some of us are too lazy to read your story, sorry.

C. Use the NFSW Tag, if a Post isn't Appropriate in General but still follows the rules. (Sex stories and etc.)

  1. Posts must be about you.

  2. Must be your fault.

  3. A few things that aren't allowed.

A. No Rape​/​minors/​bestiality. No death of animals. No glorification of major crimes.

B. Illegal activities that you glorify or giving advice on how to do something illegal.

  1. Must be actual fuckups No humblebrags or stories that have zero consequences and don't go anywhere. Eg "TIFU by sexy sex". Moderator discretion.

  2. Be civil and don't be disruptive No racism/​bigotry/​homophobia/​transphobia. No personal attacks on other users, no name-calling. No low-effort "this didn't happen" type comments.

  3. No Self Promotion No making posts with the express purpose of promoting your business/video game/porn career. Even if not mentioned within the text of the post, alluding to links on your profile is not allowed. This covers implying you will set up a stream/public link/onlyfans in the future, having set up one in the past, or anything along the lines of "upvote this comment if you want me to do this." These examples are by no means comprehensive, just don't self promote.

  4. Mod Discretion Mods have the right to supersede any rule and make removals as we see fit, which may or may not be the rules listed in this community.

founded 2 years ago
MODERATORS
 

I am running a NextCloud instance on a Raspberry Pi in my parents' place, in order to backup my data. My dad ended up liking this solution and moved his data there too. It is running the OS in an SD card, but has an external HDD for the NextCloud data itself.

My problems started when I started getting strange errors from NextCloud. I investigated a bit and found that the root filesystem was corrupt. I saw the writing on the wall, turned it off before things got worse, bought a new SD card, and went over to recover it. Sure enough, the previous SD card had decided to suddenly pass on to the electronic afterlife. Ironically enough, this was the only partition for which I had no backups. Our personal data is, in addition to NextCloud, periodically manually rsync-ed into an external hard drive. I am in addition running another server, which has a proper backup solution in place.

After re-imaging the new card from the old one, running fsck, and restoring a few things that were still corrupted, I got NextCloud to run. At least our data was safe at the time, because it was in a different drive. I took the opportunity and synced my other machine, my dad also took the opportunity and rsync-ed his secondary hard drive, and I went back home and initially thought about calling it a day. However, I thought it would be easy enough to run a script that would take a weekly backup into the external HDD, and if both fail, well, I can then spend a day to set it up from scratch, given that our data itself is safe. Being who I am, I started implementing it at almost midnight.

I set it up to create a new directory with the current date every time, and I added this command in the end, to delete files that hadn't been accessed in over 22 days:

find $BACKUP_DIR -atime +22 -delete

I ran the script - Why is it late to finish, it created the files - oh oops 😱 - to my horror I realised that I had set $BACKUP_DIR to be the root directory of the external hard drive instead of the backup subdirectory! I initially thought I was safe, because I had run a file scan on NextCloud, plus my dad had rsynced his data, everything should count as accessed today. My data was fortunately safe, but I compared my father's data against his secondary HDD and realised that there was, in fact, data loss. Surprisingly, neither the rsync nor NextCloud's scan had counted as accessing the files.

But, fortunately there's the secondary hard drive, right?... Well, it wasn't so simple. First, the drive is NTFS, where you can't manually set a file's created/modified timestamp. As a result, most files appeared newer in the secondary NTFS drive: instead of having the real timestamp of when they were created/modified, they had the timestamp of when they were rsync-ed. I did a few rsync dry runs, saw the issue, and fortunately it was easily solvable with the --ignore-existing flag.

Second, rsync was without --del, so any files my dad had deleted or moved would re-appear. I couldn't just bring them back and pretend nothing happened. Fortunately, he messaged me at 1AM for a different issue, so my eyes lit up and I replied "oh, thank God you're awake, can I upset you now?".

I sent him a diff of both directory listings, in case he could easily figure out what happened, but... he has a whole bunch of files. The diff was enormous and he felt overwhelmed. At this point, the most reasonable solution seemed to be for me to restore everything from the backup and let him re-delete the files. He gave me permission to go ahead with this, and at 3AM he could finally tell his laptop to start re-syncing all these files that now either had been undeleted or appeared to be newer.

There was an unexpected silver lining to the latter. There were some files that apparently he had accidentally deleted and he was wondering where they had gone. After we restored the backup, he found them back.

In the end, I removed the offending find and decided to just log in every month or two and delete any old backups.

TL;DR: --dry-run is your friend when rsync-ing. I accidentally deleted a big part of my father's personal files from his NextCloud account. Managed to recover them in the end, but it was quite a struggle.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here