Usb size wrong after dd write of a ISO-Image












2














I have just used dd to place the Kali Linux ISO file onto my USB. I then tried to install Kali Linux via the USB, but I couldn't since the install-image was corrupt. I booted back into my other Linux OS (antergos) and tried using dd again. My USB-Stick now says it's 32KB in size and fdisk can't detect it.



It is originally an 8GB USB 2.0 stick.



To override the MBR and Partition-table, I unsuccessfully tried:



dd if=/dev/zero of=/dev/sdx bs=512 count=1










share|improve this question





























    2














    I have just used dd to place the Kali Linux ISO file onto my USB. I then tried to install Kali Linux via the USB, but I couldn't since the install-image was corrupt. I booted back into my other Linux OS (antergos) and tried using dd again. My USB-Stick now says it's 32KB in size and fdisk can't detect it.



    It is originally an 8GB USB 2.0 stick.



    To override the MBR and Partition-table, I unsuccessfully tried:



    dd if=/dev/zero of=/dev/sdx bs=512 count=1










    share|improve this question



























      2












      2








      2







      I have just used dd to place the Kali Linux ISO file onto my USB. I then tried to install Kali Linux via the USB, but I couldn't since the install-image was corrupt. I booted back into my other Linux OS (antergos) and tried using dd again. My USB-Stick now says it's 32KB in size and fdisk can't detect it.



      It is originally an 8GB USB 2.0 stick.



      To override the MBR and Partition-table, I unsuccessfully tried:



      dd if=/dev/zero of=/dev/sdx bs=512 count=1










      share|improve this question















      I have just used dd to place the Kali Linux ISO file onto my USB. I then tried to install Kali Linux via the USB, but I couldn't since the install-image was corrupt. I booted back into my other Linux OS (antergos) and tried using dd again. My USB-Stick now says it's 32KB in size and fdisk can't detect it.



      It is originally an 8GB USB 2.0 stick.



      To override the MBR and Partition-table, I unsuccessfully tried:



      dd if=/dev/zero of=/dev/sdx bs=512 count=1







      dd usb-drive fdisk iso






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 2 '17 at 2:10









      Jeff Schaller

      38.7k1053125




      38.7k1053125










      asked Nov 5 '16 at 16:10









      Jack Sewell

      1113




      1113






















          3 Answers
          3






          active

          oldest

          votes


















          3














          Your usb stick has failed.



          Some drives return different sizes when they fail, although I've only read about this with regard to "SSDs", which have more complex controllers.



          To double-check the size of the drive as a whole, I would use lsblk or look in the kernel log dmesg. (The size of partitions within the device could be completely bogus depending on the partition table; you could contrive this without having a hardware failure).



          If the size was OK, there are ways you could try to recover important data. But it doesn't sound like you need to - you still have access to the Kali ISO file.



          Simple usb sticks aren't designed with any extra hardware diagnostics[*]. Once you know the hardware has failed, that's it. Either of the size of the drive as a whole going wrong, or the drive not returning the data you wrote to them (suggested by failure of fdisk), would be enough to indicate such failure.



          [*] I think they're not even designed for uses where the maximum expected re-write cycles of flash storage becomes an issue. They're much more likely to just break, or be lost.






          share|improve this answer































            0














            I know this place is about unix, but when I have this problem I find a windows machine and I use diskpart (admin access needed). Because when fdisk fails, this just works; maybe it will help somebody.

            I can't try the instructions right now, but it should be something like :
            list disk, select disk i, clean, create partition primary, format fs=fat32 quick, active, assign, exit.

            And your USB stick size is now OK (but of course, you have lost your data).

            I'm also interested in an equivalent way to succeed this with linux.



            NB: I'm not sure the wrong size indicates the dd has failed. Anyway, don't forget to append && sync to your dd command.






            share|improve this answer





















            • sync is a great point. Removing the usb stick without sync could lose data at the end & cause the Kali boot or install to fail. It might also cause fdisk error (or warning?) w.r.t. GPT partion tables, because they have a trailer at the end of the disk image as well as a header at the start like old-style MBR uses. I can't think of an interpretation where the size 32KB would appear, but linux "ISO" hybrid images are black magic, so I am not certain about that.
              – sourcejedi
              Nov 6 '16 at 14:00






            • 1




              I have edited my answer to include a command, which if it shows sdx (e.g. sda, not sda1) with a size fo 32KB, would tell you the usb stick is failing and should never be trusted again :).
              – sourcejedi
              Nov 6 '16 at 14:15



















            0














            This can happen when the virtual disk geometry is wrongly detected. First try to reboot before proceeding.



            Warning : I don't think this could be harmfull for your usb key but if you don't want to take any risk, please test formatting under Windows fisrt.



            This guide assume you drive is /dev/sdb, please adapt to your need.

            In a terminal, search the output of dmesg for such a line sd 5:0:0:0: [sdb] 62545920 512-byte logical blocks: (32.0 GB/29.8 GiB)

            This tells you :




            • The number of sectors (logical blocks): 62545920

            • The sectors size : 512 bytes

            • The real media size : 32.0 GB/29.8 GiB


            Now calculate the exact media size in byte : 62545920 * 512 = 32023511040 bytes = 30540 MiB (29.82GiB).

            Then find a valid CHS combination leading to C * H * S = 62545920

            Or if you are feeling lazy, with 512 byte block size, this should work : C=30540 (the size in MiB!), H=64 and S=32



            Finally, run sudo fdisk -C 30540 -H 64 -S 32 and write a new partitaion table to fix.

            Reboot if changes are not correctly detected.






            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%2f321274%2fusb-size-wrong-after-dd-write-of-a-iso-image%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









              3














              Your usb stick has failed.



              Some drives return different sizes when they fail, although I've only read about this with regard to "SSDs", which have more complex controllers.



              To double-check the size of the drive as a whole, I would use lsblk or look in the kernel log dmesg. (The size of partitions within the device could be completely bogus depending on the partition table; you could contrive this without having a hardware failure).



              If the size was OK, there are ways you could try to recover important data. But it doesn't sound like you need to - you still have access to the Kali ISO file.



              Simple usb sticks aren't designed with any extra hardware diagnostics[*]. Once you know the hardware has failed, that's it. Either of the size of the drive as a whole going wrong, or the drive not returning the data you wrote to them (suggested by failure of fdisk), would be enough to indicate such failure.



              [*] I think they're not even designed for uses where the maximum expected re-write cycles of flash storage becomes an issue. They're much more likely to just break, or be lost.






              share|improve this answer




























                3














                Your usb stick has failed.



                Some drives return different sizes when they fail, although I've only read about this with regard to "SSDs", which have more complex controllers.



                To double-check the size of the drive as a whole, I would use lsblk or look in the kernel log dmesg. (The size of partitions within the device could be completely bogus depending on the partition table; you could contrive this without having a hardware failure).



                If the size was OK, there are ways you could try to recover important data. But it doesn't sound like you need to - you still have access to the Kali ISO file.



                Simple usb sticks aren't designed with any extra hardware diagnostics[*]. Once you know the hardware has failed, that's it. Either of the size of the drive as a whole going wrong, or the drive not returning the data you wrote to them (suggested by failure of fdisk), would be enough to indicate such failure.



                [*] I think they're not even designed for uses where the maximum expected re-write cycles of flash storage becomes an issue. They're much more likely to just break, or be lost.






                share|improve this answer


























                  3












                  3








                  3






                  Your usb stick has failed.



                  Some drives return different sizes when they fail, although I've only read about this with regard to "SSDs", which have more complex controllers.



                  To double-check the size of the drive as a whole, I would use lsblk or look in the kernel log dmesg. (The size of partitions within the device could be completely bogus depending on the partition table; you could contrive this without having a hardware failure).



                  If the size was OK, there are ways you could try to recover important data. But it doesn't sound like you need to - you still have access to the Kali ISO file.



                  Simple usb sticks aren't designed with any extra hardware diagnostics[*]. Once you know the hardware has failed, that's it. Either of the size of the drive as a whole going wrong, or the drive not returning the data you wrote to them (suggested by failure of fdisk), would be enough to indicate such failure.



                  [*] I think they're not even designed for uses where the maximum expected re-write cycles of flash storage becomes an issue. They're much more likely to just break, or be lost.






                  share|improve this answer














                  Your usb stick has failed.



                  Some drives return different sizes when they fail, although I've only read about this with regard to "SSDs", which have more complex controllers.



                  To double-check the size of the drive as a whole, I would use lsblk or look in the kernel log dmesg. (The size of partitions within the device could be completely bogus depending on the partition table; you could contrive this without having a hardware failure).



                  If the size was OK, there are ways you could try to recover important data. But it doesn't sound like you need to - you still have access to the Kali ISO file.



                  Simple usb sticks aren't designed with any extra hardware diagnostics[*]. Once you know the hardware has failed, that's it. Either of the size of the drive as a whole going wrong, or the drive not returning the data you wrote to them (suggested by failure of fdisk), would be enough to indicate such failure.



                  [*] I think they're not even designed for uses where the maximum expected re-write cycles of flash storage becomes an issue. They're much more likely to just break, or be lost.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 6 '16 at 14:11

























                  answered Nov 5 '16 at 16:48









                  sourcejedi

                  22.9k436100




                  22.9k436100

























                      0














                      I know this place is about unix, but when I have this problem I find a windows machine and I use diskpart (admin access needed). Because when fdisk fails, this just works; maybe it will help somebody.

                      I can't try the instructions right now, but it should be something like :
                      list disk, select disk i, clean, create partition primary, format fs=fat32 quick, active, assign, exit.

                      And your USB stick size is now OK (but of course, you have lost your data).

                      I'm also interested in an equivalent way to succeed this with linux.



                      NB: I'm not sure the wrong size indicates the dd has failed. Anyway, don't forget to append && sync to your dd command.






                      share|improve this answer





















                      • sync is a great point. Removing the usb stick without sync could lose data at the end & cause the Kali boot or install to fail. It might also cause fdisk error (or warning?) w.r.t. GPT partion tables, because they have a trailer at the end of the disk image as well as a header at the start like old-style MBR uses. I can't think of an interpretation where the size 32KB would appear, but linux "ISO" hybrid images are black magic, so I am not certain about that.
                        – sourcejedi
                        Nov 6 '16 at 14:00






                      • 1




                        I have edited my answer to include a command, which if it shows sdx (e.g. sda, not sda1) with a size fo 32KB, would tell you the usb stick is failing and should never be trusted again :).
                        – sourcejedi
                        Nov 6 '16 at 14:15
















                      0














                      I know this place is about unix, but when I have this problem I find a windows machine and I use diskpart (admin access needed). Because when fdisk fails, this just works; maybe it will help somebody.

                      I can't try the instructions right now, but it should be something like :
                      list disk, select disk i, clean, create partition primary, format fs=fat32 quick, active, assign, exit.

                      And your USB stick size is now OK (but of course, you have lost your data).

                      I'm also interested in an equivalent way to succeed this with linux.



                      NB: I'm not sure the wrong size indicates the dd has failed. Anyway, don't forget to append && sync to your dd command.






                      share|improve this answer





















                      • sync is a great point. Removing the usb stick without sync could lose data at the end & cause the Kali boot or install to fail. It might also cause fdisk error (or warning?) w.r.t. GPT partion tables, because they have a trailer at the end of the disk image as well as a header at the start like old-style MBR uses. I can't think of an interpretation where the size 32KB would appear, but linux "ISO" hybrid images are black magic, so I am not certain about that.
                        – sourcejedi
                        Nov 6 '16 at 14:00






                      • 1




                        I have edited my answer to include a command, which if it shows sdx (e.g. sda, not sda1) with a size fo 32KB, would tell you the usb stick is failing and should never be trusted again :).
                        – sourcejedi
                        Nov 6 '16 at 14:15














                      0












                      0








                      0






                      I know this place is about unix, but when I have this problem I find a windows machine and I use diskpart (admin access needed). Because when fdisk fails, this just works; maybe it will help somebody.

                      I can't try the instructions right now, but it should be something like :
                      list disk, select disk i, clean, create partition primary, format fs=fat32 quick, active, assign, exit.

                      And your USB stick size is now OK (but of course, you have lost your data).

                      I'm also interested in an equivalent way to succeed this with linux.



                      NB: I'm not sure the wrong size indicates the dd has failed. Anyway, don't forget to append && sync to your dd command.






                      share|improve this answer












                      I know this place is about unix, but when I have this problem I find a windows machine and I use diskpart (admin access needed). Because when fdisk fails, this just works; maybe it will help somebody.

                      I can't try the instructions right now, but it should be something like :
                      list disk, select disk i, clean, create partition primary, format fs=fat32 quick, active, assign, exit.

                      And your USB stick size is now OK (but of course, you have lost your data).

                      I'm also interested in an equivalent way to succeed this with linux.



                      NB: I'm not sure the wrong size indicates the dd has failed. Anyway, don't forget to append && sync to your dd command.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 6 '16 at 13:35









                      rdupz

                      1183




                      1183












                      • sync is a great point. Removing the usb stick without sync could lose data at the end & cause the Kali boot or install to fail. It might also cause fdisk error (or warning?) w.r.t. GPT partion tables, because they have a trailer at the end of the disk image as well as a header at the start like old-style MBR uses. I can't think of an interpretation where the size 32KB would appear, but linux "ISO" hybrid images are black magic, so I am not certain about that.
                        – sourcejedi
                        Nov 6 '16 at 14:00






                      • 1




                        I have edited my answer to include a command, which if it shows sdx (e.g. sda, not sda1) with a size fo 32KB, would tell you the usb stick is failing and should never be trusted again :).
                        – sourcejedi
                        Nov 6 '16 at 14:15


















                      • sync is a great point. Removing the usb stick without sync could lose data at the end & cause the Kali boot or install to fail. It might also cause fdisk error (or warning?) w.r.t. GPT partion tables, because they have a trailer at the end of the disk image as well as a header at the start like old-style MBR uses. I can't think of an interpretation where the size 32KB would appear, but linux "ISO" hybrid images are black magic, so I am not certain about that.
                        – sourcejedi
                        Nov 6 '16 at 14:00






                      • 1




                        I have edited my answer to include a command, which if it shows sdx (e.g. sda, not sda1) with a size fo 32KB, would tell you the usb stick is failing and should never be trusted again :).
                        – sourcejedi
                        Nov 6 '16 at 14:15
















                      sync is a great point. Removing the usb stick without sync could lose data at the end & cause the Kali boot or install to fail. It might also cause fdisk error (or warning?) w.r.t. GPT partion tables, because they have a trailer at the end of the disk image as well as a header at the start like old-style MBR uses. I can't think of an interpretation where the size 32KB would appear, but linux "ISO" hybrid images are black magic, so I am not certain about that.
                      – sourcejedi
                      Nov 6 '16 at 14:00




                      sync is a great point. Removing the usb stick without sync could lose data at the end & cause the Kali boot or install to fail. It might also cause fdisk error (or warning?) w.r.t. GPT partion tables, because they have a trailer at the end of the disk image as well as a header at the start like old-style MBR uses. I can't think of an interpretation where the size 32KB would appear, but linux "ISO" hybrid images are black magic, so I am not certain about that.
                      – sourcejedi
                      Nov 6 '16 at 14:00




                      1




                      1




                      I have edited my answer to include a command, which if it shows sdx (e.g. sda, not sda1) with a size fo 32KB, would tell you the usb stick is failing and should never be trusted again :).
                      – sourcejedi
                      Nov 6 '16 at 14:15




                      I have edited my answer to include a command, which if it shows sdx (e.g. sda, not sda1) with a size fo 32KB, would tell you the usb stick is failing and should never be trusted again :).
                      – sourcejedi
                      Nov 6 '16 at 14:15











                      0














                      This can happen when the virtual disk geometry is wrongly detected. First try to reboot before proceeding.



                      Warning : I don't think this could be harmfull for your usb key but if you don't want to take any risk, please test formatting under Windows fisrt.



                      This guide assume you drive is /dev/sdb, please adapt to your need.

                      In a terminal, search the output of dmesg for such a line sd 5:0:0:0: [sdb] 62545920 512-byte logical blocks: (32.0 GB/29.8 GiB)

                      This tells you :




                      • The number of sectors (logical blocks): 62545920

                      • The sectors size : 512 bytes

                      • The real media size : 32.0 GB/29.8 GiB


                      Now calculate the exact media size in byte : 62545920 * 512 = 32023511040 bytes = 30540 MiB (29.82GiB).

                      Then find a valid CHS combination leading to C * H * S = 62545920

                      Or if you are feeling lazy, with 512 byte block size, this should work : C=30540 (the size in MiB!), H=64 and S=32



                      Finally, run sudo fdisk -C 30540 -H 64 -S 32 and write a new partitaion table to fix.

                      Reboot if changes are not correctly detected.






                      share|improve this answer


























                        0














                        This can happen when the virtual disk geometry is wrongly detected. First try to reboot before proceeding.



                        Warning : I don't think this could be harmfull for your usb key but if you don't want to take any risk, please test formatting under Windows fisrt.



                        This guide assume you drive is /dev/sdb, please adapt to your need.

                        In a terminal, search the output of dmesg for such a line sd 5:0:0:0: [sdb] 62545920 512-byte logical blocks: (32.0 GB/29.8 GiB)

                        This tells you :




                        • The number of sectors (logical blocks): 62545920

                        • The sectors size : 512 bytes

                        • The real media size : 32.0 GB/29.8 GiB


                        Now calculate the exact media size in byte : 62545920 * 512 = 32023511040 bytes = 30540 MiB (29.82GiB).

                        Then find a valid CHS combination leading to C * H * S = 62545920

                        Or if you are feeling lazy, with 512 byte block size, this should work : C=30540 (the size in MiB!), H=64 and S=32



                        Finally, run sudo fdisk -C 30540 -H 64 -S 32 and write a new partitaion table to fix.

                        Reboot if changes are not correctly detected.






                        share|improve this answer
























                          0












                          0








                          0






                          This can happen when the virtual disk geometry is wrongly detected. First try to reboot before proceeding.



                          Warning : I don't think this could be harmfull for your usb key but if you don't want to take any risk, please test formatting under Windows fisrt.



                          This guide assume you drive is /dev/sdb, please adapt to your need.

                          In a terminal, search the output of dmesg for such a line sd 5:0:0:0: [sdb] 62545920 512-byte logical blocks: (32.0 GB/29.8 GiB)

                          This tells you :




                          • The number of sectors (logical blocks): 62545920

                          • The sectors size : 512 bytes

                          • The real media size : 32.0 GB/29.8 GiB


                          Now calculate the exact media size in byte : 62545920 * 512 = 32023511040 bytes = 30540 MiB (29.82GiB).

                          Then find a valid CHS combination leading to C * H * S = 62545920

                          Or if you are feeling lazy, with 512 byte block size, this should work : C=30540 (the size in MiB!), H=64 and S=32



                          Finally, run sudo fdisk -C 30540 -H 64 -S 32 and write a new partitaion table to fix.

                          Reboot if changes are not correctly detected.






                          share|improve this answer












                          This can happen when the virtual disk geometry is wrongly detected. First try to reboot before proceeding.



                          Warning : I don't think this could be harmfull for your usb key but if you don't want to take any risk, please test formatting under Windows fisrt.



                          This guide assume you drive is /dev/sdb, please adapt to your need.

                          In a terminal, search the output of dmesg for such a line sd 5:0:0:0: [sdb] 62545920 512-byte logical blocks: (32.0 GB/29.8 GiB)

                          This tells you :




                          • The number of sectors (logical blocks): 62545920

                          • The sectors size : 512 bytes

                          • The real media size : 32.0 GB/29.8 GiB


                          Now calculate the exact media size in byte : 62545920 * 512 = 32023511040 bytes = 30540 MiB (29.82GiB).

                          Then find a valid CHS combination leading to C * H * S = 62545920

                          Or if you are feeling lazy, with 512 byte block size, this should work : C=30540 (the size in MiB!), H=64 and S=32



                          Finally, run sudo fdisk -C 30540 -H 64 -S 32 and write a new partitaion table to fix.

                          Reboot if changes are not correctly detected.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 18 '18 at 22:42









                          Ludovic Ronsin

                          1112




                          1112






























                              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%2f321274%2fusb-size-wrong-after-dd-write-of-a-iso-image%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







                              Popular posts from this blog

                              Morgemoulin

                              Scott Moir

                              Souastre