Question

I know i can fill an entire disk with 0x0 like this:

dd if=/dev/zero of=/dev/sda bs=4k conv=notrunc

Is there a way to fill the entire disk with a char of my choice?

Was it helpful?

Solution

How about this:

yes "<char>" | dd of=/dev/sda bs=4k conv=notrunc

Substitute with character of your choice.

OTHER TIPS

You can do it this way:

while true; do echo -n 'x'; done | dd of=/dev/sda bs=4k conv=notrunc iflag=fullblock
yes "" | tr "\n" "<char>" | dd of=/dev/sda <rest of dd parameters>
cat /dev/zero | tr "\0" "<char>" | dd of=/dev/sda <rest of dd parameters>
cat /dev/zero | sed "y/\0x00/<char>/" | dd of=/dev/sda <rest of dd parameters>

Where <char> is your chosen character

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top