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 ??