Using dd for sector-by-sector copy to ISO?

If none of the more specific forums is the right place to ask

Using dd for sector-by-sector copy to ISO?

Postby Storsnusarn^ » 2017-04-30 01:45

I wounder if it's possible to for example run
Code: Select all
dd if=sda of=hdd.iso

to make it copying the drive sectorwise (including deleted files and files on corrupted sectors)? The reason i ask is that a friend asked me to help recover some data she deleted by mistake and i find it a lot more convenient to work on an exact copy and just mount the ISO at home where i have much better resources than to work directly on her hardware.

Thanks in advance!
Storsnusarn^
 
Posts: 15
Joined: 2015-10-29 00:39

Re: Using dd for sector-by-sector copy to ISO?

Postby dasein » 2017-04-30 03:29

The output file isn't an .iso, but yes, you can dd a device to a file.
User avatar
dasein
 
Posts: 7639
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Using dd for sector-by-sector copy to ISO?

Postby phenest » 2017-04-30 09:45

The correct command would be:
Code: Select all
dd if=/dev/sda of=filename

(Don't forget "/dev/sda" and not just "sda".)
I'm not sure about corrupted sectors though. If the hard drive marks them as bad, it copies the data to good sectors. Bad sector access is restricted by the hard drive. But you'll still get a complete image of the drive.

EDIT: Damn! It's not possible to highlight within code tags. :(
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Using dd for sector-by-sector copy to ISO?

Postby Storsnusarn^ » 2017-04-30 11:10

dasein wrote:The output file isn't an .iso, but yes, you can dd a device to a file.

What do you mean by the output file isn't an iso? of=filename.iso, maybe i'm just stupid :mrgreen:

phenest wrote:The correct command would be:
Code: Select all
dd if=/dev/sda of=filename

(Don't forget "/dev/sda" and not just "sda".)
I'm not sure about corrupted sectors though. If the hard drive marks them as bad, it copies the data to good sectors. Bad sector access is restricted by the hard drive. But you'll still get a complete image of the drive.

EDIT: Damn! It's not possible to highlight within code tags. :(

Yes ofc i meant /dev/sda i was really tired when i posted this OP :lol: but thanks for the clearness. By complete image i guess you mean sector-by-sector including deleted files (that hasn't been overwritten ofc))? Does the blocksize matter if i want to copy sector-by-sector, i mean "bs=4M", must this match the current blocksize on the current drive i'm copying or can i just skip that flag?
Storsnusarn^
 
Posts: 15
Joined: 2015-10-29 00:39

Re: Using dd for sector-by-sector copy to ISO?

Postby phenest » 2017-04-30 11:22

You can give the output file an .iso extension, but that doesn't make it an ISO, nor will it be to ISO spec. It'll be a drive image with an .iso extension. The extension doesn't matter in this case. Choose whatever you want.

Block size doesn't matter in this case, Sectors are usually 512 bytes if you want to do it that way. A complete copy of the drive will take time regardless.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Using dd for sector-by-sector copy to ISO?

Postby dasein » 2017-04-30 13:13

Storsnusarn^ wrote:
dasein wrote:The output file isn't an .iso, but yes, you can dd a device to a file.

What do you mean by the output file isn't an iso? of=filename.iso

And do you imagine that if you named it filename.jpg it'd magically morph into a photograph?
Or that if you named it filename.ods it'd somehow become a spreadsheet?

Storsnusarn^ wrote:...maybe i'm just stupid :mrgreen:

(I'm not gonna say it... I'm not gonna say it...)
User avatar
dasein
 
Posts: 7639
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Using dd for sector-by-sector copy to ISO?

Postby Storsnusarn^ » 2017-04-30 14:05

phenest wrote:You can give the output file an .iso extension, but that doesn't make it an ISO, nor will it be to ISO spec. It'll be a drive image with an .iso extension. The extension doesn't matter in this case. Choose whatever you want.

Block size doesn't matter in this case, Sectors are usually 512 bytes if you want to do it that way. A complete copy of the drive will take time regardless.

Ok thank you. That makes sense :). Now i'm just gonna figure out how to mount it in a win32 system as a regular iso. Sorry for the misunderstanding iso above was just me trying to explain mountable file... Too damaged by windows administrating :(
dasein wrote:And do you imagine that if you named it filename.jpg it'd magically morph into a photograph?
Or that if you named it filename.ods it'd somehow become a spreadsheet?

No i didn't imagined that. Have you ever heard of files with diffirent extentions that does the same thing?

Storsnusarn^ wrote:...maybe i'm just stupid :mrgreen:

dasein wrote:(I'm not gonna say it... I'm not gonna say it...)

Happy to let you feel like the smartest person in the room.
Storsnusarn^
 
Posts: 15
Joined: 2015-10-29 00:39

Re: Using dd for sector-by-sector copy to ISO?

Postby phenest » 2017-04-30 15:43

Storsnusarn^ wrote:Now i'm just gonna figure out how to mount it in a win32 system as a regular iso.

From now on, you're on your own.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Using dd for sector-by-sector copy to ISO?

Postby debiman » 2017-04-30 18:37

Storsnusarn^ wrote:Now i'm just gonna figure out how to mount it in a win32 system as a regular iso.

just take a random .jpg, change its extension to .iso and try mounting that as "a regular iso".

dasein might not be the most clever person in the room (definitely not the most friendly or polite), but you, on the other hand... :lol:
User avatar
debiman
 
Posts: 1017
Joined: 2013-03-12 07:18

Re: Using dd for sector-by-sector copy to ISO?

Postby pendrachken » 2017-05-01 04:58

There are a few ways to mount the image in Windows. Pretty sure daemontools / lite should do it. Another is osfmount.


Or you could just throw together a decent sized VM and run Linux and all the fun recovery tools from there.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1262
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Using dd for sector-by-sector copy to ISO?

Postby Storsnusarn^ » 2017-05-01 06:06

pendrachken wrote:There are a few ways to mount the image in Windows. Pretty sure daemontools / lite should do it. Another is osfmount.


Or you could just throw together a decent sized VM and run Linux and all the fun recovery tools from there.

From Windows 8 and above daemon tools and similar programs are not longer required to mount iso and img-files, you can mount these natively in windows. Therefore my question above about the file not being an iso according to previous answers, what i tried to ask before was if it's possible to "convert" a file created this way to a iso or img-file? Not sure if windows or maybe daemon/similar can mount it anyways if i'll just name it ".iso" and give it a try.

I will use both linux and windows tools, depending on how deep i need to dig. I have more experience recovering whole partitions with windows-tools.

Thank you for a decent answer :D

EDIT: Just read about osfmount you told me about and this seems to be able to aim specifically at dd-images, perfect. Thx once again, now i dont need to worry about that. Just still a bit unsure on how datarecovery from a image will work though, but as i understood from here and some more googling it should work as well as if i copied it to another drive sector-by-sector
Storsnusarn^
 
Posts: 15
Joined: 2015-10-29 00:39


Return to General Questions

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable