Error Creating Bootable Usb Using "Cat File. Iso > /Dev/Sdb"

At first, I had this USB flash drive with a Ubuntu 14.04 LTS bootable in it. But now, I want to remove/wipe it and create a new bootable of another OS. First, I tried directly:

sudo cat file.iso > /dev/sdb; sync

As suggested in this thread. It didn't worked, returned

bash: /dev/sdb: Permission denied

So, I thought that this was happening because of it already containing a bootable and decide to wipe it. So I just shreded it

sudo shred -v /dev/sdb

After it, It wasn't appearing on the nautilus vertical nav as I sticked it into PC. So I made a file system for it sudo mkfs.ext3 /dev/sdb (I don't know if it's the right type of fs to make it but I was just testing anyway, if it isn't, please warn me about this)

Now, I access it through nautilus and I see that it is indeed empty. I'm trying to make that command I was doing in the beginning sudo cat file.iso > /dev/sdb; sync but still having the same "permission denied" again.

So, two questions on that, did this mkfs was applied correctly or I shouldn't do that? And, how do I solve my problem of making my bootable iso finally? (I don't want to use unetbootin, couldn't install it and I read that it could be done using cat/sync) Thanks in advance.

4

4 Answers

I have noticed that the other answers all seem to be questioning why you're using cat in this context, and then go on to suggest you use dd.

There's no need. The original command you posted is basically right, it just won't work with sudo (because direction is done by the shell, not by cat, so you don't have permission to do it), so get yourself initially to a root shell.

sudo -i

When you drop to the root prompt, issue your first command.

cat file.iso > /dev/sdb; sync

It'll do exactly what you think, and write the ISO directly to the USB stick, and is probably the quicker and more sensible way to do this than using dd

Don't forget to type

exit

When you've finished with the root shell.

3

The command you try

sudo cat file.iso > /dev/sdb; sync

would, if it does what you expect, completly overwrite the usb drive. So there is no need / no sense to create a ext3 filesystem on it before.

Your mkfs.ext3 command in a sense is fine.

The actually cat command will not work because the sudo command runs as root but the redirection of the output does not. A simple way to get it working is

sudo dd if=file.iso of=/dev/sdb bs=16k; sync

As this doesn't use output redirection there is no problem with sudo.

This is mentioned as the "retro way" in the question you linked to.

Powerful but dangerous commands

cat and dd can do the trick, to clone from an iso file to a mass storage device, for example a USB flash drive or a memory card.

When you write to a device like this, you will overwrite what was there before, including the partition table and file systems. These commands do what you tell them to do without any questions. So if you tell them to wipe your family pictures, they will do it. And it is a minor typing error away.

Since dd has been used traditionally for this purpose, it has deserved the nicknames 'Disk Destroyer' and 'Data Destroyer', but the same risks apply to cat, when used in this context.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.