News for hackers. Stuff that matters.
Re:Hacked Together 118 GB Floppy Disk by dcw303 on Friday February 26, 2016 @01:40AM (#11180129)
If he could get the drive eject button to unmount the SD card, this would actually be more functional that current tech.

It bugs me that unmounting SD cards / USB drives and physically removing it are two seperate actions. It's a regression in usability after floppies and CD-ROMs.

Re:Hacked Together 118 GB Floppy Disk by josteink on Friday February 26, 2016 @02:16AM (#11180223)
> If he could get the drive eject button to unmount the SD card, this would actually be more functional that current tech. It bugs me that unmounting SD cards / USB drives and physically removing it are two seperate actions.

To be fair, this was always a problem, also with old computers and OSes. There was no link between pressing eject and magical things happening in the machine to commit data. The data was simply already committed so there was no need to have any additional layers of security.

The difference between then and now is that new computers have enormous amounts of memory and use it to provide write-back caching. This means the OS can tell applications that data is committed when it's not. This is an OS level decision which is done for performance and has nothing to do with the physical eject-buttons on your devices.

You may call this a small nit, but I think it's an important one. The eject-button on old machines would suffer the exact same problems if it used an OS which offered write-back cache.

You could say old Macs didn't have this problem, which is true. But it didn't have an eject-button. It relied on the OS doing that. And then instead you had the problem of people not being able to get their disks out of their machines if the OS for some reason refused to release it (or that users didn't realize they had to drag the disk-icon to trash).

Re:Hacked Together 118 GB Floppy Disk by ttctciyf on Friday February 26, 2016 @05:36AM (#11180745)
> the problem of people not being able to get their disks out of their machines if the OS for some reason refused to release it

My first time on a Mac, about 1990, I felt pretty confident having plenty of early PC experience. A graphic designer I shared a house with had left me alone with (and permission to use) her Mac.

I quickly discerned there was no software of interest actually installed, but found a floppy that looked something like a game. It wasn't, and I went to hit the ... wait, there's no eject button?

After a fruitless few minutes during which I failed to notice the eject key on the keyboard (of all places!) I eventually opted for tweezers, and gently teased the floppy out of the drive.

Imagine my surprise when I restarted the Mac to find it was unable to start, having apparently completely forgotten about it's own HD! The thing had to go back for servicing before it would even boot properly, iirc.

My reputation as the house's resident computer expert was severely impacted, needless to say.

Re:Hacked Together 118 GB Floppy Disk by soylentcola on Friday February 26, 2016 @08:39AM (#11181264)
One of the things that drove me nuts using the earlier Macs at my college was the lack of an eject button. Sure, I understand the reasoning now, but when some crappy Hypercard project I was bungling made the computer freeze, I had no way to remove the floppy short of rebooting the whole computer and waiting or hunting around for a paperclip to push into the little manual eject hole.

Still, seeing how many people in my office will just pull USB flash drives without ejecting them I almost see the appeal now.

Re:Hacked Together 118 GB Floppy Disk by shdon on Friday February 26, 2016 @01:05PM (#11182880)
That latter bit is actually so common that Windows was changed to accommodate it, as Raymond Chen wrote at https://blogs.msdn.microsoft.com/oldnewthing/20031216-00/?p=...
Re:Hacked Together 118 GB Floppy Disk by digi_owl on Friday February 26, 2016 @05:33PM (#11184796)
I loved how only of my early optical drives had a notch tastefully designed into the front that allowed me to pry the drive open with any sufficiently rigid object, rather than deal with the "pointy thing into small hole" that everything later on had.
Re:Hacked Together 118 GB Floppy Disk by eCa on Friday February 26, 2016 @10:21AM (#11181783)
My first interaction with a Mac (late '90s), I watched the Mac user:

* Drag the disc icon to the trash can to eject the disc.

* Pull the power cord since there were no other way they knew of to turn it off.

Mac's reputation as a usable computer was severely impacted, needless to say :).

Re:Hacked Together 118 GB Floppy Disk by digi_owl on Friday February 26, 2016 @05:36PM (#11184813)
After hearing Woz talk about how the early Macs were resistant to malware because most of the OS lived in ROM, i find myself thinking that rather than the Amiga being the last of the "micros" the Mac ended up being so. This in that it was designed more like a C64 than a PC.
Re:Hacked Together 118 GB Floppy Disk by jerf on Friday February 26, 2016 @10:04AM (#11181697)
I hope that ~25 years later that these Internet points I grant you can ease the pain of your memory.
Re:Hacked Together 118 GB Floppy Disk by sucrose on Friday February 26, 2016 @09:41AM (#11181570)
I felt my face get red hot for you when I read those last lines.
Re:Hacked Together 118 GB Floppy Disk by mike_hock on Friday February 26, 2016 @05:39AM (#11180755)
We also had that fixed with CDs/DVDs when the OS could lock the drive and handle the eject button any way it liked.

I didn't quite like the way Linux handled this though, not allowing the disk to be ejected as long as any file descriptors were still open, which meant you had to hunt down the processes keeping them open.

But it would be extremely helpful for writable media like flash to be able to do full write-back caching and only flush the cache when the eject button is pressed, then EBADF any further reads or writes to any open file descriptors.

Re:Hacked Together 118 GB Floppy Disk by TazeTSchnitzel on Friday February 26, 2016 @08:26AM (#11181213)
Ooh, it'd be cool if you could do the same thing for USB drives. Perhaps some sort of claw or magnetic mechanism could hold the drive in place.
Re:Hacked Together 118 GB Floppy Disk by putterson on Friday February 26, 2016 @01:58PM (#11183243)
This makes me wonder what those two holes in the shroud of USB A style connectors are for. After a bit of googling it looks as if they are to provide a bit of tension against removal. I'm sure you could repurpose them to lock the usb drive into a USB port.
Re:Hacked Together 118 GB Floppy Disk by digi_owl on Friday February 26, 2016 @05:39PM (#11184835)
Some office ape is likely to rip the port out...
Re:Hacked Together 118 GB Floppy Disk by mike_hock on Saturday February 27, 2016 @05:19AM (#11186701)
Then take the repair costs out of his pay check, and if it happens repeatedly, let him go.
Re:Hacked Together 118 GB Floppy Disk by digi_owl on Friday February 26, 2016 @05:39PM (#11184831)
fuser * while sitting at the mountpoint usually gives a clue.

Also useful when something is hogging the audio device in /dev.

Re:Hacked Together 118 GB Floppy Disk by timthorn on Friday February 26, 2016 @02:37AM (#11180258)
The eject-button on old machines /did/ suffer the exact same problems - removing the disk whilst the activity LED was illuminated rarely ended well!
Re:Hacked Together 118 GB Floppy Disk by viraptor on Friday February 26, 2016 @03:02AM (#11180328)
I just remembered that even hard drives at some point had similar issues. Remember to park your heads before power off!
Re:Hacked Together 118 GB Floppy Disk by josteink on Friday February 26, 2016 @03:41AM (#11180443)
Good catch! I had completely forgotten about that one.

For those completely oblivious to this: This was actually not about getting data written to disk, but to physically protect the drive from its own mechanical construction. The "park" command would cause the harddrive to move its magnetic read and write-heads away from the internal platters, so that when it was powered down and the disks stopped spinning, the platters would not be damaged or experience needless tear and wear.

Yeah, I'm glad we no longer have to do that exercise.

Re:Hacked Together 118 GB Floppy Disk by fit2rule on Friday February 26, 2016 @06:11AM (#11180841)
I still type "sync;sync;sync" before I unmount something.

(This used to be how you'd tell the tape-spooler to rewind..)

Re:Hacked Together 118 GB Floppy Disk by ashmud on Friday February 26, 2016 @11:18AM (#11182164)
Reminds me: Sysinternals Sync on Windows.

Always, always sync -r after writing to a zip drive on Windows. Even minutes after you think it is finished writing, do not trust the OS to have finished flushing to disk.

Re:Hacked Together 118 GB Floppy Disk by amelius on Friday February 26, 2016 @05:26AM (#11180715)
> The difference between then and now is that new computers have enormous amounts of memory and use it to provide write-back caching.

Also, not syncing to disk immediately can improve the lifetime of flash media, which wasn't a concern in the old days.

However, I'm somewhat disappointed by current filesystems not using journaling to make it possible to pull out a USB drive without harm (other than losing the latest writes).

Re:Hacked Together 118 GB Floppy Disk by Tloewald on Friday February 26, 2016 @01:36PM (#11183104)
You could select the disk and then "Eject". Dragging to the trash was a shortcut to unmount and eject.

As for Macs not having the problem, this doesn't require qualification. Not only did Macs not have the problem, they treated disks as logical _volumes_ rather than physical devices. If you ejected a disk mid-save on a Mac it would complain, and if you inserted the wrong disk it would reject it and ask for the right one. If you did the same thing on a DOS/Windows machine it would correct the new disk (and leave the old disk corrupted too).

Similarly, you could copy files from one disk to another without having two disk drives in Finder (it was a pain in the neck, swapping the disks, but it worked). Other computers needed special software and relied on the user to insert the correct disk.

This advantage continues to this day. Windows still refers to devices by physical location.

Re:Hacked Together 118 GB Floppy Disk by digi_owl on Friday February 26, 2016 @05:45PM (#11184856)
> Windows still refers to devices by physical location.

Nope, not since NT. I learned that the hard way when moving a HDD containing Win2k around. Even though it was hooked to IDE master it would come up as D: as that was what it was assigned after it got formated with NTFS.

You can go into disk manager and assign a partition any letter than is not already in use.

You can even mount a partition into a existing FHS, much like on unix, but i can't say i have seen it used often.

Basically the letters are there for backwards compatibility.

Re:Hacked Together 118 GB Floppy Disk by jgrahamc on Friday February 26, 2016 @02:45AM (#11180273)
To be fair, this was always a problem, also with old computers and OSes. There was no link between pressing eject and magical things happening in the machine to commit data

There was on the Apple Lisa. Or rather ejecting a disk was something you did in the OS which made sure everything was written/closed before allowing the disk out.

Re:Hacked Together 118 GB Floppy Disk by josteink on Friday February 26, 2016 @02:55AM (#11180308)
Yeah I mentioned that in the end of my comment, together with the other issues that would typically lead to.

It was definitely confusing to new users: Insert a disk was something which anyone could do, since it only involved simple movement of a physical object, but ejecting it required you to know and understand the OS.

This was quite an "impedance mismatch" between what should ideally be two symmetrical actions, and I remember I had to help out my mother quite a few times :)

Re:Hacked Together 118 GB Floppy Disk by oh_sigh on Friday February 26, 2016 @08:03AM (#11181129)
You're right - the only solution would be a captive eject button, which did all of the write resolutions before allowing the disc to physically eject. And that would come with other usability problems, like users getting angry when they push eject and their card doesn't come out immediately.
Re:Hacked Together 118 GB Floppy Disk by kalleboo on Friday February 26, 2016 @02:09AM (#11180202)
I remember when Apple had the soft-eject floppy drives that would only eject after the disk was properly unmounted, and then they even did soft-eject PCMCIA slots. I was surprised when their SD card slots weren't soft-eject.
Re:Hacked Together 118 GB Floppy Disk by stormbrew on Friday February 26, 2016 @02:35AM (#11180256)
This was great until your Mac decided that it didn't want to unmount that disk for some reason. And then you got out a paperclip.
Re:Hacked Together 118 GB Floppy Disk by minikites on Friday February 26, 2016 @06:11AM (#11180843)
Before resorting to a paper clip, the trick was to reboot while holding the mouse button. This still works today with CDs if the CD is damaged and the OS gets caught up trying to read it.
Re:Hacked Together 118 GB Floppy Disk by PhasmaFelis on Friday February 26, 2016 @05:06AM (#11180667)
I actually remember frantically searching through my uncle's Mac manual after I inserted a corrupt boot disk (or possibly not a boot disk at all) and then couldn't get the thing to boot, which meant I couldn't use the soft eject.

Fortunately the paperclip trick was in there.

Re:Hacked Together 118 GB Floppy Disk by derefr on Friday February 26, 2016 @02:44AM (#11180270)
The external-USB "Superdrive" optical drive is still soft-eject, when it's got a rewritable CD in there.
Re:Hacked Together 118 GB Floppy Disk by WWLink on Saturday February 27, 2016 @05:35AM (#11186730)
I don't remember soft eject slots, my powerbook g4 had a button, and I think the expresscard slots on later macbooks just used the same kinda mechanism sd cards use.
Re:Hacked Together 118 GB Floppy Disk by digi_owl on Friday February 26, 2016 @03:26AM (#11180395)
I really wish there had been a bigger push towards some kind of standardized packet writing for DVDRW (CDRW had this issue with a one use calibration track), so that they could behave more like floppies (drag and drop file transfers etc).

The media itself is fully passive, while a SD card or thumbdrive have logic sitting between the USB interface and the raw flash. Thus optical media can be "rescued" by simply getting a new drive.

And you really need to mistreat a optical disc to make it completely unreadable.

Or perhaps someone could buy the minidisc tech off Sony and resurrect magnet-optical storage?

Re:Hacked Together 118 GB Floppy Disk by ashmud on Friday February 26, 2016 @11:12AM (#11182119)
Light reading about optical disc packet writing for anyone new the subject:

https://en.wikipedia.org/wiki/Mount_Rainier_%28packet_writin...

Re:Hacked Together 118 GB Floppy Disk by rikkus on Friday February 26, 2016 @04:05AM (#11180515)
On Windows, they're mounted sync by default, so you can just remove them. Of course, if you do so while it's writing, you'll have a problem - though this was the same with floppies.

Windows used to require you to 'eject' but doesn't any more, which I think is due to the above. Please correct me if I'm wrong.

Re:Hacked Together 118 GB Floppy Disk by zamalek on Friday February 26, 2016 @04:07AM (#11180518)
It is only required if you enabled write-caching for removable media. As far as I know this has never been enabled by default.
Re:Hacked Together 118 GB Floppy Disk by TazeTSchnitzel on Friday February 26, 2016 @08:27AM (#11181221)
> It is only required if you enabled write-caching for removable media.

No, it's always required, because applications may be writing to the drive.

Re:Hacked Together 118 GB Floppy Disk by hnal943 on Friday February 26, 2016 @11:46AM (#11182353)
I have never done it, and never had any problems. I always assumed it was a feature that only was needed for devices that had some sort of physical requirement for safe shutdown (spinning rust or the like).
Re:Hacked Together 118 GB Floppy Disk by JupiterMoon on Friday February 26, 2016 @04:11AM (#11180530)
By windows. I'm not sure what parted/gparted defaults to.
Re:Hacked Together 118 GB Floppy Disk by digi_owl on Friday February 26, 2016 @04:20AM (#11180557)
I think they go with a write cache.

I recall some distros tried to mount USB drives with the sync option back in the early days of USB media.

Problem was that this, in combo with FAT, would basically kill cheap drives lacking wear leveling.

This because every write action was accompanies with a allocation table update. And thus whatever flash cells housed that table would see a massive amount of writes.

Actually i think the mount man file still have a warning about this in the sync option entry.

Re:Hacked Together 118 GB Floppy Disk by JupiterMoon on Friday February 26, 2016 @04:45AM (#11180618)
So this implies that even in windows one needs to safely unmount external media that were originally formatted using parted/gparted?
Re:Hacked Together 118 GB Floppy Disk by pjc50 on Friday February 26, 2016 @04:59AM (#11180657)
No, the write caching is a function of whatever's reading the thing, not the format.
Re:Hacked Together 118 GB Floppy Disk by JupiterMoon on Friday February 26, 2016 @04:10AM (#11180526)
I think that it depends upon file system and the options selected when you format the drive. Windows defaults to options that mean you don't need to 'eject'. However, if you formatted on another OS you can select options that mean a safe unmount is required before yanking the drive out of the socket.
Re:Hacked Together 118 GB Floppy Disk by GigabyteCoin on Friday February 26, 2016 @01:48AM (#11180149)
What a great point.

I am so paranoid now about removing USB drives after I accidentally removed one while it was still writing to the drive (which I had no idea because there was no LED on the drive) and it bricked the entire device.

I generally wait until my computer has shutdown completely now before removing any important drives, just to be sure.

Re:Hacked Together 118 GB Floppy Disk by derefr on Friday February 26, 2016 @02:50AM (#11180297)
Generally if I'm worried about completing a write, I'll just open a Terminal and type `sync` (with a `&& sudo purge` on OSX), and then, as soon as that returns, yank the drive.

I don't even bother to unmount it; what would unmounting add, if the OS can recognize that the device is gone and clean up its mount tables? Is there some filesystem that waits until unmount to recalculate indexes or something?

(Okay, sure, the OS could tell me the disk is in use because I've got an overlay filesystem mounted on top of it, and would I kindly wait forever for that to stop being the case. But screw you, OS, I need this USB. Just send the FUSE server or SMB daemon or whatever a SIGPIPE.)

Re:Hacked Together 118 GB Floppy Disk by andrewaylett on Friday February 26, 2016 @04:37AM (#11180598)
Filesystems often have a 'dirty' flag which is cleared as the very last write when unmounting cleanly, to let the OS know whether the filesystem might need to be checked before mounting it next time.

Also, unmounting helps you to be confident that nothing's started doing more IO since you ran sync.

Re:Hacked Together 118 GB Floppy Disk by whyagaindavid on Friday February 26, 2016 @08:21AM (#11181192)
I use this bash script to a umount with a shortcut key. Using KDE. (bad formatting in hn)

#!/bin/bash for i in `ls /media/$USER` do cd /media/$USER umount $i done

ls /media/$USER |grep -v cdrom0 |grep -v cdrom> /tmp/disk_status file=/tmp/disk_status if [ ! -s $file ]; then kdialog --passivepopup "Nothing Mounted " 1 else kdialog --passivepopup "Mounted devices: `cat /tmp/disk_status`" 2 fi