Well I’ve joined the “accidentally trashing your system with rm -rf” club! Luckily I didn’t delete my home directory with all the things I care about, but I did delete /boot and /usr, and maybe /var (long story, boils down to me trying to delete non-system directories named those but reflexively adding the slash in front when I should not have). I have backups of those as well, so what are my prospects of recovering from this by just copying them back in using a live USB? Only issue is they’re stored in my server as belonging to the server user (I assume everything in those directories should belong to root and I can just use chown?) But I also don’t know if they retain the same permissions when backed up.

Has anyone had any luck recovering a system in this way? I’m hoping not to have to reinstall everything because I had gotten pretty cozy with the current installation.

  • bizdelnick@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    11 months ago

    No way, reinstall.

    If even file owner is not preserved (it is not always root, espetially in /var), you likely lost files’ extanded attributes an, maybe, also permissions. Without them your system won’t work normally.

    Then, contents of these directories must be consistent with other ones. E. g. /var contains a package manager data about packages you installed. If you installed/removed anything after creating a backup, information about this will be lost.

    If you created the backup while system was working, some files (espetially under /var, again) could be changed during that process, and this also makes such backup unusable. Every sysadmin knows that to create a database backup by copying files, dbms must be stopped.

    In future, think about restoration before planning a backup and test if this possible immediately after it is done.