Find the answer to your Linux question:
Results 1 to 5 of 5
Learned about badblock from this post , and this post mentioned the importance of noting the time-to-complete. So how would I sequentially run the following commands with a way of ...
  1. #1
    Linux Newbie
    Join Date
    Mar 2004
    Posts
    185

    Question How to Combine a badblock Scan With a Time-To-Run Calculation?

    Learned about badblock from this post, and this post mentioned the importance of noting the time-to-complete.

    So how would I sequentially run the following commands with a way of measuring how long it took to complete each command:
    nohup badblocks -v /dev/sdx &
    (time-to-complete printed to screen)
    nohup badblocks -c 10240 -s -w -t random -v /dev/sdx &
    (time-to-complete printed to screen)

    Thanks for helping a scripting noob!
    DrCR

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Example:
    Code:
    nohup /usr/bin/time --portability badblocks -v /dev/sdx &
    That will give you an output like this (in nohup.out):
    Code:
    ... output from badblocks command ...
    real N.NN
    user N.NN
    sys N.NN
    where N.NN is the time in seconds.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Newbie
    Join Date
    Mar 2004
    Posts
    185
    Awesomeness, thanks. I'll give it a go when I get in the replacement drive (it had badblock errors). Thanks again.

  4. #4
    Linux Newbie
    Join Date
    Mar 2004
    Posts
    185

    Exclamation

    Quote Originally Posted by Rubberman View Post
    Example:
    Code:
    nohup /usr/bin/time --portability badblocks -v /dev/sdx &
    Hum, that didn't work for me, at least not for a different purpose I tried to apply it to below.
    Code:
    server:~# nohup /usr/bin/time --portability mkfs.jfs -c /dev/sda1 &
    [1] 24843
    server:~# nohup: ignoring input and appending output to `nohup.out'
    nohup: cannot run command `/usr/bin/time': No such file or directory
    Is the --portability part for nohup or time? I tried to search the man files, but I don't know how to access the additional documentation e.g. time(1) instead of time(7).

    What am I doing wrong? Thanks

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by DrCR View Post
    Hum, that didn't work for me, at least not for a different purpose I tried to apply it to below.
    Code:
    server:~# nohup /usr/bin/time --portability mkfs.jfs -c /dev/sda1 &
    [1] 24843
    server:~# nohup: ignoring input and appending output to `nohup.out'
    nohup: cannot run command `/usr/bin/time': No such file or directory
    Is the --portability part for nohup or time? I tried to search the man files, but I don't know how to access the additional documentation e.g. time(1) instead of time(7).

    What am I doing wrong? Thanks
    Most systems have 2 'time' programs - one builtin to the shell, and the other an executable. Usually it is found as /usr/bin/time, but on your system it might be elsewhere, such as in /bin. Find it and use that path instead of /usr/bin/time as I did in my example. BTW, which linux distribution+version and kernel version are you running?

    The --portability option is applied to the time command.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...