Android / Linux dd help! [closed]

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











up vote
-5
down vote

favorite












Can any one give me a simple example? The partition size is 4 MB but the data inside is 3.1 MB. I need to dd only the 3.1 MB.



dd if=/dev/block/partition of=/tmp/3.1mb.img bs= skip=


I'm confused about bs and skip. Hopefully an example can clarify it.







share|improve this question













closed as unclear what you're asking by Hauke Laging, Kusalananda, Jeff Schaller, Jesse_b, Kiwy May 4 at 6:29


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    Where in the 4MB partition is the 3.1MB that you're interested in? Beginning? End? Sprinkled throughout the partition?
    – Mark Plotnick
    May 3 at 18:51







  • 1




    What sort of embedded system are you on where 900KB is too much slack to bring along for the ride?
    – DopeGhoti
    May 3 at 18:52










  • What comprises 3.1MB that you want to copy? Is that a bunch of files? Your block size can be as small as 1 byte, and you can use as many in the count as you need. man dd should help.
    – ajeh
    May 3 at 22:24










  • Its actually a carrier partition in Android, actual size of partition is 23MB but data inside that partition incld some small files and folder is around 2.9MB so what i was trying is too just dd the actual data, instead of whole partition.
    – Rogers Drave
    May 5 at 1:45














up vote
-5
down vote

favorite












Can any one give me a simple example? The partition size is 4 MB but the data inside is 3.1 MB. I need to dd only the 3.1 MB.



dd if=/dev/block/partition of=/tmp/3.1mb.img bs= skip=


I'm confused about bs and skip. Hopefully an example can clarify it.







share|improve this question













closed as unclear what you're asking by Hauke Laging, Kusalananda, Jeff Schaller, Jesse_b, Kiwy May 4 at 6:29


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    Where in the 4MB partition is the 3.1MB that you're interested in? Beginning? End? Sprinkled throughout the partition?
    – Mark Plotnick
    May 3 at 18:51







  • 1




    What sort of embedded system are you on where 900KB is too much slack to bring along for the ride?
    – DopeGhoti
    May 3 at 18:52










  • What comprises 3.1MB that you want to copy? Is that a bunch of files? Your block size can be as small as 1 byte, and you can use as many in the count as you need. man dd should help.
    – ajeh
    May 3 at 22:24










  • Its actually a carrier partition in Android, actual size of partition is 23MB but data inside that partition incld some small files and folder is around 2.9MB so what i was trying is too just dd the actual data, instead of whole partition.
    – Rogers Drave
    May 5 at 1:45












up vote
-5
down vote

favorite









up vote
-5
down vote

favorite











Can any one give me a simple example? The partition size is 4 MB but the data inside is 3.1 MB. I need to dd only the 3.1 MB.



dd if=/dev/block/partition of=/tmp/3.1mb.img bs= skip=


I'm confused about bs and skip. Hopefully an example can clarify it.







share|improve this question













Can any one give me a simple example? The partition size is 4 MB but the data inside is 3.1 MB. I need to dd only the 3.1 MB.



dd if=/dev/block/partition of=/tmp/3.1mb.img bs= skip=


I'm confused about bs and skip. Hopefully an example can clarify it.









share|improve this question












share|improve this question




share|improve this question








edited May 3 at 18:51









Kusalananda

102k13199316




102k13199316









asked May 3 at 18:48









Rogers Drave

1




1




closed as unclear what you're asking by Hauke Laging, Kusalananda, Jeff Schaller, Jesse_b, Kiwy May 4 at 6:29


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Hauke Laging, Kusalananda, Jeff Schaller, Jesse_b, Kiwy May 4 at 6:29


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Where in the 4MB partition is the 3.1MB that you're interested in? Beginning? End? Sprinkled throughout the partition?
    – Mark Plotnick
    May 3 at 18:51







  • 1




    What sort of embedded system are you on where 900KB is too much slack to bring along for the ride?
    – DopeGhoti
    May 3 at 18:52










  • What comprises 3.1MB that you want to copy? Is that a bunch of files? Your block size can be as small as 1 byte, and you can use as many in the count as you need. man dd should help.
    – ajeh
    May 3 at 22:24










  • Its actually a carrier partition in Android, actual size of partition is 23MB but data inside that partition incld some small files and folder is around 2.9MB so what i was trying is too just dd the actual data, instead of whole partition.
    – Rogers Drave
    May 5 at 1:45












  • 1




    Where in the 4MB partition is the 3.1MB that you're interested in? Beginning? End? Sprinkled throughout the partition?
    – Mark Plotnick
    May 3 at 18:51







  • 1




    What sort of embedded system are you on where 900KB is too much slack to bring along for the ride?
    – DopeGhoti
    May 3 at 18:52










  • What comprises 3.1MB that you want to copy? Is that a bunch of files? Your block size can be as small as 1 byte, and you can use as many in the count as you need. man dd should help.
    – ajeh
    May 3 at 22:24










  • Its actually a carrier partition in Android, actual size of partition is 23MB but data inside that partition incld some small files and folder is around 2.9MB so what i was trying is too just dd the actual data, instead of whole partition.
    – Rogers Drave
    May 5 at 1:45







1




1




Where in the 4MB partition is the 3.1MB that you're interested in? Beginning? End? Sprinkled throughout the partition?
– Mark Plotnick
May 3 at 18:51





Where in the 4MB partition is the 3.1MB that you're interested in? Beginning? End? Sprinkled throughout the partition?
– Mark Plotnick
May 3 at 18:51





1




1




What sort of embedded system are you on where 900KB is too much slack to bring along for the ride?
– DopeGhoti
May 3 at 18:52




What sort of embedded system are you on where 900KB is too much slack to bring along for the ride?
– DopeGhoti
May 3 at 18:52












What comprises 3.1MB that you want to copy? Is that a bunch of files? Your block size can be as small as 1 byte, and you can use as many in the count as you need. man dd should help.
– ajeh
May 3 at 22:24




What comprises 3.1MB that you want to copy? Is that a bunch of files? Your block size can be as small as 1 byte, and you can use as many in the count as you need. man dd should help.
– ajeh
May 3 at 22:24












Its actually a carrier partition in Android, actual size of partition is 23MB but data inside that partition incld some small files and folder is around 2.9MB so what i was trying is too just dd the actual data, instead of whole partition.
– Rogers Drave
May 5 at 1:45




Its actually a carrier partition in Android, actual size of partition is 23MB but data inside that partition incld some small files and folder is around 2.9MB so what i was trying is too just dd the actual data, instead of whole partition.
– Rogers Drave
May 5 at 1:45










2 Answers
2






active

oldest

votes

















up vote
2
down vote













The dd on my version of Android appears to be similar to that of most linux distributions in its operation. So for documentation that explains its features I'd look at the dd man page (you can just google it).



The man page has this to say about bs, count, and skip:




 bs=BYTES
read and write up to BYTES bytes at a time (default: 512);
overrides ibs and obs

count=N
copy only N input blocks

skip=N skip N ibs-sized blocks at start of input



If you're looking for an exact number of bytes, you need to figure out
if you want 3.1MB or 3.1MiB. That is to say are your megabytes 1000*1000 bytes or 1024*1024 bytes? I'll assume the later in the following examples:




  1. dd if=/dev/block/partition of=/tmp/3.1mb.img count=6349



    So as above the default blocksize for dd is 512 bytes. Thus the following will copy out a little more than 3.1MiB starting from the beginning of the partition. Its a little more because 3.1MiB does not compute to a whole number of bytes (3.1*1024*1024 = 3250585.6). 6349 is used because 3.1 * 1024*1024 / 512 (blocksize) = 6348.8 and then I round up to make sure at least 3.1MiB of data is retrieved. Keep in mind that dd only reads and writes data in a multiple of blocksize, so in this case rounding up adds an extra 102 bytes. This shows you some of the things to think about if you are concerned about how many bytes you're actually getting.




  2. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 count=3250586



    If you want an exact number of bytes which you do not know to be a multiple of some number, you can set the block size to 1 and the count to the exact number of bytes you want.




  3. dd if=/dev/block/partition of=/tmp/3.1mb.img skip=1K count=6349



    Suppose that the data you want to copy is half a megabyte (512KiB, or 512*1024 bytes) into the partition. Then skip can be used as above. 1K is used because the K suffix in dd mean 1024 bytes. Since the block size is the default 512, that means we are skipping 512KiB or 512 * 1024 bytes into the partition. Skip means that a certain number of blocks from the beginning of the input file (partition in our case) will be skipped from the beginning to get to the position in the input file where dd will begin reading.




  4. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 skip=524288 count=3250586



    To get an exact number of bytes while skipping an in initial 512KiB we could rewrite the previous example as the one above.



Keep in mind that, since you are looking to copy a certain number of bytes, the count option should always be given. Otherwise, dd will read until it can no longer do so, which may read a lot more than you want.






share|improve this answer




























    up vote
    1
    down vote













    Simple arithmetic:



    dd if=/dev/block/partition of=/tmp/partition.img bs=1K count=3100


    1 kilobyte times 3100 = 3.1 megabytes, more or less.



    Are you sure the partition in question is so very small though?






    share|improve this answer





















    • Thanks, I guess this will help. Yes partition size is 23MB actually, but data inside the partition is 2.9MB incld some files and folders.
      – Rogers Drave
      May 5 at 1:47

















    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    The dd on my version of Android appears to be similar to that of most linux distributions in its operation. So for documentation that explains its features I'd look at the dd man page (you can just google it).



    The man page has this to say about bs, count, and skip:




     bs=BYTES
    read and write up to BYTES bytes at a time (default: 512);
    overrides ibs and obs

    count=N
    copy only N input blocks

    skip=N skip N ibs-sized blocks at start of input



    If you're looking for an exact number of bytes, you need to figure out
    if you want 3.1MB or 3.1MiB. That is to say are your megabytes 1000*1000 bytes or 1024*1024 bytes? I'll assume the later in the following examples:




    1. dd if=/dev/block/partition of=/tmp/3.1mb.img count=6349



      So as above the default blocksize for dd is 512 bytes. Thus the following will copy out a little more than 3.1MiB starting from the beginning of the partition. Its a little more because 3.1MiB does not compute to a whole number of bytes (3.1*1024*1024 = 3250585.6). 6349 is used because 3.1 * 1024*1024 / 512 (blocksize) = 6348.8 and then I round up to make sure at least 3.1MiB of data is retrieved. Keep in mind that dd only reads and writes data in a multiple of blocksize, so in this case rounding up adds an extra 102 bytes. This shows you some of the things to think about if you are concerned about how many bytes you're actually getting.




    2. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 count=3250586



      If you want an exact number of bytes which you do not know to be a multiple of some number, you can set the block size to 1 and the count to the exact number of bytes you want.




    3. dd if=/dev/block/partition of=/tmp/3.1mb.img skip=1K count=6349



      Suppose that the data you want to copy is half a megabyte (512KiB, or 512*1024 bytes) into the partition. Then skip can be used as above. 1K is used because the K suffix in dd mean 1024 bytes. Since the block size is the default 512, that means we are skipping 512KiB or 512 * 1024 bytes into the partition. Skip means that a certain number of blocks from the beginning of the input file (partition in our case) will be skipped from the beginning to get to the position in the input file where dd will begin reading.




    4. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 skip=524288 count=3250586



      To get an exact number of bytes while skipping an in initial 512KiB we could rewrite the previous example as the one above.



    Keep in mind that, since you are looking to copy a certain number of bytes, the count option should always be given. Otherwise, dd will read until it can no longer do so, which may read a lot more than you want.






    share|improve this answer

























      up vote
      2
      down vote













      The dd on my version of Android appears to be similar to that of most linux distributions in its operation. So for documentation that explains its features I'd look at the dd man page (you can just google it).



      The man page has this to say about bs, count, and skip:




       bs=BYTES
      read and write up to BYTES bytes at a time (default: 512);
      overrides ibs and obs

      count=N
      copy only N input blocks

      skip=N skip N ibs-sized blocks at start of input



      If you're looking for an exact number of bytes, you need to figure out
      if you want 3.1MB or 3.1MiB. That is to say are your megabytes 1000*1000 bytes or 1024*1024 bytes? I'll assume the later in the following examples:




      1. dd if=/dev/block/partition of=/tmp/3.1mb.img count=6349



        So as above the default blocksize for dd is 512 bytes. Thus the following will copy out a little more than 3.1MiB starting from the beginning of the partition. Its a little more because 3.1MiB does not compute to a whole number of bytes (3.1*1024*1024 = 3250585.6). 6349 is used because 3.1 * 1024*1024 / 512 (blocksize) = 6348.8 and then I round up to make sure at least 3.1MiB of data is retrieved. Keep in mind that dd only reads and writes data in a multiple of blocksize, so in this case rounding up adds an extra 102 bytes. This shows you some of the things to think about if you are concerned about how many bytes you're actually getting.




      2. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 count=3250586



        If you want an exact number of bytes which you do not know to be a multiple of some number, you can set the block size to 1 and the count to the exact number of bytes you want.




      3. dd if=/dev/block/partition of=/tmp/3.1mb.img skip=1K count=6349



        Suppose that the data you want to copy is half a megabyte (512KiB, or 512*1024 bytes) into the partition. Then skip can be used as above. 1K is used because the K suffix in dd mean 1024 bytes. Since the block size is the default 512, that means we are skipping 512KiB or 512 * 1024 bytes into the partition. Skip means that a certain number of blocks from the beginning of the input file (partition in our case) will be skipped from the beginning to get to the position in the input file where dd will begin reading.




      4. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 skip=524288 count=3250586



        To get an exact number of bytes while skipping an in initial 512KiB we could rewrite the previous example as the one above.



      Keep in mind that, since you are looking to copy a certain number of bytes, the count option should always be given. Otherwise, dd will read until it can no longer do so, which may read a lot more than you want.






      share|improve this answer























        up vote
        2
        down vote










        up vote
        2
        down vote









        The dd on my version of Android appears to be similar to that of most linux distributions in its operation. So for documentation that explains its features I'd look at the dd man page (you can just google it).



        The man page has this to say about bs, count, and skip:




         bs=BYTES
        read and write up to BYTES bytes at a time (default: 512);
        overrides ibs and obs

        count=N
        copy only N input blocks

        skip=N skip N ibs-sized blocks at start of input



        If you're looking for an exact number of bytes, you need to figure out
        if you want 3.1MB or 3.1MiB. That is to say are your megabytes 1000*1000 bytes or 1024*1024 bytes? I'll assume the later in the following examples:




        1. dd if=/dev/block/partition of=/tmp/3.1mb.img count=6349



          So as above the default blocksize for dd is 512 bytes. Thus the following will copy out a little more than 3.1MiB starting from the beginning of the partition. Its a little more because 3.1MiB does not compute to a whole number of bytes (3.1*1024*1024 = 3250585.6). 6349 is used because 3.1 * 1024*1024 / 512 (blocksize) = 6348.8 and then I round up to make sure at least 3.1MiB of data is retrieved. Keep in mind that dd only reads and writes data in a multiple of blocksize, so in this case rounding up adds an extra 102 bytes. This shows you some of the things to think about if you are concerned about how many bytes you're actually getting.




        2. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 count=3250586



          If you want an exact number of bytes which you do not know to be a multiple of some number, you can set the block size to 1 and the count to the exact number of bytes you want.




        3. dd if=/dev/block/partition of=/tmp/3.1mb.img skip=1K count=6349



          Suppose that the data you want to copy is half a megabyte (512KiB, or 512*1024 bytes) into the partition. Then skip can be used as above. 1K is used because the K suffix in dd mean 1024 bytes. Since the block size is the default 512, that means we are skipping 512KiB or 512 * 1024 bytes into the partition. Skip means that a certain number of blocks from the beginning of the input file (partition in our case) will be skipped from the beginning to get to the position in the input file where dd will begin reading.




        4. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 skip=524288 count=3250586



          To get an exact number of bytes while skipping an in initial 512KiB we could rewrite the previous example as the one above.



        Keep in mind that, since you are looking to copy a certain number of bytes, the count option should always be given. Otherwise, dd will read until it can no longer do so, which may read a lot more than you want.






        share|improve this answer













        The dd on my version of Android appears to be similar to that of most linux distributions in its operation. So for documentation that explains its features I'd look at the dd man page (you can just google it).



        The man page has this to say about bs, count, and skip:




         bs=BYTES
        read and write up to BYTES bytes at a time (default: 512);
        overrides ibs and obs

        count=N
        copy only N input blocks

        skip=N skip N ibs-sized blocks at start of input



        If you're looking for an exact number of bytes, you need to figure out
        if you want 3.1MB or 3.1MiB. That is to say are your megabytes 1000*1000 bytes or 1024*1024 bytes? I'll assume the later in the following examples:




        1. dd if=/dev/block/partition of=/tmp/3.1mb.img count=6349



          So as above the default blocksize for dd is 512 bytes. Thus the following will copy out a little more than 3.1MiB starting from the beginning of the partition. Its a little more because 3.1MiB does not compute to a whole number of bytes (3.1*1024*1024 = 3250585.6). 6349 is used because 3.1 * 1024*1024 / 512 (blocksize) = 6348.8 and then I round up to make sure at least 3.1MiB of data is retrieved. Keep in mind that dd only reads and writes data in a multiple of blocksize, so in this case rounding up adds an extra 102 bytes. This shows you some of the things to think about if you are concerned about how many bytes you're actually getting.




        2. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 count=3250586



          If you want an exact number of bytes which you do not know to be a multiple of some number, you can set the block size to 1 and the count to the exact number of bytes you want.




        3. dd if=/dev/block/partition of=/tmp/3.1mb.img skip=1K count=6349



          Suppose that the data you want to copy is half a megabyte (512KiB, or 512*1024 bytes) into the partition. Then skip can be used as above. 1K is used because the K suffix in dd mean 1024 bytes. Since the block size is the default 512, that means we are skipping 512KiB or 512 * 1024 bytes into the partition. Skip means that a certain number of blocks from the beginning of the input file (partition in our case) will be skipped from the beginning to get to the position in the input file where dd will begin reading.




        4. dd if=/dev/block/partition of=/tmp/3.1mb.img bs=1 skip=524288 count=3250586



          To get an exact number of bytes while skipping an in initial 512KiB we could rewrite the previous example as the one above.



        Keep in mind that, since you are looking to copy a certain number of bytes, the count option should always be given. Otherwise, dd will read until it can no longer do so, which may read a lot more than you want.







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered May 3 at 19:56









        crass

        963




        963






















            up vote
            1
            down vote













            Simple arithmetic:



            dd if=/dev/block/partition of=/tmp/partition.img bs=1K count=3100


            1 kilobyte times 3100 = 3.1 megabytes, more or less.



            Are you sure the partition in question is so very small though?






            share|improve this answer





















            • Thanks, I guess this will help. Yes partition size is 23MB actually, but data inside the partition is 2.9MB incld some files and folders.
              – Rogers Drave
              May 5 at 1:47














            up vote
            1
            down vote













            Simple arithmetic:



            dd if=/dev/block/partition of=/tmp/partition.img bs=1K count=3100


            1 kilobyte times 3100 = 3.1 megabytes, more or less.



            Are you sure the partition in question is so very small though?






            share|improve this answer





















            • Thanks, I guess this will help. Yes partition size is 23MB actually, but data inside the partition is 2.9MB incld some files and folders.
              – Rogers Drave
              May 5 at 1:47












            up vote
            1
            down vote










            up vote
            1
            down vote









            Simple arithmetic:



            dd if=/dev/block/partition of=/tmp/partition.img bs=1K count=3100


            1 kilobyte times 3100 = 3.1 megabytes, more or less.



            Are you sure the partition in question is so very small though?






            share|improve this answer













            Simple arithmetic:



            dd if=/dev/block/partition of=/tmp/partition.img bs=1K count=3100


            1 kilobyte times 3100 = 3.1 megabytes, more or less.



            Are you sure the partition in question is so very small though?







            share|improve this answer













            share|improve this answer



            share|improve this answer











            answered May 3 at 18:51









            DopeGhoti

            40k54779




            40k54779











            • Thanks, I guess this will help. Yes partition size is 23MB actually, but data inside the partition is 2.9MB incld some files and folders.
              – Rogers Drave
              May 5 at 1:47
















            • Thanks, I guess this will help. Yes partition size is 23MB actually, but data inside the partition is 2.9MB incld some files and folders.
              – Rogers Drave
              May 5 at 1:47















            Thanks, I guess this will help. Yes partition size is 23MB actually, but data inside the partition is 2.9MB incld some files and folders.
            – Rogers Drave
            May 5 at 1:47




            Thanks, I guess this will help. Yes partition size is 23MB actually, but data inside the partition is 2.9MB incld some files and folders.
            – Rogers Drave
            May 5 at 1:47


            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?