OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 5:41 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Partition damage by unplugging while reading
PostPosted: Thu Aug 03, 2017 11:01 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
What can be the reasons for a partition to become damaged if an external disk is unplugged while simply reading data?

Could it be damage to the suddenly turned off media, or are there other things in the background that operating systems use to write anyway even if we are just reading data, not writing files?

What is the role of journaling in these cases? Are read operations logged by journaling or not normally?

_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1


Top
 Profile  
 
 Post subject: Re: Partition damage by unplugging while reading
PostPosted: Thu Aug 03, 2017 11:14 am 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
Damaged in what way? What do you base your assertion that it's damaged on?

You said partition, you mean FS? If so, what FS?

I would expect reading to not create journaling, but how are you sure there was no other background write-op happening?


Top
 Profile  
 
 Post subject: Re: Partition damage by unplugging while reading
PostPosted: Thu Aug 03, 2017 12:17 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
The OS may want to update access times.


Top
 Profile  
 
 Post subject: Re: Partition damage by unplugging while reading
PostPosted: Thu Aug 03, 2017 12:28 pm 
Offline
Member
Member

Joined: Fri Aug 19, 2016 10:28 pm
Posts: 360
With exception to files opened in unbuffered mode or requests followed by flush, writes are lazy. The contents are only marked dirty in the fs cache and repeated or incremental updates to the same block are combined there.

Reads for files opened in unbuffered mode flush and discard the corresponding cache pages and thus cause writes. Furthermore, writes can result from memory pressure, which can be the result of anything, including reads. For example, the cache pages for the read data can be acquired by evicting the contents of a dirty page, which causes a write.

The journal will guarantee consistent fs structure after a crash even if it is written out lazily, because its operation depends only on correct sequencing. However, the user data will be lost/corrupted unless the filesystem is explicitly configured to journal it as well.

The sysctl parameters vm.dirty_writeback_centisecs, vm.dirty_expire_centisecs can be used to control the flush frequency on Linux. Windows can disable the file cache on a per device basis and configure certain quotas, but lacks fine grained timing control.


Top
 Profile  
 
 Post subject: Re: Partition damage by unplugging while reading
PostPosted: Thu Aug 03, 2017 3:09 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
most operating systems are caching the disk writes.
also disk write occur if you read the files (to maintain access time for example).

thats why i decided my os not to do such things, so its safe to take out the disks whenever the user wants to.

_________________
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 97 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group