RIP my photos from 2017 and contacts from 2005

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 😂

turkalino ,
@turkalino@lemmy.yachts avatar

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.

outcide ,
@outcide@lemmy.world avatar

There's an old saying, "Unix is user friendly, it's just fussy about it's friends."

lando55 ,

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

bartolomeo ,
@bartolomeo@suppo.fi avatar

Oh man, even reading that hurt ':D I'm sorry for your loss.

shadowbert ,
@shadowbert@kbin.social avatar

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

blackbirdbiryani ,

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 ,
@shadowbert@kbin.social avatar

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.

glasgitarrewelt , (edited )

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.

iknowitwheniseeit ,

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

derpgon ,

Probably because it's easier to fuck up. With piping to xargs, you are forced to put the delete command last.

blackbirdbiryani ,

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.

zygo_histo_morpheus ,

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

synapse1278 ,
@synapse1278@lemmy.world avatar

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

nabladabla ,

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.

glasgitarrewelt ,

Lemmy interpreted the * as something cursive. I try to edit it like I mean it.

evrial ,

fd -tf -e m3u -x rm
loads all cores and nothing works faster

Decronym Bot , (edited )

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 for this sub, first seen 23rd Feb 2024, 01:55]
[FAQ] [Full list] [Contact] [Source code]

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • selfhosted@lemmy.world
  • test
  • worldmews
  • mews
  • All magazines