Does Safely Ejecting From a USB Port Actually Do Anything?

iStock
iStock

Does safely ejecting from a USB port actually do anything?Phillip Remaker:Is there any harm to be incurred by just pulling a flash drive out? Why do we need safe removal at all?

Historically, operating systems (OS) treat disks as objects that can be trusted not to change state suddenly. When reading or writing files, the OS expects the files to remain accessible and not suddenly disappear in mid-read or mid-write. If a file is open, a program reading the file expects to be able to return to it and continue reading. Similarly, write commands may be dispatched to a writing subroutine and forgotten by the main program. If a drive disappears between the time the subroutine is called and the data is written to disk, that data is lost forever.

In ye olde days, there were formal processes to physically "mount" and "unmount" storage media, and the physical act of mounting a tape or a disk pack triggered some mechanical switch to detect the presence or absence of media. Once the mechanism was engaged, the software could start to use the media (a "soft mount"). Some media even had mechanical interlock to prevent media from being ejected or removed until the software processes using the media released the lock.

The Macintosh floppy and optical disk provide more modern examples of an interlocked physical and soft mount. One could only eject media through a software command, but that command might fail if some program was holding a file open on the medium. 

Enter USB connected storage. There is no mechanical interlock in a USB connection to coordinate the hard and soft mount. The user can decide to rip the disk out from under the operating system at any time, and endure all manner of programs freaking out about the sudden loss of media. "Hey! I was using that!" Symptoms could include: Lost data, corrupted file systems, crashing programs, or hanging computers requiring a reboot. A safe removal executes the "soft unmount" needed to prevent any unexpected Bad Things that may happen if a program loses its access to media.

A safe removal does a few things:

  • It flushes all active writes to disk.
  • It alerts all programs (that know how to be alerted) that the disk is going away, and to take appropriate action.
  • It alerts the user when programs have failed to take action, and still are holding files open.

You can remove a disk at any time, but you are at the mercy of how well programs using the disk cope with the sudden disappearance of that disk.

In the modern computer, many steps have been taken to defend against the capricious and careless removal of media. For example, Windows introduced a feature called "Optimize for Quick Removal," which makes sure data is written quickly instead of batched up and written efficiently. 

It is very hard to get people to change habits. If you are doing exclusively reads on a media, safe removal is probably not needed. If you are doing writes, you are probably OK to skip safe removal if you haven't written recently and you aren't doing something silly like indexing that disk.

As a good friend of mine once said: "Life is too short to safely eject the disk."

However, safe removal does a number of important things and is, in fact, the only assuredly safe way to remove a disk. You probably don't need it most of the time, but it is a good habit to have since data loss sucks.

This post originally appeared on Quora. Click here to view.

Looking to Downsize? You Can Buy a 5-Room DIY Cabin on Amazon for Less Than $33,000

Five rooms of one's own.
Five rooms of one's own.
Allwood/Amazon

If you’ve already mastered DIY houses for birds and dogs, maybe it’s time you built one for yourself.

As Simplemost reports, there are a number of house kits that you can order on Amazon, and the Allwood Avalon Cabin Kit is one of the quaintest—and, at $32,990, most affordable—options. The 540-square-foot structure has enough space for a kitchen, a bathroom, a bedroom, and a sitting room—and there’s an additional 218-square-foot loft with the potential to be the coziest reading nook of all time.

You can opt for three larger rooms if you're willing to skip the kitchen and bathroom.Allwood/Amazon

The construction process might not be a great idea for someone who’s never picked up a hammer, but you don’t need an architectural degree to tackle it. Step-by-step instructions and all materials are included, so it’s a little like a high-level IKEA project. According to the Amazon listing, it takes two adults about a week to complete. Since the Nordic wood walls are reinforced with steel rods, the house can withstand winds up to 120 mph, and you can pay an extra $1000 to upgrade from double-glass windows and doors to triple-glass for added fortification.

Sadly, the cool ceiling lamp is not included.Allwood/Amazon

Though everything you need for the shell of the house comes in the kit, you will need to purchase whatever goes inside it: toilet, shower, sink, stove, insulation, and all other furnishings. You can also customize the blueprint to fit your own plans for the space; maybe, for example, you’re going to use the house as a small event venue, and you’d rather have two or three large, airy rooms and no kitchen or bedroom.

Intrigued? Find out more here.

[h/t Simplemost]

This article contains affiliate links to products selected by our editors. Mental Floss may receive a commission for purchases made through these links.

An Illinois School District Has Banned Fully Remote Students From Wearing Pajamas While Learning

The great thing about Zoom is that it's almost impossible for people to tell if you're wearing pajamas.
The great thing about Zoom is that it's almost impossible for people to tell if you're wearing pajamas.
August de Richelieu, Pexels

Having most of your interactions via video chat can be a little exhausting, but it does come with a few perks—like being able to wear your pajama pants without anybody knowing or caring. For students facing remote learning in Illinois’s Springfield School District, however, PJs are against the rules.

WGRZ reports that the dress code for Springfield’s learn-from-home plan includes a ban on pajamas, which a number of parents aren’t too happy about.

“I don’t think they have any right to say what happens in my house,” parent Elizabeth Ballinger told WCIA. “I think they have enough to worry about as opposed to what the kids are wearing. They need to make sure they’re getting educated.”

Aaron Graves, president of the Springfield Education Association, doesn’t actually appear to disagree with Ballinger.

“In truth, the whole pajama thing is really at the bottom of our priority scale when it comes to public education,” Graves told WCIA. “We really want to see kids coming to the table of education, whether it’s at the kitchen table with the laptop there or whether it’s the actual brick and mortar schoolhouse. Raising the bar for all kids and helping them get there, whether they’re in their pajamas or tuxedo, is really what’s important.”

Though the pajama prohibition was part of the regular in-school dress code [PDF], imposing it from afar will definitely be more difficult. Fortunately, the administration’s enforcement policy is pretty vague; a statement shared with WCIA explained that “there are no definitive one-to-one consequences” for wearing your pajamas to online school, and teachers will decide what to do about any given violation.

In other words, it looks like kids with easygoing teachers (and parents) will get to stay in their nightshirts, while others might have to learn their multiplication tables in tuxedos.

[h/t WGRZ]