Large delay starting “dd” write in background in bash even when using nohupbash: variable loses value at end of while read loopLinux software raid fails to include one device for one RAID1 arrayLinux page cache slows down IO on dual cpu server with 64GB ramWhere did my memory go on linux (no cache/slab/shm/ipcs)CentOS 7: Getting interface IP numbersExecute custom monit script upon failure to restart the processWrite cache settings not workingApache upload scanner not working as intendeddd's relation with page cacheWhat is the difference between $$ and $! when using /bin/bash -c
Is it safe to keep the GPU on 100% utilization for a very long time?
How can I test a shell script in a "safe environment" to avoid harm to my computer?
Do these creatures from the Tomb of Annihilation campaign speak Common?
Is there an idiom that means "revealing a secret unintentionally"?
logo selection for poster presentation
GLM: Modelling proportional data - account for variation in total sample size
Identity of a supposed anonymous referee revealed through "Description" of the report
Are there vaccine ingredients which may not be disclosed ("hidden", "trade secret", or similar)?
When was it publicly revealed that a KH-11 spy satellite took pictures of the first Shuttle flight?
I'm attempting to understand my 401k match and how much I need to contribute to maximize the match
Creating Stored Procedure in local db that references tables in linked server
How long can fsck take on a 30 TB volume?
Do oversize pulley wheels increase derailleur capacity?
Where do 5 or more U.S. counties meet in a single point?
How is it believable that Euron could so easily pull off this ambush?
mini sub panel?
Cyclic queue using an array in C#
Using mean length and mean weight to calculate mean BMI?
What is the oldest instrument ever?
Why is it wrong to *implement* myself a known, published, widely believed to be secure crypto algorithm?
Visual Studio Code download existing code
Why is the episode called "The Last of the Starks"?
Why are thrust reversers not used down to taxi speeds?
What's the difference between "ricochet" and "bounce"?
Large delay starting “dd” write in background in bash even when using nohup
bash: variable loses value at end of while read loopLinux software raid fails to include one device for one RAID1 arrayLinux page cache slows down IO on dual cpu server with 64GB ramWhere did my memory go on linux (no cache/slab/shm/ipcs)CentOS 7: Getting interface IP numbersExecute custom monit script upon failure to restart the processWrite cache settings not workingApache upload scanner not working as intendeddd's relation with page cacheWhat is the difference between $$ and $! when using /bin/bash -c
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I wrote a small script to print the memory usage during a large sequential write of a file.
#!/bin/bash
rm result
echo 3 > /proc/sys/vm/drop_caches
sync;
echo start
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
for i in 1..200
do
sleep 0.2
cat /proc/meminfo | grep Dirty >> result
cat /proc/meminfo | grep Dirty
done
cat nohup.out
cat result
I should see the increase of the "Dirty" size from the beginning of the run. But when I ran the script, I often see a big delay (up to several seconds), during which the "Dirty" size does not increase, which possibly means the start of "dd" program is delayed. A sample problematic output is:
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 16528 kB
Dirty: 140608 kB
Dirty: 277228 kB
Dirty: 311768 kB
Dirty: 434308 kB
Dirty: 563352 kB
Dirty: 690952 kB
...
The length of the delay is uncertain, sometimes there's no delay at all. And in contrast, when I ran
time dd if=/dev/zero of=mem bs=1M count=2000
with some real time meminfo viewer, such as:
#!/bin/bash
clear
while true
do
sleep 0.2
tput home
cat /proc/meminfo
done
I always see the "Dirty" size increases immediately. Is there something wrong with my script? I also doubt about how the "write" operation is executed by the OS, because I also tested the file read and detected the "Cached" field in /proc/meminfo, and it seems to have no delay at all.
Thanks,
linux bash dd write
add a comment |
I wrote a small script to print the memory usage during a large sequential write of a file.
#!/bin/bash
rm result
echo 3 > /proc/sys/vm/drop_caches
sync;
echo start
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
for i in 1..200
do
sleep 0.2
cat /proc/meminfo | grep Dirty >> result
cat /proc/meminfo | grep Dirty
done
cat nohup.out
cat result
I should see the increase of the "Dirty" size from the beginning of the run. But when I ran the script, I often see a big delay (up to several seconds), during which the "Dirty" size does not increase, which possibly means the start of "dd" program is delayed. A sample problematic output is:
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 16528 kB
Dirty: 140608 kB
Dirty: 277228 kB
Dirty: 311768 kB
Dirty: 434308 kB
Dirty: 563352 kB
Dirty: 690952 kB
...
The length of the delay is uncertain, sometimes there's no delay at all. And in contrast, when I ran
time dd if=/dev/zero of=mem bs=1M count=2000
with some real time meminfo viewer, such as:
#!/bin/bash
clear
while true
do
sleep 0.2
tput home
cat /proc/meminfo
done
I always see the "Dirty" size increases immediately. Is there something wrong with my script? I also doubt about how the "write" operation is executed by the OS, because I also tested the file read and detected the "Cached" field in /proc/meminfo, and it seems to have no delay at all.
Thanks,
linux bash dd write
at linuxinsight.com/proc_sys_vm_drop_caches.html it says thatsync
should run first
– quamis
Nov 8 '11 at 21:38
just wanted to point out that you can combine your two cats into one line with tee: cat /proc/meminfo | grep Dirty | tee -a result; this would append to 'result' and also output to STDOUT. Just FYI :)
– Jan Wikholm
Jul 22 '13 at 7:34
Doesn't the "Dirty" size only reflect data that hasn't actually been written yet? Is there a way to take the data that has been written into account?
– rakslice
Jan 27 at 23:16
add a comment |
I wrote a small script to print the memory usage during a large sequential write of a file.
#!/bin/bash
rm result
echo 3 > /proc/sys/vm/drop_caches
sync;
echo start
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
for i in 1..200
do
sleep 0.2
cat /proc/meminfo | grep Dirty >> result
cat /proc/meminfo | grep Dirty
done
cat nohup.out
cat result
I should see the increase of the "Dirty" size from the beginning of the run. But when I ran the script, I often see a big delay (up to several seconds), during which the "Dirty" size does not increase, which possibly means the start of "dd" program is delayed. A sample problematic output is:
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 16528 kB
Dirty: 140608 kB
Dirty: 277228 kB
Dirty: 311768 kB
Dirty: 434308 kB
Dirty: 563352 kB
Dirty: 690952 kB
...
The length of the delay is uncertain, sometimes there's no delay at all. And in contrast, when I ran
time dd if=/dev/zero of=mem bs=1M count=2000
with some real time meminfo viewer, such as:
#!/bin/bash
clear
while true
do
sleep 0.2
tput home
cat /proc/meminfo
done
I always see the "Dirty" size increases immediately. Is there something wrong with my script? I also doubt about how the "write" operation is executed by the OS, because I also tested the file read and detected the "Cached" field in /proc/meminfo, and it seems to have no delay at all.
Thanks,
linux bash dd write
I wrote a small script to print the memory usage during a large sequential write of a file.
#!/bin/bash
rm result
echo 3 > /proc/sys/vm/drop_caches
sync;
echo start
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
for i in 1..200
do
sleep 0.2
cat /proc/meminfo | grep Dirty >> result
cat /proc/meminfo | grep Dirty
done
cat nohup.out
cat result
I should see the increase of the "Dirty" size from the beginning of the run. But when I ran the script, I often see a big delay (up to several seconds), during which the "Dirty" size does not increase, which possibly means the start of "dd" program is delayed. A sample problematic output is:
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 20 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 24 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 28 kB
Dirty: 16528 kB
Dirty: 140608 kB
Dirty: 277228 kB
Dirty: 311768 kB
Dirty: 434308 kB
Dirty: 563352 kB
Dirty: 690952 kB
...
The length of the delay is uncertain, sometimes there's no delay at all. And in contrast, when I ran
time dd if=/dev/zero of=mem bs=1M count=2000
with some real time meminfo viewer, such as:
#!/bin/bash
clear
while true
do
sleep 0.2
tput home
cat /proc/meminfo
done
I always see the "Dirty" size increases immediately. Is there something wrong with my script? I also doubt about how the "write" operation is executed by the OS, because I also tested the file read and detected the "Cached" field in /proc/meminfo, and it seems to have no delay at all.
Thanks,
linux bash dd write
linux bash dd write
asked Nov 8 '11 at 21:30
yonggangyonggang
236
236
at linuxinsight.com/proc_sys_vm_drop_caches.html it says thatsync
should run first
– quamis
Nov 8 '11 at 21:38
just wanted to point out that you can combine your two cats into one line with tee: cat /proc/meminfo | grep Dirty | tee -a result; this would append to 'result' and also output to STDOUT. Just FYI :)
– Jan Wikholm
Jul 22 '13 at 7:34
Doesn't the "Dirty" size only reflect data that hasn't actually been written yet? Is there a way to take the data that has been written into account?
– rakslice
Jan 27 at 23:16
add a comment |
at linuxinsight.com/proc_sys_vm_drop_caches.html it says thatsync
should run first
– quamis
Nov 8 '11 at 21:38
just wanted to point out that you can combine your two cats into one line with tee: cat /proc/meminfo | grep Dirty | tee -a result; this would append to 'result' and also output to STDOUT. Just FYI :)
– Jan Wikholm
Jul 22 '13 at 7:34
Doesn't the "Dirty" size only reflect data that hasn't actually been written yet? Is there a way to take the data that has been written into account?
– rakslice
Jan 27 at 23:16
at linuxinsight.com/proc_sys_vm_drop_caches.html it says that
sync
should run first– quamis
Nov 8 '11 at 21:38
at linuxinsight.com/proc_sys_vm_drop_caches.html it says that
sync
should run first– quamis
Nov 8 '11 at 21:38
just wanted to point out that you can combine your two cats into one line with tee: cat /proc/meminfo | grep Dirty | tee -a result; this would append to 'result' and also output to STDOUT. Just FYI :)
– Jan Wikholm
Jul 22 '13 at 7:34
just wanted to point out that you can combine your two cats into one line with tee: cat /proc/meminfo | grep Dirty | tee -a result; this would append to 'result' and also output to STDOUT. Just FYI :)
– Jan Wikholm
Jul 22 '13 at 7:34
Doesn't the "Dirty" size only reflect data that hasn't actually been written yet? Is there a way to take the data that has been written into account?
– rakslice
Jan 27 at 23:16
Doesn't the "Dirty" size only reflect data that hasn't actually been written yet? Is there a way to take the data that has been written into account?
– rakslice
Jan 27 at 23:16
add a comment |
3 Answers
3
active
oldest
votes
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
do you have a "time" binary on your system? otherwise nohup wouldn't know how to run a bash internal by itself and it will fail
Yes I have the time binary: root@yonggang-laptop:/# which time /usr/bin/time
– yonggang
Nov 8 '11 at 22:04
it may be because vm is dropping the caches while dd is running, for a while (those few seconds). I didn't check drop_caches handler, I am just assuming. I suppose if you comment the vm dropcaches enabler in your script you'll see dirty bufs size increasing faster?
– user237419
Nov 8 '11 at 22:11
Thanks for the reply. But that's not where the problem comes from, either. I have commented both the dropcaches and sync, and made sure the machine has finished flushing or freeing the pages before starting to write, but the big delays still exist.
– yonggang
Nov 8 '11 at 23:43
add a comment |
You can determine what is taking up the additional time by either invoking the script with
/bin/bash -x /path/to/script
and watching the output. This will print each line of code of the script as it executes. Alternatively you could preface each command with the time command and what is taking the additional time will become readily apparent.
add a comment |
Can you please reboot the system and make sure not too much write happening post restart at least from application side, now try to execute your dd command, reason is if you want to test write operations system should be clean and stable.
Your delay will depend on what kind of fs parameters and type of filesystem you are going to use.
Hope this will help.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fserverfault.com%2fquestions%2f329065%2flarge-delay-starting-dd-write-in-background-in-bash-even-when-using-nohup%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
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
do you have a "time" binary on your system? otherwise nohup wouldn't know how to run a bash internal by itself and it will fail
Yes I have the time binary: root@yonggang-laptop:/# which time /usr/bin/time
– yonggang
Nov 8 '11 at 22:04
it may be because vm is dropping the caches while dd is running, for a while (those few seconds). I didn't check drop_caches handler, I am just assuming. I suppose if you comment the vm dropcaches enabler in your script you'll see dirty bufs size increasing faster?
– user237419
Nov 8 '11 at 22:11
Thanks for the reply. But that's not where the problem comes from, either. I have commented both the dropcaches and sync, and made sure the machine has finished flushing or freeing the pages before starting to write, but the big delays still exist.
– yonggang
Nov 8 '11 at 23:43
add a comment |
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
do you have a "time" binary on your system? otherwise nohup wouldn't know how to run a bash internal by itself and it will fail
Yes I have the time binary: root@yonggang-laptop:/# which time /usr/bin/time
– yonggang
Nov 8 '11 at 22:04
it may be because vm is dropping the caches while dd is running, for a while (those few seconds). I didn't check drop_caches handler, I am just assuming. I suppose if you comment the vm dropcaches enabler in your script you'll see dirty bufs size increasing faster?
– user237419
Nov 8 '11 at 22:11
Thanks for the reply. But that's not where the problem comes from, either. I have commented both the dropcaches and sync, and made sure the machine has finished flushing or freeing the pages before starting to write, but the big delays still exist.
– yonggang
Nov 8 '11 at 23:43
add a comment |
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
do you have a "time" binary on your system? otherwise nohup wouldn't know how to run a bash internal by itself and it will fail
nohup time dd if=/dev/zero of=mem bs=1M count=2000 &
do you have a "time" binary on your system? otherwise nohup wouldn't know how to run a bash internal by itself and it will fail
answered Nov 8 '11 at 21:59
user237419user237419
1,56578
1,56578
Yes I have the time binary: root@yonggang-laptop:/# which time /usr/bin/time
– yonggang
Nov 8 '11 at 22:04
it may be because vm is dropping the caches while dd is running, for a while (those few seconds). I didn't check drop_caches handler, I am just assuming. I suppose if you comment the vm dropcaches enabler in your script you'll see dirty bufs size increasing faster?
– user237419
Nov 8 '11 at 22:11
Thanks for the reply. But that's not where the problem comes from, either. I have commented both the dropcaches and sync, and made sure the machine has finished flushing or freeing the pages before starting to write, but the big delays still exist.
– yonggang
Nov 8 '11 at 23:43
add a comment |
Yes I have the time binary: root@yonggang-laptop:/# which time /usr/bin/time
– yonggang
Nov 8 '11 at 22:04
it may be because vm is dropping the caches while dd is running, for a while (those few seconds). I didn't check drop_caches handler, I am just assuming. I suppose if you comment the vm dropcaches enabler in your script you'll see dirty bufs size increasing faster?
– user237419
Nov 8 '11 at 22:11
Thanks for the reply. But that's not where the problem comes from, either. I have commented both the dropcaches and sync, and made sure the machine has finished flushing or freeing the pages before starting to write, but the big delays still exist.
– yonggang
Nov 8 '11 at 23:43
Yes I have the time binary: root@yonggang-laptop:/# which time /usr/bin/time
– yonggang
Nov 8 '11 at 22:04
Yes I have the time binary: root@yonggang-laptop:/# which time /usr/bin/time
– yonggang
Nov 8 '11 at 22:04
it may be because vm is dropping the caches while dd is running, for a while (those few seconds). I didn't check drop_caches handler, I am just assuming. I suppose if you comment the vm dropcaches enabler in your script you'll see dirty bufs size increasing faster?
– user237419
Nov 8 '11 at 22:11
it may be because vm is dropping the caches while dd is running, for a while (those few seconds). I didn't check drop_caches handler, I am just assuming. I suppose if you comment the vm dropcaches enabler in your script you'll see dirty bufs size increasing faster?
– user237419
Nov 8 '11 at 22:11
Thanks for the reply. But that's not where the problem comes from, either. I have commented both the dropcaches and sync, and made sure the machine has finished flushing or freeing the pages before starting to write, but the big delays still exist.
– yonggang
Nov 8 '11 at 23:43
Thanks for the reply. But that's not where the problem comes from, either. I have commented both the dropcaches and sync, and made sure the machine has finished flushing or freeing the pages before starting to write, but the big delays still exist.
– yonggang
Nov 8 '11 at 23:43
add a comment |
You can determine what is taking up the additional time by either invoking the script with
/bin/bash -x /path/to/script
and watching the output. This will print each line of code of the script as it executes. Alternatively you could preface each command with the time command and what is taking the additional time will become readily apparent.
add a comment |
You can determine what is taking up the additional time by either invoking the script with
/bin/bash -x /path/to/script
and watching the output. This will print each line of code of the script as it executes. Alternatively you could preface each command with the time command and what is taking the additional time will become readily apparent.
add a comment |
You can determine what is taking up the additional time by either invoking the script with
/bin/bash -x /path/to/script
and watching the output. This will print each line of code of the script as it executes. Alternatively you could preface each command with the time command and what is taking the additional time will become readily apparent.
You can determine what is taking up the additional time by either invoking the script with
/bin/bash -x /path/to/script
and watching the output. This will print each line of code of the script as it executes. Alternatively you could preface each command with the time command and what is taking the additional time will become readily apparent.
answered Jan 9 '13 at 1:37
PrestonPreston
1795
1795
add a comment |
add a comment |
Can you please reboot the system and make sure not too much write happening post restart at least from application side, now try to execute your dd command, reason is if you want to test write operations system should be clean and stable.
Your delay will depend on what kind of fs parameters and type of filesystem you are going to use.
Hope this will help.
add a comment |
Can you please reboot the system and make sure not too much write happening post restart at least from application side, now try to execute your dd command, reason is if you want to test write operations system should be clean and stable.
Your delay will depend on what kind of fs parameters and type of filesystem you are going to use.
Hope this will help.
add a comment |
Can you please reboot the system and make sure not too much write happening post restart at least from application side, now try to execute your dd command, reason is if you want to test write operations system should be clean and stable.
Your delay will depend on what kind of fs parameters and type of filesystem you are going to use.
Hope this will help.
Can you please reboot the system and make sure not too much write happening post restart at least from application side, now try to execute your dd command, reason is if you want to test write operations system should be clean and stable.
Your delay will depend on what kind of fs parameters and type of filesystem you are going to use.
Hope this will help.
answered Apr 29 at 13:05
asktyagiasktyagi
1156
1156
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- 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%2fserverfault.com%2fquestions%2f329065%2flarge-delay-starting-dd-write-in-background-in-bash-even-when-using-nohup%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
at linuxinsight.com/proc_sys_vm_drop_caches.html it says that
sync
should run first– quamis
Nov 8 '11 at 21:38
just wanted to point out that you can combine your two cats into one line with tee: cat /proc/meminfo | grep Dirty | tee -a result; this would append to 'result' and also output to STDOUT. Just FYI :)
– Jan Wikholm
Jul 22 '13 at 7:34
Doesn't the "Dirty" size only reflect data that hasn't actually been written yet? Is there a way to take the data that has been written into account?
– rakslice
Jan 27 at 23:16