I just bought a ssd to change with current hdd. So, I decided to copy whole 750 gb partiton (of course used part of it which is approximetly 76 GBs) using "dd" utility. However, I entered this command:

sudo dd if=/dev/sda5 of=/dev/sdb1

(since partition I mentioned was defined as "sda5"...) I was expecting it to copy these 76 GBs fully, but it finished copying that part; Moreover, is's still maintains copying other 674 GBs null. I wasn't expecting this result. When I enter sudo pkill -USR1 -n -x dd command, It says: "505029097+0 records in 505029096+0 records out 258574897152 bytes (259 GB) copied, 39871,3 s, 6,5 MB/s" So, if somebody can explain this situation to me, I would be really satisfied.

  • 2
    If you do not want a byte-by-byte copy, dd is the wrong tool. Also, you used it very inefficiently: next time use the bs Option giving it some memory to speed it up (by default dd reads / writes each byte on its own which is slow). For this job, just mount the partitions and use cp -a instead. – cbley Dec 29 '16 at 10:18

If you don't specify the bs and count options, dd will copy the whole partition /dev/sda5. This is because dd is a very low level tool and it has no means of distinguishing between files and empty space. So, to copy only the full part of the partition, dd isn't the tool you need because even you specify the size, there is no reason the actual data should be at the start of the available space.

If you want to copy the used data only, you should resize the partition /dev/sda5. start by resizing the 750 partition to a another partition of slightly above 76GB which is almost full. To resize the partition, you can use the gparted or fdisk command. After resizing, you can use dd in the standard way on the new partition.

You can also compress the partition /dev/sda5 by running it through gzip. after that you can copy the copressed image using dd as follow

dd if=/dev/sda5 | gzip > sda5.gz


dd if=sda5.gz | gunzip > /dev/sdb1 

The dd utility shall copy the specified input file to the specified output file with possible conversions using specific input and output block sizes.


So dd does a fully copy of your files or drives, and can not detect which segments are used and which aren't. For that I would recommend something like (G)Parted.

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.