"This message has been on the screen for almost two hours now." (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
Replies (1)
Replies (2)
USB flash drives in particular are notorious for this, if you've ever wondered why the file copy dialog closed minutes ago but the drive indicator LED is still flashing and the eject (Linux) / safely remove drive (Windows) dialog tells you that the drive isn't ready to be removed yet.
If this is the case, shutting off the power will cause that data to be lost. If you're thinking SSDs have enough power loss protection capacitors for this to not be true, you are sorely mistaken; this protection only guarantees that the SSD's idea of which pages are still erased and what LBAs map where isn't corrupted during wear-levelling for example. It protects the data structures that the drive firmware needs to operate correctly, not your data.
The paranoid might want to journal all of their filesystem writes, metadata and data (ordinarily, on most journalling filesystems, only metadata writes are journalled). Using fsync() then guarantees that either the entire contents of the new temporary file and the file rename operation are in the journal and will be replayed if they don't complete (after power loss or kernel panic for example), or that the file rename operation will not be replayed and the old file will still exist. This reduces write throughput considerably.
A lot of database software is written with the assumption that the underlying storage will lie to it, and does this by itself by default but in a more performant specialised manner, so you don't need to journal all writes in cases like this.
Some filesystems are immune to this problem. For example, ZFS won't process the rename if the filesystem transaction that wrote the temporary file to-be-renamed didn't complete (assuming you used fsync()). It is able to determine this automatically with its data and transaction checksums.
Replies (2)
Replies (1)
The START STOP UNIT command (0x1B) is used to instruct the drive to (among other things) unload or eject the medium and/or power down. This is what the Eject / Safely Remove Drive functions invoke. If the drive isn't ready to do so, for example because there is still data sitting in the volatile cache for it to write or a drive self-test is still in progress, it will tell you so.
These are SCSI commands, which are also used in drives that aren't electrically or physically SCSI. These include SATA, SAS, and USB Mass Storage (both MSC and UAS). That's why they all show up as sdx devices in Linux; sd stands for SCSI Disk (see drivers/scsi/sd.c), and you can't use any of these types of drives without SCSI support enabled in the kernel configuration (CONFIG_SCSI=y).
If this is happening it's an OS-level problem. If the drive was doing it, the OS would think it had finished.