LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 07-31-2015, 01:44 PM   #1
lwjandmy
LQ Newbie
 
Registered: Jul 2015
Posts: 2

Rep: Reputation: Disabled
Question How to DEFER disk write entirely, for protect hard disk?


I have 64bit Ubuntu 14.04 on my laptop, 4GB RAM,160GB hard disk.

I usually typping code, lying on the bed, so vibration is often, I know this is harm to hard disk.
So I want to defer disk write, delay few minutes then flush whole data to disk.

I have set root's mount option with 'noatime':
Code:
   $ mount
   /dev/sda1 on / type ext4 (rw,noatime,errors=remount-ro)
And set vm_dirty options:
Code:
   $ sysctl -a | grep dirty
   vm.dirty_background_bytes = 0
   vm.dirty_background_ratio = 5
   vm.dirty_bytes = 0
   vm.dirty_expire_centisecs = 60000
   vm.dirty_ratio = 10
   vm.dirty_writeback_centisecs = 500

But I found that isn't work, this is my test:
Code:
   # flush data to disk
   sync   ( command finished immediately, cause I just enter system, no other buzy process working)

   # make a test file
   touch test ( the HDD led flash, means disk WORK on this command !  Data should be cached ?! )

   # add some  text
   echo 'a' >> test ( led flash again ! )

   # much more  text
   echo 'a' >> test
   echo 'a' >> test
   echo 'a' >> test ( this three test, only first and second , HDD led flashs ; the third, led no change)

I fell puzzled at this test.
I have set defer write, but when I add 'a' to file, the disk work directly, without caching.


What should I do further more, for succeed defer disk write ??

Last edited by lwjandmy; 07-31-2015 at 11:24 PM. Reason: add code tags
 
Old 07-31-2015, 05:30 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Welcome to LinuxQuestions.

Unless your tossing the laptop around in bed my first thought is that there is nothing to worry about. How much protection depends on latpop and hard drive manufactures. There is inherently some form of dampening in either the hard drive itself and / or mounting provisions. Depending on age and manufacture some drives have built in vibration / shock detection so if critical values are exceeded the heads are automatically retracted.
 
Old 07-31-2015, 11:13 PM   #3
lwjandmy
LQ Newbie
 
Registered: Jul 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Welcome to LinuxQuestions.

Unless your tossing the laptop around in bed my first thought is that there is nothing to worry about. How much protection depends on latpop and hard drive manufactures. There is inherently some form of dampening in either the hard drive itself and / or mounting provisions. Depending on age and manufacture some drives have built in vibration / shock detection so if critical values are exceeded the heads are automatically retracted.


Thanks for reply.

Could you please tell me:
"I have set defer write, but when I add 'a' to file, the disk work directly, without caching." Why the cache didn't work?

Thanks again.

Last edited by lwjandmy; 07-31-2015 at 11:14 PM. Reason: add quote
 
Old 08-01-2015, 06:32 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
I've never played with those parameters but dirty_writeback_centisecs = 500 which is a 0.5 seconds which could be the reason your not getting the desired results. Another parameter that might work for you is increasing ext4 commit.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change disk size by editing disk information on the hard disk? xptchina Linux - Virtualization and Cloud 2 12-16-2010 08:12 AM
Cannot write into my hard disk criacuervo Linux - Newbie 10 03-24-2010 12:57 AM
mounting linux files from another hard disk(IDE) to current hard disk(sata) the lord protector Linux - Hardware 5 05-04-2008 11:30 AM
60GB laptop hard disk & 200GB external USB hard disk linux compatibility powah Linux - Hardware 0 03-07-2006 10:55 AM
how to protect hard disk from bittorrent? bbmak Linux - Software 4 08-17-2004 04:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 07:12 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