Announcement

Collapse
No announcement yet.

Have I killed my hdd with dd ?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Have I killed my hdd with dd ?

    Hi,

    I've done something really stupid with the dd command. After pressing ctrl-c I got the following which implies something was written to sda. Fdisk (see below) shows that I have 2 devices, sda1 and sda2. Does this mean I have likely wiped out a chunk of my drive by writing to sda, even though only sda1 and sda2 are listed as devices?

    ^C132+0 records in
    131+0 records out
    1373634560 bytes (1.4 GB) copied, 42.3801 s, 32.4 MB/s

    When, I do an fdisk -l
    I get:

    Disk /dev/sda: 320.1 GB, 320072933376 bytes
    124 heads, 62 sectors/track, 81314 cylinders
    Units = cylinders of 7688 * 512 = 3936256 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xe1dcecbf

    Device Boot Start End Blocks Id System
    /dev/sda1 1 17 65317 6 FAT16
    /dev/sda2 18 958 3617204 83 Linux



    #2
    Re: Have I killed my hdd with dd ?

    What was the 'dd' command you used - or think you used.

    Boot Info Script

    Comment


      #3
      Re: Have I killed my hdd with dd ?

      Thanks for the reply, here was the dd command I used. >

      sudo dd if=/home/ben/packages/file.bin of=/dev/sda bs=10M count=365

      My machine is still working normally, but i fear that if I restart, my boot sector or something from the os has gone.

      Comment


        #4
        Re: Have I killed my hdd with dd ?

        What ever "file.bin" is the dd command wrote 1.4GB of it to /dev/sda, which happens to be the same HD that Linux is on. dd will start at track 0, sector 0 byte 0 and begin writing away, which wiped out your MBR, along with 1.4 GB of the 3.675 GB on sda1. It's a FAT16 partition. What was on it?

        Regardless, you're hosed. IF you reboot you probably won't get grub, even if it is on sda2 because the MBR is gone.


        You can boot a Kubuntu LiveCD, install and use gparted to see which partition was marked as bootable, or to mark the sda2 as bootable, restore the MBR to the bootable partition, and use chrooting to restore grub.



        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          Re: Have I killed my hdd with dd ?

          Thanks for the reply.

          I had a feeling that would be the outcome.
          Best leave the machine on for the time being. :P

          regards,

          Ben.

          Comment


            #6
            Re: Have I killed my hdd with dd ?

            Been there, done that.

            dd is very powerful and I love it. I used it to save my employer hundreds of thousands of dollars recovering files from a 15 year old Unix drive that went belly up and wouldn't boot because of clerk abuse. I created a 1GB text image of the entire HD by mounting it as a slave so it wouldn't have to boot, and then used a text editor to look for patterns in that file and pick off the index that linked the names of documents to their jpg image. The paper documents the jpg imaged had been destroyed years before.

            But, sometimes, it can go off while in the holster if not handled properly.
            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              Re: Have I killed my hdd with dd ?

              Part of the MBR you overwrote includes your partition table. Once you reboot (more to the point: once your attempt at a reboot fails), you'll lose access to everything. Actually, I'm surprised you don't get errors from fdisk. The partition info you're getting is totally incorrect.

              My advice: Beg, borrow, or steal a USB device that you can copy any files from your home that you don't want to lose, then do a new install. Other than hoping a tool will find your files you've little else to hope for.

              Here's some info from another post of mine I felt was worth repeating:

              How to make a backup copy of your Master Boot Record and Partition Table

              Once your install(s) and/or dual boot are working the way you want:

              1. Open a terminal window
              2. Type sudo dd if=/dev/sda of=mbrsave.bin bs=512 count=1
              3. Type sudo chown YOURUSERNAME:YOURPRIMARYGROUPNAME mbrsave.bin
              4. Copy this file to a safe location not on your computer. i.e. usbdisk, email it to your gmail address, floppy disc, cdrom, whatever.

              Repeat the above whenever you make a change to your partition table or update your bootmanager (grub).


              How to restore a trashed Master Boot Record AND Partition Table:


              1. Open a terminal window
              2. Type sudo dd if=/PATHTOSAVEDFILE/mbrsave.bin of=/dev/sda


              How to restore a trashed Master Boot Record but NOT the Partition Table:

              1. Open a terminal window
              2. Type sudo dd if=/PATHTOSAVEDFILE/mbrsave.bin of=/dev/sda bs=446 count=1


              How to restore a trashed Partition Table but NOT the Master Boot Record:


              1. Open a terminal window
              2. Type sudo dd if=/PATHTOSAVEDFILE/mbrsave.bin of=/dev/sda bs=1 count=64 skip=446 seek=446

              This is one of those times when the sinking feeling in the pit of your stomach should be replaced with the knowledge that you have learned a large and painful lesson. And oh, BTW - EVERYONE here has done something as damaging as this at least once, me - more times than I care to admit. This is how we learn stuff like this!

              p.s. GG - You were underpaid at that job!

              Please Read Me

              Comment


                #8
                Re: Have I killed my hdd with dd ?

                @oshunluvr, that's a classic bit of guidance -- I think I'll link it in to the "Top 20 FAQs".

                Thanks!

                Comment


                  #9
                  Re: Have I killed my hdd with dd ?

                  Originally posted by oshunluvr
                  ....
                  p.s. GG - You were underpaid at that job!
                  Or not... they payed me well, and the retirement annuity lasts for the lifetime of both me and my wife, should I pass before she does. I have no complaints. The work was interesting and challenging, as the Unix HD failure shows, and I had the pleasure of introducing the department and IT staff to Linux. I also had the pleasure of working for 10 years with my son, a developer and later Oracle admin, and now head of the programming division of the dept we worked in. 8) 8) 8) I introduced him to programming using VB 3.0 and later used his services in my business. It was a joy to see him graduate with a Bachelor of Science in Mathematics and build his programming skills till to the point he is better than I am. He has much more patience for detail than I do. That produces a warmth of the heart that is beyond description.
                  "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                  – John F. Kennedy, February 26, 1962.

                  Comment


                    #10
                    Re: Have I killed my hdd with dd ?

                    Sweet! Government job? I only get 50% but I retired at 46! Take that!

                    Please Read Me

                    Comment


                      #11
                      Re: Have I killed my hdd with dd ?

                      Originally posted by oshunluvr
                      Sweet! Government job? I only get 50% but I retired at 46! Take that!
                      I decided to edit out my retirement package, so you were probably the only one to read it.
                      I worked for the Dept of Rev for my state. It was the last client I contracted with when I was running my own computer consulting business. I had a three month contract with them to develop software which would test the output of proprietary Tax packages, like TurboTax, for compliance with NE state laws. One month into the contract they opened a position and asked me to apply. As I said before, they gave me an offer which my wife wouldn't let me refuse because I usually spent 6 to 8 weeks at a time on the road at clients sites. I had a private pilots license and worked a 12 state area around Lincoln.
                      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                      – John F. Kennedy, February 26, 1962.

                      Comment


                        #12
                        Re: Have I killed my hdd with dd ?

                        dibl: Thanks for the props!

                        GG: Nice gig with a great turn out. I been to Lincoln once or twin - from KC area by birth. What did you fly around in? Nice Saratoga or maybe Baron

                        Please Read Me

                        Comment


                          #13
                          Re: Have I killed my hdd with dd ?

                          more tips & tricks w/dd
                          http://kubuntuforums.net/forums/inde...opic=3090824.0

                          (btw Beware GPT--May change things wrt MBR.)
                          An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                          Comment


                            #14
                            Re: Have I killed my hdd with dd ?

                            Originally posted by Qqmike
                            more tips & tricks w/dd
                            http://kubuntuforums.net/forums/inde...opic=3090824.0

                            (btw Beware GPT--May change things wrt MBR.)
                            Great basic guide to the 'dd' command Mike. Its good to know that others appreciate it as much as I do.

                            Usually whenever I mention the word 'dd' or show an example, several comments ensue on how dangerous it is.

                            They go into great detail on how you can trash your hard drive, etc, etc. Scaring people away. Not just 'dd', but several commands can do damage if used inappropriately.

                            I remember reading someone else use of the 'dd' command and his warning so short and sweet, with "enuf said" at the end.

                            No long tirade about the do's and don'ts, just "enuf said".

                            Here's another guide , from several years back that I have heard onto. Yours seems more tailored.
                            Boot Info Script

                            Comment


                              #15
                              Re: Have I killed my hdd with dd ?

                              Originally posted by oshunluvr
                              dibl: Thanks for the props!

                              GG: Nice gig with a great turn out. I been to Lincoln once or twin - from KC area by birth. What did you fly around in? Nice Saratoga or maybe Baron
                              I spent about a couple hours in a Cessna 152 but switched when I couldn't press my toes on the top of the peddles to brake the aircraft -- not enough room in the cockpit. I licensed on a Cessna 172 Skyhawk, which is a beautiful aircraft. But, my favorite was the Cessna 206 Centurion, a 6 passenger, 3 bladed, triple axis autopilot with retractable landing gear. That puppy was fast. Coming back from a business trip to Albuquerque, NM, TACAN clocked me at 295 mph ground speed over Kansas. The pitot tube put me at 195 Knts (Vmax) indicated air speed. The difference was a tail wind.

                              I would fly rather than eat and I am hungry all the time. But, alas, my eye problems have worsened with age and even an eye surgery doesn't correct the strabismus which plagued me earlier.
                              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                              – John F. Kennedy, February 26, 1962.

                              Comment

                              Working...
                              X