diff options
author | Peter | 2022-05-10 11:23:40 +0100 |
---|---|---|
committer | Peter | 2022-05-10 11:23:40 +0100 |
commit | 3a3a7d9670e625a97df85a744d14bcd344e82923 (patch) | |
tree | 2ef0128aebde9411910308d30d80dc53913d0a2e /content/posts | |
parent | 8eadb0289cae0f3e4b22089cf81fcbd23d2da8bd (diff) | |
download | blog.minskio.co.uk-3a3a7d9670e625a97df85a744d14bcd344e82923.tar.gz blog.minskio.co.uk-3a3a7d9670e625a97df85a744d14bcd344e82923.tar.bz2 blog.minskio.co.uk-3a3a7d9670e625a97df85a744d14bcd344e82923.zip |
New and updated posts
Diffstat (limited to 'content/posts')
-rw-r--r-- | content/posts/ext4magic-data-recovery.md | 32 | ||||
-rw-r--r-- | content/posts/logging-duolingo-ranks-over-time.md | 6 | ||||
-rw-r--r-- | content/posts/recovering-deduplicated-git-repositories.md | 25 |
3 files changed, 61 insertions, 2 deletions
diff --git a/content/posts/ext4magic-data-recovery.md b/content/posts/ext4magic-data-recovery.md new file mode 100644 index 0000000..4817406 --- /dev/null +++ b/content/posts/ext4magic-data-recovery.md @@ -0,0 +1,32 @@ +--- +title: "ext4 deleted data recovery" +date: 2022-05-09T17:07:00 +tags: ["Linux", "Recovery", "Snippets", "Software"] +--- + +Two data recovery stories in as many weeks! Fortunately, the events that lead to these were actually split by well over a year. + +Inevitably, while using Linux you're going to end up making the human error of deleting a file you shouldn't delete. I was working in two near-identical file trees slowly merging them together. As you've guessed, I `rm -rf`'d a directory in the wrong tree. I immediately knew as soon as I hit enter so unmounted the drive and started researching recovery methods. + +As I was still working on the directories, inevitably I hadn't made a backup. + +I was lucky for a number of reasons: +* I still had access to a working live system +* the drive was mostly full +* it was just one directory +* I had an available drive to start dumping recovered files to immediately. +* the drive hadn't been written to since the deletion + + +After installing (but not using) photorec and testdisk I wanted to see if there was anything else that could work. I looked up `extundelete` which sounded perfect, but wouldn't compile on my system. + +In steps `ext4magic`. After looking at a long winded guide which included dumping your journal I had a flick through the documentation and settled on the following command: + +``` +umount /dev/sdb1 +sudo ext4magic /dev/sdb1 -m -d /mnt/rescue +``` + +What the above will attempt to do is search `/dev/sdb1` (recovering deleted file with the `-m` flag) and copy anything found to destination `/mnt/rescue`. + +I can't accurately guage how successful the process was but I certainly recovered files that had been deleted. diff --git a/content/posts/logging-duolingo-ranks-over-time.md b/content/posts/logging-duolingo-ranks-over-time.md index 38ba286..8bd7018 100644 --- a/content/posts/logging-duolingo-ranks-over-time.md +++ b/content/posts/logging-duolingo-ranks-over-time.md @@ -2,14 +2,14 @@ title: Logging Duolingo ranks over time layout: single date: 2022-05-03T14:58:00 -lastmod: 2022-05-04T14:43:00 +lastmod: 2022-05-10T10:05:00 --- I was curious as to how my rank would change over time and what the rate of attrition would look like over time. This page was originally an attempt to mix markdown and bash scripting into a single executable page that updates itself when run that was itself documentation of how it worked, however the header that Hugo (which is what this site is built with) requires entirely breaks the markdown/bash quirk that allowed it to work with plain markdown. -In the background, the data source I'm scraping is [duome.eu](https://duome.eu/) and dumps values directly to this page using `func_duorank` as part of `server.sh` in [my Dockerfiles project](https://github.com/breadcat/Dockerfiles). +In the background, the data source I'm scraping is [duome.eu](https://duome.eu/) and dumps values directly to this page using `blog_duolingo_rank` as part of `server.sh` in [my Dockerfiles project](https://github.com/breadcat/Dockerfiles). Currently this script is manually run whenever I'm curious. Perhaps as time goes on, I'll automate this and eventually graph out these values (similarly to my [weight tracking](/weight/) page), but that's a project for later. @@ -25,3 +25,5 @@ Currently this script is manually run whenever I'm curious. Perhaps as time goes | 2022-04-24 | 23:06 | 2962 | 3336 | | 2022-05-03 | 15:17 | 2909 | 3316 | | 2022-05-04 | 14:43 | 2910 | 3316 | +| 2022-05-07 | 23:12 | 2909 | 3252 | +| 2022-05-10 | 10:05 | 3271 | 3271 | diff --git a/content/posts/recovering-deduplicated-git-repositories.md b/content/posts/recovering-deduplicated-git-repositories.md new file mode 100644 index 0000000..e67f46a --- /dev/null +++ b/content/posts/recovering-deduplicated-git-repositories.md @@ -0,0 +1,25 @@ +--- +title: "Recoving de-duplicated git repositories" +date: 2022-05-05T15:37:00 +tags: ["Linux", "Recovery", "Snippets", "Software"] +--- + +I have a number of software projects in a single directory, using `git` for version control which is shared across most of my computers using `syncthing`. + +Late one night, I wanted to de-duplicate a folder full of files I'd been working on over the course of a few weeks. I'd work through a directory then as part of my 'completing' the work, would de-duplicate it using `jdupes` to ensure no files were duplicated. I'm sure you can see where this is going. + +As part of my workflow, I was navigating directories, tapping the up arrow to repeat my last command and hitting enter with reckless abandon. I noted the command took a little longer than usual and immediately realised what I'd done. I went to assess the damage, when browsing using git, cgit, or even the github desktop client, all my repositories were broken except for a single bare repository. + +The first thing to do is to find any potentially affected directories. This can simply be done via `find . -type d -name '.git'`. As what was deleted will only ever be duplicated content, you should be able to rebuild these repositories quite easily with the following: + +``` +cd affected-project +mv ".git" ".gitcontents" +git init +rsync --remove-source-files -av ".gitcontents" ".git" +find ".gitcontents" -empty -delete +``` + +Which should get you up and working again. + +The moral of the story is to keep a backup, and then make a backup of your backup (just in case).
\ No newline at end of file |