Does du or df perform caching?How to cache or otherwise speed up `du` summaries?Find and differences between...
How to supply water to a coastal desert town with no rain and no freshwater aquifers?
Is this car delivery via Ebay Motors on Craigslist a scam?
Why did moving the mouse cursor cause Windows 95 to run more quickly?
Find max number you can create from an array of numbers
How do I check that users don't write down their passwords?
Has there ever been a cold war other than between the U.S. and the U.S.S.R.?
Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?
Is this standard Japanese employment negotiations, or am I missing something?
How can I create a dashed line that slowly changes into a solid line in Illustrator?
Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?
Lie bracket of vector fields in Penrose's abstract index notation
Does the Milky Way orbit around anything?
How would a sea turtle end up on its back?
Why would "dead languages" be the only languages that spells could be written in?
How important is it for multiple POVs to run chronologically?
What is exact meaning of “ich wäre gern”?
A positive integer functional equation
Is conquering your neighbors to fight a greater enemy a valid strategy?
Is it bad to suddenly introduce another element to your fantasy world a good ways into the story?
Can a USB hub be used to access a drive from 2 devices?
soda water first stored in refrigerator and then outside
Is there a standard definition of the "stall" phenomena?
Why do Klingons use cloaking devices?
What are some bad ways to subvert tropes?
Does du or df perform caching?
How to cache or otherwise speed up `du` summaries?Find and differences between -perm /6000 and -perm /u+sWill stat() cause an actual harddisk access or is the information cached?Can I mount a case-insensitive tmpfs/ramfs?How are the reserved GDT blocks used after online resizing in ext3 file systemGet consistent encoding for all files in directoryDoes Linux have any symlinks by default?Can't create *.o file on partitionIs it possible to give caching preferences to the filesystem?Find the size of all relevant caches when doing I/O
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I was wondering if there is any caching done with these utilities. I assume not, but not positive. Are there any typical similar utilities that do use caching to speed up results on subsequent runs?
files filesystems disk-usage
add a comment |
I was wondering if there is any caching done with these utilities. I assume not, but not positive. Are there any typical similar utilities that do use caching to speed up results on subsequent runs?
files filesystems disk-usage
I don't think that dd/df are doing the caching themselves but it rather some part of the kernel does that automatically
– Bonsi Scott
May 4 '14 at 20:49
Maybe you ask the question in view of an other problem. When a program writes large logfiles and keep the filedescriptors open, deleting the files will not help making space free. The ugly program still has 'locked'the filespace.
– Walter A
May 4 '14 at 21:24
@WalterA I am only asking out of curiosity, I dont have an issue with open file descriptors or unexpected output, but thank you.
– Gregg Leventhal
May 4 '14 at 22:12
add a comment |
I was wondering if there is any caching done with these utilities. I assume not, but not positive. Are there any typical similar utilities that do use caching to speed up results on subsequent runs?
files filesystems disk-usage
I was wondering if there is any caching done with these utilities. I assume not, but not positive. Are there any typical similar utilities that do use caching to speed up results on subsequent runs?
files filesystems disk-usage
files filesystems disk-usage
edited May 19 '14 at 21:27
derobert
77.8k8 gold badges171 silver badges229 bronze badges
77.8k8 gold badges171 silver badges229 bronze badges
asked May 4 '14 at 20:38
Gregg LeventhalGregg Leventhal
3,05413 gold badges46 silver badges78 bronze badges
3,05413 gold badges46 silver badges78 bronze badges
I don't think that dd/df are doing the caching themselves but it rather some part of the kernel does that automatically
– Bonsi Scott
May 4 '14 at 20:49
Maybe you ask the question in view of an other problem. When a program writes large logfiles and keep the filedescriptors open, deleting the files will not help making space free. The ugly program still has 'locked'the filespace.
– Walter A
May 4 '14 at 21:24
@WalterA I am only asking out of curiosity, I dont have an issue with open file descriptors or unexpected output, but thank you.
– Gregg Leventhal
May 4 '14 at 22:12
add a comment |
I don't think that dd/df are doing the caching themselves but it rather some part of the kernel does that automatically
– Bonsi Scott
May 4 '14 at 20:49
Maybe you ask the question in view of an other problem. When a program writes large logfiles and keep the filedescriptors open, deleting the files will not help making space free. The ugly program still has 'locked'the filespace.
– Walter A
May 4 '14 at 21:24
@WalterA I am only asking out of curiosity, I dont have an issue with open file descriptors or unexpected output, but thank you.
– Gregg Leventhal
May 4 '14 at 22:12
I don't think that dd/df are doing the caching themselves but it rather some part of the kernel does that automatically
– Bonsi Scott
May 4 '14 at 20:49
I don't think that dd/df are doing the caching themselves but it rather some part of the kernel does that automatically
– Bonsi Scott
May 4 '14 at 20:49
Maybe you ask the question in view of an other problem. When a program writes large logfiles and keep the filedescriptors open, deleting the files will not help making space free. The ugly program still has 'locked'the filespace.
– Walter A
May 4 '14 at 21:24
Maybe you ask the question in view of an other problem. When a program writes large logfiles and keep the filedescriptors open, deleting the files will not help making space free. The ugly program still has 'locked'the filespace.
– Walter A
May 4 '14 at 21:24
@WalterA I am only asking out of curiosity, I dont have an issue with open file descriptors or unexpected output, but thank you.
– Gregg Leventhal
May 4 '14 at 22:12
@WalterA I am only asking out of curiosity, I dont have an issue with open file descriptors or unexpected output, but thank you.
– Gregg Leventhal
May 4 '14 at 22:12
add a comment |
3 Answers
3
active
oldest
votes
There is no need for caching in df
as df
does a single statfs()
call (per filesystem). And obviously this call does read files on disk and sum up their sizes... The filesystems (e.g. the kernel) keep track of the free space.
du
uses (without being aware of that) the page cache all applications use. In order to cache explicitly between runs there would have to be a "du daemon" anyway.
du
could have a cache without a daemon. All it has to do is store the directory sizes in a file somewhere, and then read back that file on next run. (not saying it does, just saying a daemon is not needed)
– Patrick
May 4 '14 at 21:56
@Patrick But without something like inotify this would make caching a probability game.
– Hauke Laging
May 4 '14 at 21:59
Ah, thats why you meant daemon, so it could monitor real time. Yes, agree :-)
– Patrick
May 4 '14 at 22:00
add a comment |
There is caching at some level (command or perhaps OS or FS-driver level - probably one of the latter two if you ask me), although forgive me for not knowing more details:
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.03s system 32% cpu 0.112 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 82% cpu 0.015 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 86% cpu 0.014 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.01s system 78% cpu 0.020 total
Results obtained on Ubuntu 15.04 with ext4 filesystem, kernel version 3.19.0-15-generic.
add a comment |
confirm, it caches
see this:
$du -sh testUpload.txt
104M testUpload.txt
$ dd if=/dev/zero of=/tmp/testUpload.txt bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0248501 s, 2.1 GB/s
$ du -sh testUpload.txt
104M testUpload.txt
$ du -sh testUpload.txt
104M testUpload.txt
$ ls -al testUpload.txt
-rw-rw-rw- 1 alfred alfred 52428800 Jul 4 11:50 testUpload.txt
New contributor
Cannot reproduce. What system is this? What filesystem is/tmp
? Whichdu
is it?
– muru
48 mins ago
1
What is this supposed to be showing?
– Scott
44 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f127846%2fdoes-du-or-df-perform-caching%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no need for caching in df
as df
does a single statfs()
call (per filesystem). And obviously this call does read files on disk and sum up their sizes... The filesystems (e.g. the kernel) keep track of the free space.
du
uses (without being aware of that) the page cache all applications use. In order to cache explicitly between runs there would have to be a "du daemon" anyway.
du
could have a cache without a daemon. All it has to do is store the directory sizes in a file somewhere, and then read back that file on next run. (not saying it does, just saying a daemon is not needed)
– Patrick
May 4 '14 at 21:56
@Patrick But without something like inotify this would make caching a probability game.
– Hauke Laging
May 4 '14 at 21:59
Ah, thats why you meant daemon, so it could monitor real time. Yes, agree :-)
– Patrick
May 4 '14 at 22:00
add a comment |
There is no need for caching in df
as df
does a single statfs()
call (per filesystem). And obviously this call does read files on disk and sum up their sizes... The filesystems (e.g. the kernel) keep track of the free space.
du
uses (without being aware of that) the page cache all applications use. In order to cache explicitly between runs there would have to be a "du daemon" anyway.
du
could have a cache without a daemon. All it has to do is store the directory sizes in a file somewhere, and then read back that file on next run. (not saying it does, just saying a daemon is not needed)
– Patrick
May 4 '14 at 21:56
@Patrick But without something like inotify this would make caching a probability game.
– Hauke Laging
May 4 '14 at 21:59
Ah, thats why you meant daemon, so it could monitor real time. Yes, agree :-)
– Patrick
May 4 '14 at 22:00
add a comment |
There is no need for caching in df
as df
does a single statfs()
call (per filesystem). And obviously this call does read files on disk and sum up their sizes... The filesystems (e.g. the kernel) keep track of the free space.
du
uses (without being aware of that) the page cache all applications use. In order to cache explicitly between runs there would have to be a "du daemon" anyway.
There is no need for caching in df
as df
does a single statfs()
call (per filesystem). And obviously this call does read files on disk and sum up their sizes... The filesystems (e.g. the kernel) keep track of the free space.
du
uses (without being aware of that) the page cache all applications use. In order to cache explicitly between runs there would have to be a "du daemon" anyway.
answered May 4 '14 at 21:55
Hauke LagingHauke Laging
59.1k12 gold badges93 silver badges138 bronze badges
59.1k12 gold badges93 silver badges138 bronze badges
du
could have a cache without a daemon. All it has to do is store the directory sizes in a file somewhere, and then read back that file on next run. (not saying it does, just saying a daemon is not needed)
– Patrick
May 4 '14 at 21:56
@Patrick But without something like inotify this would make caching a probability game.
– Hauke Laging
May 4 '14 at 21:59
Ah, thats why you meant daemon, so it could monitor real time. Yes, agree :-)
– Patrick
May 4 '14 at 22:00
add a comment |
du
could have a cache without a daemon. All it has to do is store the directory sizes in a file somewhere, and then read back that file on next run. (not saying it does, just saying a daemon is not needed)
– Patrick
May 4 '14 at 21:56
@Patrick But without something like inotify this would make caching a probability game.
– Hauke Laging
May 4 '14 at 21:59
Ah, thats why you meant daemon, so it could monitor real time. Yes, agree :-)
– Patrick
May 4 '14 at 22:00
du
could have a cache without a daemon. All it has to do is store the directory sizes in a file somewhere, and then read back that file on next run. (not saying it does, just saying a daemon is not needed)– Patrick
May 4 '14 at 21:56
du
could have a cache without a daemon. All it has to do is store the directory sizes in a file somewhere, and then read back that file on next run. (not saying it does, just saying a daemon is not needed)– Patrick
May 4 '14 at 21:56
@Patrick But without something like inotify this would make caching a probability game.
– Hauke Laging
May 4 '14 at 21:59
@Patrick But without something like inotify this would make caching a probability game.
– Hauke Laging
May 4 '14 at 21:59
Ah, thats why you meant daemon, so it could monitor real time. Yes, agree :-)
– Patrick
May 4 '14 at 22:00
Ah, thats why you meant daemon, so it could monitor real time. Yes, agree :-)
– Patrick
May 4 '14 at 22:00
add a comment |
There is caching at some level (command or perhaps OS or FS-driver level - probably one of the latter two if you ask me), although forgive me for not knowing more details:
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.03s system 32% cpu 0.112 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 82% cpu 0.015 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 86% cpu 0.014 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.01s system 78% cpu 0.020 total
Results obtained on Ubuntu 15.04 with ext4 filesystem, kernel version 3.19.0-15-generic.
add a comment |
There is caching at some level (command or perhaps OS or FS-driver level - probably one of the latter two if you ask me), although forgive me for not knowing more details:
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.03s system 32% cpu 0.112 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 82% cpu 0.015 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 86% cpu 0.014 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.01s system 78% cpu 0.020 total
Results obtained on Ubuntu 15.04 with ext4 filesystem, kernel version 3.19.0-15-generic.
add a comment |
There is caching at some level (command or perhaps OS or FS-driver level - probably one of the latter two if you ask me), although forgive me for not knowing more details:
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.03s system 32% cpu 0.112 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 82% cpu 0.015 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 86% cpu 0.014 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.01s system 78% cpu 0.020 total
Results obtained on Ubuntu 15.04 with ext4 filesystem, kernel version 3.19.0-15-generic.
There is caching at some level (command or perhaps OS or FS-driver level - probably one of the latter two if you ask me), although forgive me for not knowing more details:
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.03s system 32% cpu 0.112 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 82% cpu 0.015 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.00s user 0.01s system 86% cpu 0.014 total
d@s7/mp3Ϡϡ time du -sh /mp3/
27G /mp3/
du -sh /mp3/ 0.01s user 0.01s system 78% cpu 0.020 total
Results obtained on Ubuntu 15.04 with ext4 filesystem, kernel version 3.19.0-15-generic.
edited Mar 17 '16 at 23:47
answered Mar 17 '16 at 23:36
djvsdjvs
1013 bronze badges
1013 bronze badges
add a comment |
add a comment |
confirm, it caches
see this:
$du -sh testUpload.txt
104M testUpload.txt
$ dd if=/dev/zero of=/tmp/testUpload.txt bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0248501 s, 2.1 GB/s
$ du -sh testUpload.txt
104M testUpload.txt
$ du -sh testUpload.txt
104M testUpload.txt
$ ls -al testUpload.txt
-rw-rw-rw- 1 alfred alfred 52428800 Jul 4 11:50 testUpload.txt
New contributor
Cannot reproduce. What system is this? What filesystem is/tmp
? Whichdu
is it?
– muru
48 mins ago
1
What is this supposed to be showing?
– Scott
44 mins ago
add a comment |
confirm, it caches
see this:
$du -sh testUpload.txt
104M testUpload.txt
$ dd if=/dev/zero of=/tmp/testUpload.txt bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0248501 s, 2.1 GB/s
$ du -sh testUpload.txt
104M testUpload.txt
$ du -sh testUpload.txt
104M testUpload.txt
$ ls -al testUpload.txt
-rw-rw-rw- 1 alfred alfred 52428800 Jul 4 11:50 testUpload.txt
New contributor
Cannot reproduce. What system is this? What filesystem is/tmp
? Whichdu
is it?
– muru
48 mins ago
1
What is this supposed to be showing?
– Scott
44 mins ago
add a comment |
confirm, it caches
see this:
$du -sh testUpload.txt
104M testUpload.txt
$ dd if=/dev/zero of=/tmp/testUpload.txt bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0248501 s, 2.1 GB/s
$ du -sh testUpload.txt
104M testUpload.txt
$ du -sh testUpload.txt
104M testUpload.txt
$ ls -al testUpload.txt
-rw-rw-rw- 1 alfred alfred 52428800 Jul 4 11:50 testUpload.txt
New contributor
confirm, it caches
see this:
$du -sh testUpload.txt
104M testUpload.txt
$ dd if=/dev/zero of=/tmp/testUpload.txt bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0248501 s, 2.1 GB/s
$ du -sh testUpload.txt
104M testUpload.txt
$ du -sh testUpload.txt
104M testUpload.txt
$ ls -al testUpload.txt
-rw-rw-rw- 1 alfred alfred 52428800 Jul 4 11:50 testUpload.txt
New contributor
edited 51 mins ago
muru
40.9k5 gold badges99 silver badges172 bronze badges
40.9k5 gold badges99 silver badges172 bronze badges
New contributor
answered 1 hour ago
alfredalfred
1
1
New contributor
New contributor
Cannot reproduce. What system is this? What filesystem is/tmp
? Whichdu
is it?
– muru
48 mins ago
1
What is this supposed to be showing?
– Scott
44 mins ago
add a comment |
Cannot reproduce. What system is this? What filesystem is/tmp
? Whichdu
is it?
– muru
48 mins ago
1
What is this supposed to be showing?
– Scott
44 mins ago
Cannot reproduce. What system is this? What filesystem is
/tmp
? Which du
is it?– muru
48 mins ago
Cannot reproduce. What system is this? What filesystem is
/tmp
? Which du
is it?– muru
48 mins ago
1
1
What is this supposed to be showing?
– Scott
44 mins ago
What is this supposed to be showing?
– Scott
44 mins ago
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f127846%2fdoes-du-or-df-perform-caching%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't think that dd/df are doing the caching themselves but it rather some part of the kernel does that automatically
– Bonsi Scott
May 4 '14 at 20:49
Maybe you ask the question in view of an other problem. When a program writes large logfiles and keep the filedescriptors open, deleting the files will not help making space free. The ugly program still has 'locked'the filespace.
– Walter A
May 4 '14 at 21:24
@WalterA I am only asking out of curiosity, I dont have an issue with open file descriptors or unexpected output, but thank you.
– Gregg Leventhal
May 4 '14 at 22:12