And additionnaly, isn’t there a way to exploit this so we can store more stuff on PCs?

Edit: can’t thank you all individually but thanks to everyone, I learnt something today, appreciate all of your replies!

  • jet@hackertalks.com
    link
    fedilink
    English
    arrow-up
    181
    ·
    16 days ago

    Because you’re operating system is lying to you, for efficiency sake.

    Imagine an old school library, books on the shelves, and a Dewey decimal card catalog index in the center.

    You want to delete a book, to make room for future books, so you tell the librarian delete this book. And she removes the card from the card catalog index, and turns to you and says the book is gone!

    In this scenario the book is still on the shelf, but the index no longer points to it.

    Clearly the book isn’t gone, but from your perspective you don’t have to wait for the book to disappear, and the librarian knows eventually she’s going to clean the shelf, and remove whatever isn’t in the index.

    That’s more or less, with a lot of hand wave in, what operating systems do for file systems.

    • radix@lemmy.world
      link
      fedilink
      English
      arrow-up
      81
      ·
      16 days ago

      In this analogy, when you add a new book, only then is that “deleted” book actually removed and replaced with the new one. Until then, it just sits there waiting, but since nothing is pointing to it, it’s hard to find.

      When someone recovers a file, what they’re doing is going book by book and reconciling the index to see if there’s anything missing. Since this book still exists, it can be recovered.

      • MimicJar@lemmy.world
        link
        fedilink
        arrow-up
        18
        ·
        15 days ago

        To extend this a little further, computers also don’t actually store books, they store blocks.

        For example, you have a computer that can store 50 blocks of information. You store “Moby Dick”, taking up 20 blocks & “Tom Sawyer”, taking another 20 blocks.

        Next you decide you don’t like “Moby Dick”, so you delete it. You also decide you want to store an ice cream menu, taking up just 1 block.

        That menu will be stored based on where the computer thinks the block fits best. So you might have 20 blocks that still contain “Moby Dick”, or you might have only 19 blocks that contain most of “Moby Dick”, but it might be missing the beginning, middle or end.

        If I were doing data recovery I might not be able to provide you with the complete “Moby Dick” story. I might only be able to give you part of it.

        Looking into why blocks, let’s say you’re writing up the first draft of a book report, it might take up 4 blocks. Then later you edit, improve and add to that that book report, and now it takes 5 blocks. The computer took care of making space, even though your report got larger. It didn’t know if you were going to add 1 new block of information, or 1000 new blocks of information, it figured it out and did the rearranging for you.

        However when it comes time for you to look at it, it automatically knows how to put it together. (And usually it does group things together if it can).

        This is important to keep in mind when it comes to data recovery because the more you use your computer the more likely blocks are allocated and data gets moved around.

        If you delete important photos, then spend the weekend surfing the Internet, those photos might be gone. Or if they are available, might only be partially available.