How to wipe a drive with a message

This will work for Mac or Linux.

When a disk drive is formatted, the data on the disk is not actually erased; rather a new file system is added. A file system is a layer, an abstraction, a way to organise the 1’s and 0’s on the disk so that an operating system can make sense of the arrangement.

For example, and this system I just totally made up – one type of file system might say: read data in 64-bit chunks starting and bit (memory) position 1024, and every first 4 bits of each 64 bits is reserved for some signal. Suppose you do that and copy some data on the drive with this organisation. Then you change the files system to something else that has 128-bit chunks and 8 bits reserved at the start of each block, then your data becomes unreadable even though you haven’t changed it.

That’s formatting. It looks like you’re wiping the disk, but you’re not actually.

So what is wiping? Wiping would involve actually writing something over the data. Typically, that would be writing 0’s all over the drive in every position. Another way is to write random 0’s and 1’s. Another is to do random 0’s and 1’s, and then repeat the whole thing over and over again to reduce the risk of a sophisticated attacker accessing the old state of those 0’s and 1’s and extracting your old data.

I’m not interested in that right now and it’s not the topic of this piece. I’m interested in writing non-random data to the drive, for fun. It is also educational.

I’ll show you how to write any message you want with this example:

Craig Wright is a liar and a fraud

Step 1 – Find the dev name of your disk

It’s crucial not to mess this up or you could wipe the wrong disk.

Type this command in the terminal:


Here you can see I have 4 drives:

sda is 111.8Gb drive, the internal drive, usually listed first. I wouldn’t mess with that. It has two partitions sda1 (for booting) and sda2 for data storage and applications etc.

sdb has 1 partition (sdb1). It is my external drive which happens to be holding the bitcoin blockchain

sdc is a memory card attached. I don’t know why it’s showing 0, it could be non-initialised, it doesn’t matter for now.

sdd is the drive I want to format. I know its size and recognise it. When I detach it and repeat lsblk, I see it’s gone. I’m sure it’s that one.

sr0 I believe is the CD ROM drive

Step 2 – use ‘yes’ and ‘dd’ to wipe the disk

dd is a very powerful open-source tool/program that comes with Linux and Mac. Because of that power, it is very dangerous. Be careful and don’t carelessly type commands using this. Always double-check and focus as you use this program. It can ruin lives.

‘yes’ is another program that simply prints any text you want over and over until you hit <control> c. In the way I will use it, it continues until the drive is full.

Here is the command combination:

yes "Craig Wright is a liar and a fraud. " | sudo dd iflag=fullblock of=/dev/### bs=1M count=1000 ; sync

yes” will print whatever I want in the following quotation marks and the pipe symbol, | , will pass the output to the next command on the right.

sudo” is needed to give the next program superuser privileges, dd is the program, and ‘iflag=fullblock‘ is necessary for dd to wait for ‘yes’ to deliver enough data to write the next block (otherwise who knows what it will write when its input is empty, maybe zeros?).

“of” means output file, which is directed to /dev/### (replace ### with your drive, eg sdb, or sdc, or sdd. Certainly not sda which would be the internal drive holding the operating system). “bs” is the block size to write at a time, and “count” has something to do with memory holding before writing, I think.

” ; ” has spaces on either side and introduces a new command to the right, that will run only after the first is finished. That command is “sync” which makes sure cached data in memory is written to the drive so you can eject it safely.

You can then format the drive for usage:

sudo mkfs.ext4 /dev/###

replace ### with your drive’s 3 letters.

You can also label your drive:

sudo e2label /dev/### mydrive

Then you can mount your drive. Make a new directory first in the default location as shown below. Note that $(whoami) will be interpreted as your login name which you could type instead, I’ve kept it generic:

sudo mkdir /media/$(whoami)/my_drive

Then mount:

sudo mount /dev/### /media/$(whoami)/my_drive

Then make sure the permissions for the drive are not “root”.

Take a look:

cd /media/$(whoami) && ls -lah

If the owner and group of the “my_drive” is “root”, you can change it to your username:

sudo chown -R $(whoami):$(whoami) /media/$(whoami)/my_drive


Your drive is now ready to use and is filled with a message about Craig Wright. That data area is considered “empty” and writable by anything you want your drive to hold. The empty space would otherwise have been a bunch of zeros, but this is cooler.

If you find errors here, please let me know.

On-chain or Lightning