1

I want to clopy a partition between SSD devices. Normally I could do it simply with the "dd" or "buffer" commands.

However, now that I have SSDs, I also would like to miss the unneeded writes.

I want all all-zero blocks handled as trimmed blocks.

Is there, ideally a command line tool, to do that?

1 Answer 1

2

You can do this in two steps:

  • discard the contents of the target device (so that reads return zero):

    blkdiscard /dev/sdT1 
  • copy the data, skipping instead of writing zero blocks (using GNU dd):

    dd bs=100M iflag=fullblock conv=sparse if=/dev/sdS1 of=/dev/sdT1 

replacing S1 (source) and T1 (target) as appropriate.

2
  • what's the significance of the magic number 100M ? Commented Oct 24 at 2:54
  • 1
    @jhnc nothing special, it’s supposed to be large enough to avoid inefficient reads/writes. Given modern SSD layouts it might be better as a power of two. Commented Oct 24 at 9:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.