what is the difference between seek and skip in dd command?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












5














I am trying to read from the disk and wanted to dd command to issue every request random and check for the latency of the disk for the read operation I have used seek and skip both will that work ?



dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 skip=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.0287 s, 82.2 MB/s


dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 seek=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.364 s, 81.7 MB/s


can anybody suggest me with any new way to read from the disk ?










share|improve this question



















  • 2




    seek skips blocks on output, while skip skips blocks on input. You should probably use some dedicated benchmark program rather than dd.
    – Satō Katsura
    Sep 1 '16 at 10:26
















5














I am trying to read from the disk and wanted to dd command to issue every request random and check for the latency of the disk for the read operation I have used seek and skip both will that work ?



dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 skip=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.0287 s, 82.2 MB/s


dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 seek=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.364 s, 81.7 MB/s


can anybody suggest me with any new way to read from the disk ?










share|improve this question



















  • 2




    seek skips blocks on output, while skip skips blocks on input. You should probably use some dedicated benchmark program rather than dd.
    – Satō Katsura
    Sep 1 '16 at 10:26














5












5








5


2





I am trying to read from the disk and wanted to dd command to issue every request random and check for the latency of the disk for the read operation I have used seek and skip both will that work ?



dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 skip=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.0287 s, 82.2 MB/s


dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 seek=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.364 s, 81.7 MB/s


can anybody suggest me with any new way to read from the disk ?










share|improve this question















I am trying to read from the disk and wanted to dd command to issue every request random and check for the latency of the disk for the read operation I have used seek and skip both will that work ?



dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 skip=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.0287 s, 82.2 MB/s


dd if=/dev/rdsk/c2t5000CCA0284F36A4d0 seek=10 of=/dev/null bs=4k count=1024000
1024000+0 records in
1024000+0 records out
4194304000 bytes (4.2 GB) copied, 51.364 s, 81.7 MB/s


can anybody suggest me with any new way to read from the disk ?







linux hard-disk dd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 1 '16 at 10:23









Satō Katsura

10.9k11634




10.9k11634










asked Sep 1 '16 at 10:19









Sharan BasappaSharan Basappa

26112




26112







  • 2




    seek skips blocks on output, while skip skips blocks on input. You should probably use some dedicated benchmark program rather than dd.
    – Satō Katsura
    Sep 1 '16 at 10:26













  • 2




    seek skips blocks on output, while skip skips blocks on input. You should probably use some dedicated benchmark program rather than dd.
    – Satō Katsura
    Sep 1 '16 at 10:26








2




2




seek skips blocks on output, while skip skips blocks on input. You should probably use some dedicated benchmark program rather than dd.
– Satō Katsura
Sep 1 '16 at 10:26





seek skips blocks on output, while skip skips blocks on input. You should probably use some dedicated benchmark program rather than dd.
– Satō Katsura
Sep 1 '16 at 10:26











3 Answers
3






active

oldest

votes


















15














skip (also known as iseek in some dd implementations) moves current pointer of the input stream while seek moves current pointer in the output stream.



Thus, by using skip you could ignore some data at the beginning of the input stream.



The seek is usually used (but not always) in conjunction with conv=notrunc to preserve some data existing at the beginning of the output stream.






share|improve this answer






























    4














    From the man page of dd



    seek=BLOCKS
    skip BLOCKS obs-sized blocks at start of output
    skip=BLOCKS
    skip BLOCKS ibs-sized blocks at start of input


    That can be rephrased as,



    seek skips n blocks from the beginning of the output file.



    skip skips n blocks from the beginning of the input file.






    share|improve this answer




























      0














      The following example first prepares an input file and an output file, then copies a portion of the input into a portion of the output file.



      echo "IGNORE:My Dear Friend:IGNORE" > infile
      echo "Keep this, OVERWRITE THIS, keep this." > outfile
      cat infile
      cat outfile
      echo
      dd status=none
      bs=1
      if=infile
      skip=7
      count=14
      of=outfile
      conv=notrunc
      seek=11

      cat outfile


      The arguments to dd are:



      status=none Don't output final statistics as dd usually does - would disturb the demo
      bs=1 All the following numbers are counts of bytes -- i.e., 1-byte blocks.
      if=infile The input file
      skip=7 Ignore the first 7 bytes of input (skip "IGNORE:")
      count=14 Transfer 14 bytes from input to output
      of=outfile What file to write into
      conv=notrunc Don't delete old contents of the output file before writing.
      seek=11 Don't overwrite the first 11 bytes of the output file
      i.e., leave them in place and start writing after them


      The result of running the script is:



      IGNORE:My Dear Friend:IGNORE
      Keep this, OVERWRITE THIS, keep this.

      Keep this, My Dear Friend, keep this.


      What would happen if you exchanged the values of 'skip' and 'seek'?
      dd would copy the wrong part of the input and overwrite the wrong part of the output file:



      Keep thear Friend:IGNTHIS, keep this.





      share|improve this answer




















        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
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f307186%2fwhat-is-the-difference-between-seek-and-skip-in-dd-command%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









        15














        skip (also known as iseek in some dd implementations) moves current pointer of the input stream while seek moves current pointer in the output stream.



        Thus, by using skip you could ignore some data at the beginning of the input stream.



        The seek is usually used (but not always) in conjunction with conv=notrunc to preserve some data existing at the beginning of the output stream.






        share|improve this answer



























          15














          skip (also known as iseek in some dd implementations) moves current pointer of the input stream while seek moves current pointer in the output stream.



          Thus, by using skip you could ignore some data at the beginning of the input stream.



          The seek is usually used (but not always) in conjunction with conv=notrunc to preserve some data existing at the beginning of the output stream.






          share|improve this answer

























            15












            15








            15






            skip (also known as iseek in some dd implementations) moves current pointer of the input stream while seek moves current pointer in the output stream.



            Thus, by using skip you could ignore some data at the beginning of the input stream.



            The seek is usually used (but not always) in conjunction with conv=notrunc to preserve some data existing at the beginning of the output stream.






            share|improve this answer














            skip (also known as iseek in some dd implementations) moves current pointer of the input stream while seek moves current pointer in the output stream.



            Thus, by using skip you could ignore some data at the beginning of the input stream.



            The seek is usually used (but not always) in conjunction with conv=notrunc to preserve some data existing at the beginning of the output stream.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 28 '18 at 0:43









            Stéphane Chazelas

            300k54564916




            300k54564916










            answered Sep 1 '16 at 10:29









            SergeSerge

            5,59521325




            5,59521325























                4














                From the man page of dd



                seek=BLOCKS
                skip BLOCKS obs-sized blocks at start of output
                skip=BLOCKS
                skip BLOCKS ibs-sized blocks at start of input


                That can be rephrased as,



                seek skips n blocks from the beginning of the output file.



                skip skips n blocks from the beginning of the input file.






                share|improve this answer

























                  4














                  From the man page of dd



                  seek=BLOCKS
                  skip BLOCKS obs-sized blocks at start of output
                  skip=BLOCKS
                  skip BLOCKS ibs-sized blocks at start of input


                  That can be rephrased as,



                  seek skips n blocks from the beginning of the output file.



                  skip skips n blocks from the beginning of the input file.






                  share|improve this answer























                    4












                    4








                    4






                    From the man page of dd



                    seek=BLOCKS
                    skip BLOCKS obs-sized blocks at start of output
                    skip=BLOCKS
                    skip BLOCKS ibs-sized blocks at start of input


                    That can be rephrased as,



                    seek skips n blocks from the beginning of the output file.



                    skip skips n blocks from the beginning of the input file.






                    share|improve this answer












                    From the man page of dd



                    seek=BLOCKS
                    skip BLOCKS obs-sized blocks at start of output
                    skip=BLOCKS
                    skip BLOCKS ibs-sized blocks at start of input


                    That can be rephrased as,



                    seek skips n blocks from the beginning of the output file.



                    skip skips n blocks from the beginning of the input file.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Sep 1 '16 at 10:29









                    ThushiThushi

                    6,36921238




                    6,36921238





















                        0














                        The following example first prepares an input file and an output file, then copies a portion of the input into a portion of the output file.



                        echo "IGNORE:My Dear Friend:IGNORE" > infile
                        echo "Keep this, OVERWRITE THIS, keep this." > outfile
                        cat infile
                        cat outfile
                        echo
                        dd status=none
                        bs=1
                        if=infile
                        skip=7
                        count=14
                        of=outfile
                        conv=notrunc
                        seek=11

                        cat outfile


                        The arguments to dd are:



                        status=none Don't output final statistics as dd usually does - would disturb the demo
                        bs=1 All the following numbers are counts of bytes -- i.e., 1-byte blocks.
                        if=infile The input file
                        skip=7 Ignore the first 7 bytes of input (skip "IGNORE:")
                        count=14 Transfer 14 bytes from input to output
                        of=outfile What file to write into
                        conv=notrunc Don't delete old contents of the output file before writing.
                        seek=11 Don't overwrite the first 11 bytes of the output file
                        i.e., leave them in place and start writing after them


                        The result of running the script is:



                        IGNORE:My Dear Friend:IGNORE
                        Keep this, OVERWRITE THIS, keep this.

                        Keep this, My Dear Friend, keep this.


                        What would happen if you exchanged the values of 'skip' and 'seek'?
                        dd would copy the wrong part of the input and overwrite the wrong part of the output file:



                        Keep thear Friend:IGNTHIS, keep this.





                        share|improve this answer

























                          0














                          The following example first prepares an input file and an output file, then copies a portion of the input into a portion of the output file.



                          echo "IGNORE:My Dear Friend:IGNORE" > infile
                          echo "Keep this, OVERWRITE THIS, keep this." > outfile
                          cat infile
                          cat outfile
                          echo
                          dd status=none
                          bs=1
                          if=infile
                          skip=7
                          count=14
                          of=outfile
                          conv=notrunc
                          seek=11

                          cat outfile


                          The arguments to dd are:



                          status=none Don't output final statistics as dd usually does - would disturb the demo
                          bs=1 All the following numbers are counts of bytes -- i.e., 1-byte blocks.
                          if=infile The input file
                          skip=7 Ignore the first 7 bytes of input (skip "IGNORE:")
                          count=14 Transfer 14 bytes from input to output
                          of=outfile What file to write into
                          conv=notrunc Don't delete old contents of the output file before writing.
                          seek=11 Don't overwrite the first 11 bytes of the output file
                          i.e., leave them in place and start writing after them


                          The result of running the script is:



                          IGNORE:My Dear Friend:IGNORE
                          Keep this, OVERWRITE THIS, keep this.

                          Keep this, My Dear Friend, keep this.


                          What would happen if you exchanged the values of 'skip' and 'seek'?
                          dd would copy the wrong part of the input and overwrite the wrong part of the output file:



                          Keep thear Friend:IGNTHIS, keep this.





                          share|improve this answer























                            0












                            0








                            0






                            The following example first prepares an input file and an output file, then copies a portion of the input into a portion of the output file.



                            echo "IGNORE:My Dear Friend:IGNORE" > infile
                            echo "Keep this, OVERWRITE THIS, keep this." > outfile
                            cat infile
                            cat outfile
                            echo
                            dd status=none
                            bs=1
                            if=infile
                            skip=7
                            count=14
                            of=outfile
                            conv=notrunc
                            seek=11

                            cat outfile


                            The arguments to dd are:



                            status=none Don't output final statistics as dd usually does - would disturb the demo
                            bs=1 All the following numbers are counts of bytes -- i.e., 1-byte blocks.
                            if=infile The input file
                            skip=7 Ignore the first 7 bytes of input (skip "IGNORE:")
                            count=14 Transfer 14 bytes from input to output
                            of=outfile What file to write into
                            conv=notrunc Don't delete old contents of the output file before writing.
                            seek=11 Don't overwrite the first 11 bytes of the output file
                            i.e., leave them in place and start writing after them


                            The result of running the script is:



                            IGNORE:My Dear Friend:IGNORE
                            Keep this, OVERWRITE THIS, keep this.

                            Keep this, My Dear Friend, keep this.


                            What would happen if you exchanged the values of 'skip' and 'seek'?
                            dd would copy the wrong part of the input and overwrite the wrong part of the output file:



                            Keep thear Friend:IGNTHIS, keep this.





                            share|improve this answer












                            The following example first prepares an input file and an output file, then copies a portion of the input into a portion of the output file.



                            echo "IGNORE:My Dear Friend:IGNORE" > infile
                            echo "Keep this, OVERWRITE THIS, keep this." > outfile
                            cat infile
                            cat outfile
                            echo
                            dd status=none
                            bs=1
                            if=infile
                            skip=7
                            count=14
                            of=outfile
                            conv=notrunc
                            seek=11

                            cat outfile


                            The arguments to dd are:



                            status=none Don't output final statistics as dd usually does - would disturb the demo
                            bs=1 All the following numbers are counts of bytes -- i.e., 1-byte blocks.
                            if=infile The input file
                            skip=7 Ignore the first 7 bytes of input (skip "IGNORE:")
                            count=14 Transfer 14 bytes from input to output
                            of=outfile What file to write into
                            conv=notrunc Don't delete old contents of the output file before writing.
                            seek=11 Don't overwrite the first 11 bytes of the output file
                            i.e., leave them in place and start writing after them


                            The result of running the script is:



                            IGNORE:My Dear Friend:IGNORE
                            Keep this, OVERWRITE THIS, keep this.

                            Keep this, My Dear Friend, keep this.


                            What would happen if you exchanged the values of 'skip' and 'seek'?
                            dd would copy the wrong part of the input and overwrite the wrong part of the output file:



                            Keep thear Friend:IGNTHIS, keep this.






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Dec 28 '18 at 0:11









                            Enrique Perez-TerronEnrique Perez-Terron

                            1




                            1



























                                draft saved

                                draft discarded
















































                                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.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • 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.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f307186%2fwhat-is-the-difference-between-seek-and-skip-in-dd-command%23new-answer', 'question_page');

                                );

                                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