On Thu, Jan 2, 2020 at 5:49 AM Dale <[email protected]> wrote: > > lol I didn't think of that and I don't recall anyone else thinking of > it either.
That is because syncing before unmounting doesn't do anything. Unless you use --lazy umount blocks until all writes are complete to a device. The instant it returns as far as the kernel is concerned the device should be safe to power off. If you do a sync first then of course the umount will complete more quickly, since all writes should already be flushed. I have no idea what your device is doing after it is unmounted, but it doesn't have anything to do with the linux kernel unless some process is directly accessing the raw device (very unlikely). Maybe the drive firmware is doing some kind of housekeeping, or maybe the drive has some kind of vibration in it that just makes it feel like it is doing something. Or maybe the NSA or Red Army has hacked your firmware and it is doing who knows what (yes, the NSA bit at least is a thing). In any case, chances are the drive manufacturer has accounted for sudden power loss in the design because if they didn't there would be a ton of complaints, since there is nothing you can do about this sort of thing assuming the firmware is up to something. Out of curiosity, what model drive is it? Is it by chance an SMR / archive drive? Due to the limitations on how those write data out I could see them implementing an internal filesystem that journals incoming data and then writes it back out after the fact. If so then that might happen even after the kernel thinks it is unmounted. However, such a drive firmware would probably use a journal that ensures data is safe even if power is cut mid-operation. The drive isn't supposed to report that a write is completed until it is durable. -- Rich

