Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What's the best way to copy a entire partition empty sectors and all as to recover deleted files, a few have recommended "dd" but I'll be honest I've never used it and nobody seems to know of a simple how to on the topic. I attempted using gparted but after copying a partition that had only 3 gigs of data on it and found it took less than 2 minutes to copy the partition quickly realized it does not copy empty sectors as few have told me.

So I was wondering if anybody has a how to on how to use dd to copy a partition empty sectors and all, or of anything like gparted (being as a bootable disc format) that indeed copies bit by bit, empty sectors included.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

A howto for dd seems unneeded since it is a very simple command.

dd if=/dev/sda2 of=my_full_partition_backup bs=1M would copy partition number 2 on the first disk to a file called my_full_partition_backup. You just need source (if) and destination (of), though adding bs=1M is advice for a huge speed gain.

If you want to copy a full disk (not just a partition) use /dev/sda. No number. sdA for the first disk, sdB for the second disk, sdC for the third disk etc etc.

If you are doing this as a backup then you might want to compress the result. You can do this after you made the image (e.g. run dd, then bzip the result, or during the backup. The last will make the backup slower, but you need less disk space.

To do the latter use
dd if=/dev/sda2 bs=1M | gzip > my_full_partition_backup.gz

share|improve this answer
    
Ok so just to confirm, this will copy the empty sectors as well, not to second guess you, but I'm in slight panic mode right now and need to make sure I can get a backup of the "deleted" content as well so that I can restore it. –  user88311 Jan 26 '13 at 20:44
    
Size is no problem, I have multiple hard drives, although I am going to restore it onto another drive the same size as well so am I correct to assume, by do the latter you mean restore all information in my_full_partition_backup.gz onto another disk in bootable form. Also the terminal in the gparted live should be able to do the dd correct? –  user88311 Jan 26 '13 at 20:56
    
Data recovery and few other things. Oh and so would it be correct to assume that dd if=/dev/sda of=/dev/sdb bs=1M would just do full drive to drive instead of just the 1 partition. –  user88311 Jan 26 '13 at 21:09
    
Correct me I'm wrong, I'm hoping that command works but I don't want t attempt anything without consulting those who know more about it first. –  user88311 Jan 26 '13 at 21:15
    
THANK YOU, so I'm correct to assume the terminal in gparted will work the same, correct, you never responded to that question. –  user88311 Jan 26 '13 at 21:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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