0

I wished to clone a 500GB hard drive, so I booted into Kali Linux and ran the following command:

dd if=/dev/sda of=/media/root/usb/windows.img bs=64k conv=noerror

This all worked absolutely fine, the image was made and is able to boot. However, when that actual PC is booted, the following message is displayed:

An operating system wasn't found. Try disconnecting any drives that don't contain an operating system. Press Ctrl+alt+Del to restart.

It is possible that this is merely coincidental, however this seems unlikely. I do not currently have physical access to this computer currently, my question is, is there anyway that running this dd command could have resulted in the computer not being able to find any bootable drives?

  • 1
    Have you disconnected other drives as the message says? Especially the USB drive that holds the image? Maybe the PC tries to boot from it and there is a forgotten bootloader there that displays the message. – Kamil Maciorowski Mar 18 '17 at 21:53
  • Yes, I was able to try disconnecting everything (even the input devices) and it still fails. – Jacob Misirian Mar 19 '17 at 0:20
0

It is unlikely that this dd command had any adverse impact on the boot by itself as all it did is reading data from the drive /dev/sda and writing it into an image file that is physically on another storage device.

Unlikely doesn't mean impossible. Check if you can exclude the following two cases.

Exception 1: I notice you passed the option conv=noerror. Typically this option is used to extract data from a failing storage device (in fact you would use conv=sync,noerror and a value for bs that matches the physical sector size of your hdd). What it does is causing dd to proceed after it encountered bad sectors on the drive it is reading from, so you can hopefully extract data from the image file, which may still contain data corruption caused by the failing drive but is now located on safe storage. To look at it the other way round, if you suspect your drive to be healthy you do not want to pass conv=noerror, so that if dd fails you know there is a problem with the drive.

Assuming you were reading from a bad drive, then the read by dd itself may have caused some more bad sectors on the drive, as any other read operation by any other program (like booting the pc normally) would have. If this is true the dd may have well been the last successful read on that sector.

Exception 2: Also, while the dd invocation quoted above is correct, when typing dd commands manually it is very easy to swap an 'if' for an 'of', which may easily render the data on a hard drive unusable.

Even if you are not confident now that dd didn't screw up your data, don't neglect to look at other causes for the failed boot. Here are some hints that may help you on the way and maybe enable you to describe the problem more accurately:

The message you are reading (An operating system wasn't found [...]) is from a windows boot loader. So the bios found a disk with this boot loader on it which in turn can't find the windows installation to go with it. Were you expecting to boot into Windows?

Were you trying to run the source hard drive from your description, the hard drive with the new disk image or another installation altogether?

Have you changed any bios boot options, par example when booting into Kali? Are you sure the bios is pointing to the correct drive now? (Or maybe a drive that was formerly used for a Windows installation?)

If your description is complete you didn't actually 'clone' the hard drive, you just created an image file inside an existing file system (which would be useful as a backup). A properly cloned hard drive could be inserted in the pc to replace the original one but this wouldn't work yet with what you did so far. Also if the source hard drive was faulty the image is likely corrupted. You probably want to read more about cloning with dd in this basic example and in this discussion about conv=sync,noerror.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.