LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-17-2021, 06:34 PM   #1
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,378

Rep: Reputation: Disabled
we shouldn't shut down by unplugging, but what about live sessions?


I learned as a child that it's not a good idea to shut down by just unplugging. But I think when I learned that, the sources suggested it could harm files. I don't remember whether anyone said it could harm hardware as well.

I am considering this specific situation: I was doing something quick on my laptop that my desktop wasn't set up for, using a live session. Loaded into the RAM from a flash drive. I made some files in the session and moved them onto another stick that was plugged in. Once finished, I was ready to shut it down. After hesitating a second, I just shrugged and pulled the plug--it was a bit quicker than waiting for the shutdown routine. Should I not have done that, even considering that it was just a live session about to vanish forever, and I had saved the files on a flash drive?
 
Old 10-17-2021, 06:45 PM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by newbiesforever View Post
I learned as a child that it's not a good idea to shut down by just unplugging. But I think when I learned that, the sources suggested it could harm files. I don't remember whether anyone said it could harm hardware as well.

I am considering this specific situation: I was doing something quick on my laptop that my desktop wasn't set up for, using a live session. Loaded into the RAM from a flash drive. I made some files in the session and moved them onto another stick that was plugged in. Once finished, I was ready to shut it down. After hesitating a second, I just shrugged and pulled the plug--it was a bit quicker than waiting for the shutdown routine. Should I not have done that, even considering that it was just a live session about to vanish forever, and I had saved the files on a flash drive?
As long as you eject the stick you store the files on first you are ok. Without ejecting you take the chance the files have not been fully written to the stick before the power to it goes away.
 
1 members found this post helpful.
Old 10-17-2021, 07:47 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,764

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
The live operating system on a flash drive is basically the same as a CD/DVD i.e. ISO9600 read only so it should be fine with unplugging.

However, the data drive is another matter. As posted since both read/write operations are cached there could be but probably unlikely in your case on the assumption the files were not large still some writing done in the background.
 
1 members found this post helpful.
Old 10-17-2021, 08:57 PM   #4
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,390

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Quote:
Originally Posted by newbiesforever View Post
I learned as a child that it's not a good idea to shut down by just unplugging.
Children today, yikes. I was a kid in the DOS days (when no such thing existed). One of the most annoying things when win95 came around was "shutting down", like wtf is that all about, why can't I just turn it off! They even managed to hijack the power-off button on many computers that made it shutdown instead of just power off.

Yes, live system you can just power off, if yer talking about the live environment on most distros install iso.

Last edited by enigma9o7; 10-17-2021 at 08:59 PM.
 
Old 10-18-2021, 06:09 AM   #5
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
I remember having to park the hard disk drive heads before powering off in DOS... but yes the concept of "shutting down" was unknown in MS OS before Windows 95 as far as I can recall...

However:

Quote:
HISTORY

A reboot command appeared in Version 6 AT&T UNIX.
Quote:
HISTORY

The shutdown command appeared in 4.0BSD.
 
Old 10-18-2021, 06:00 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,008

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
One of the dos versions had park command.

As long as you did save the files to a drive and you unmounted you can just crash a live boot.
 
Old 10-18-2021, 10:39 PM   #7
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,246

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
Quote:
Originally Posted by newbiesforever View Post
I learned as a child
I assume that was back when the power button could actually physically damage a hard drive?
 
Old 10-19-2021, 08:23 AM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
The computer buffers data in memory in a strategy known as "lazy writing." If you're busy writing or updating a file, the computer knows that it is very likely that you will make another change at or near the same area. So, it makes those changes in the buffer before "lazily" writing it to disc in the background.

In Unix/Linux, the sync command forces all of those lazy writes to occur before the command completes. I think that it's a good idea to end scripts which do a lot of file updates or copying with a call to that command. Upon return, there is no un-written data in any disk I/O buffer. Sometimes this command will take a human-noticeable amount of time to complete, especially in the case of USB-connected storage devices which are usually "capacious, but slow."

It is therefore very important that you "eject" an external storage device before removing it, and to make sure that any lights have stopped blinking for several seconds. Other people here have very recently reported that they did this, then "quickly" removed the device, only to discover the hard way that I/O write activity was still in progress. (And the data was lost or corrupted.) Obviously it should not be that way – but it might be. Therefore, explicitly eject or dismount the drive, then wait several seconds more after the lights stop blinking.

"Shutting down" first gives all active processes a signal that the system is about to shut down. They should respond to that signal by closing all of their files and otherwise putting their earthly affairs in order, then terminate themselves. The OS will wait a little while to give all of them the opportunity to do that before finally signaling the motherboard to turn off the power. If you simply "yank the plug," the state of the system at the next power-on is unpredictable, and any final disk-writes didn't happen. It's especially problematic if a disk write was happening at that instant, because this can leave a "magnetic smear" on a spinning disk.

Last edited by sundialsvcs; 10-19-2021 at 08:28 AM.
 
Old 10-21-2021, 12:22 PM   #9
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by newbiesforever View Post
I don't remember whether anyone said it could harm hardware as well.
Back in the early days of the home PC ... if you had a hard drive, you'd have to issue a command to "park" the hard drive. Doubly true if you had to move the computer. If you powered off the PC without parking, the head could scrape and damage the platters. Power outages were a scary thing back then.
 
Old 10-21-2021, 12:39 PM   #10
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by sundialsvcs View Post
It is therefore very important that you "eject" an external storage device before removing it, and to make sure that any lights have stopped blinking for several seconds. Other people here have very recently reported that they did this, then "quickly" removed the device, only to discover the hard way that I/O write activity was still in progress. (And the data was lost or corrupted.) Obviously it should not be that way – but it might be. Therefore, explicitly eject or dismount the drive, then wait several seconds more after the lights stop blinking.
As an addendum, you can issue the 'sync' command to force the OS to write everything. Once it returns, you can be sure your data is written. Great for personal systems, but I understand you don't want to make this habit on a busy server, as it may cause I/O delays as the server continues to process other commands.
 
1 members found this post helpful.
Old 10-22-2021, 04:49 AM   #11
JASlinux
Member
 
Registered: Oct 2020
Posts: 385

Rep: Reputation: Disabled
I use a laptop with a replacement ac cord that isn't the exact spec of the original. It works but only at a very specific level of insertion and wiggle.

For this the power fails all the time.

In LIVE mode the biggest problem is losing my place. What exactly was I doing again? What files did I have open? I wouldn't want a read-write in process on a mounted partition.

There is trouble with save/persistent files in use, but in a good os even they are recoverable.
 
Old 10-22-2021, 09:57 AM   #12
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
High-capacity servers routinely use a variety of I/O technologies such as "NAS = Network-Attached Storage," and of course always have highly reliable power supplies.
 
Old 10-22-2021, 04:16 PM   #13
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,390

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Quote:
Originally Posted by JASlinux View Post
I use a laptop with a replacement ac cord that isn't the exact spec of the original. It works but only at a very specific level of insertion and wiggle
This just sounds silly. Do you not have the original cord you can cut the connector from and attach to your replacement? Just an idea...
 
Old 01-07-2022, 12:36 PM   #14
zaphar
Member
 
Registered: Nov 2012
Distribution: Slackware
Posts: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by enigma9o7 View Post
This just sounds silly. Do you not have the original cord you can cut the connector from and attach to your replacement? Just an idea...
Not to mention, if the power jack doesn't fit correctly, does the power brick have the correct voltage and amperage rating? I would say polarity too, but if it powers on, it must be correct. If the voltage/amperage rating isn't right, it can burnout the power brick and release a sweat carcinogenic plastic smell.
 
Old 01-08-2022, 10:46 AM   #15
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,378

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SlowCoder View Post
As an addendum, you can issue the 'sync' command to force the OS to write everything. Once it returns, you can be sure your data is written. Great for personal systems, but I understand you don't want to make this habit on a busy server, as it may cause I/O delays as the server continues to process other commands.
Interesting...then should I do this, just to make sure all data has been written? This [I]is[I] a personal system...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Errors on shutting down (does not let shut down) Sefid par Linux - Server 1 03-09-2014 03:27 PM
shut down problem - wont shut down.. UbrInKid Linux - Newbie 4 12-10-2009 06:20 AM
Xubuntu won't shut down - black screen after trying to shut down Snickar-Lasse Ubuntu 2 11-30-2009 04:33 PM
Linux Sessions...how to shut them down? alfredh Linux - Newbie 1 03-07-2004 04:55 AM
shut down won't shut system down taoweijia Linux - General 3 03-03-2004 06:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration