I don’t fucking know why I can’t eject USB hard drives. I installed the SysInternals apps, and best they can tell me is that Dropbox is fucking with the drives. I explicitly told Dropbox to not fuck with USB drives. I don’t know who’s lying, I just want whoever is fucking with the drives to stop fucking with the drives, OK??? OK.

  • azertyfun@sh.itjust.works
    link
    fedilink
    arrow-up
    15
    ·
    20 hours ago

    Real answer: it depends.

    • Deleting a file in use: no problemo. File is removed from the directory immediately, but exists on disk until last program who had the file open closes. Everyone wins! (Unless you’re trying to free up space by deleting a huge file that’s being held open by a program and not understanding why the filesystem usage didn’t go down)
    • Unmounting a hard drive in use: Will error out similarly to Windows. lsof can tell you which process has which files open. There’s nuance with lazy unmounts and whatnot but that should not be used in most cases.

    Now in practice you should be wary of one very important thing that changes compared to Windows: Writes are asynchronous on Linux. First the kernel writes to RAM, then it flushes to disk at a later time for performance reasons (this is one of the reasons why writing a bunch of small files is many times faster on Linux than Windows). The upshot is that just because your file copy is “done” doesn’t mean you can just yank the USB cable. Always safely unmount before unplugging a storage device on Linux.

    • u/lukmly013 💾 (lemmy.sdf.org)@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      9
      ·
      19 hours ago

      Writes are asynchronous on Linux.

      Unless I mount it with sync, which I wish would be default for non-system drives (which are going to be in fstab anyway). I didn’t notice any difference, aside from the lack of guessing when the magic is over. 2GiB goes into black hole, now what?

      • azertyfun@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        9 hours ago

        Strongly disagreed. A lot of removable storage benefits very strongly from async writes. The performance benefits are night-and-day and worth the hassle of explicitly unmounting.

        I think a better compromise would be to mount non-journaled + removable storage (e.g. vfat USB keys) as sync.