Can somebody explain dirty and writeback and the way linux uses the cache?
by breadbin from LinuxQuestions.org on (#6N3YB)
Code:watch grep -e Dirty: -e Writeback: /proc/meminfoCode:Dirty: 2063940 kbCode:Writeback: 128 kb
I think I understand it but maybe I have it wrong. I have been doing my annual backing up onto various external hard drives. I think this one is NTFS and mounted as fuse? The drive i'm copying off is an SSD formatted as EXT4 and I am using Linux Mint 20.3.
Earlier on today I copied a 4Gb file onto it with Midnight Commander at 150Mb/s and it took a few seconds. I watched the output of the above command and the Dirty value was decreasing to zero at about the same rate, give or take 150Mb/s. The light on the hard disk stopped flashing when it got to zero. Like in total 30 seconds for that file. I did it with another file and same thing. Now it isn't and I am wondering why.
I just copied a 5Gb file with midnight commander to the external hard disk and the Dirty is decreasing at about 10Mb/s. Why? Midnight Commander showed the file being copied at 150Mb/s but I presume it is copying it to the cache and then the cache has to be copied to the hard disk. I know the cache is about 8Gb because there is a huge slowdown when I copy more than that. It just has me puzzled, like why earlier would it do both operations at a fast speed and now not? Is there something I can change to get it to write faster? Obviously I want it copied as quickly as possible. If the external hard drive was formatted as EXT4 would there be a huge increase or is 10Mb/s acceptable for that drive? It's a WD My Passport drive. Probably not great but supposedly USB3.
Oh and why is it called Dirty? Is it written already and just has to be error checked to make it clean? I'm grasping at straws here:)
I think I understand it but maybe I have it wrong. I have been doing my annual backing up onto various external hard drives. I think this one is NTFS and mounted as fuse? The drive i'm copying off is an SSD formatted as EXT4 and I am using Linux Mint 20.3.
Earlier on today I copied a 4Gb file onto it with Midnight Commander at 150Mb/s and it took a few seconds. I watched the output of the above command and the Dirty value was decreasing to zero at about the same rate, give or take 150Mb/s. The light on the hard disk stopped flashing when it got to zero. Like in total 30 seconds for that file. I did it with another file and same thing. Now it isn't and I am wondering why.
I just copied a 5Gb file with midnight commander to the external hard disk and the Dirty is decreasing at about 10Mb/s. Why? Midnight Commander showed the file being copied at 150Mb/s but I presume it is copying it to the cache and then the cache has to be copied to the hard disk. I know the cache is about 8Gb because there is a huge slowdown when I copy more than that. It just has me puzzled, like why earlier would it do both operations at a fast speed and now not? Is there something I can change to get it to write faster? Obviously I want it copied as quickly as possible. If the external hard drive was formatted as EXT4 would there be a huge increase or is 10Mb/s acceptable for that drive? It's a WD My Passport drive. Probably not great but supposedly USB3.
Oh and why is it called Dirty? Is it written already and just has to be error checked to make it clean? I'm grasping at straws here:)