3

I downloaded a Debian DVD and following the docs mounted a USB and simply did this:

cp mydebiandvd.iso /dev/sdb
sync

After running these commands I ran lsblk and found the sdb thumb drive said it had all space free.

But when I booted to the USB the Debian install screen popped up!

Is cp doing something special when I copied the ISO directly to the device (not just a partition on the device). Does it do something like run the dd command in the background? Really curious about what's actually happening here.

I believe sync just makes sure the USB isn't locked before it can be unmounted?

7
  • Your first command makes a block-level copy of your sdb disk into your current directory. Most probably it is not the right command to put a downloaded iso into an usb drive, I don't know where you found it but it is probably bad. If you want to write a downloaded iso into an usb drive, then use cat your-downloaded.iso >/dev/sdb, but before that check twice that really that sdb is your pendrive device! (It irrecoverably destroys anything on the sdb.)
    – peterh
    Apr 22, 2017 at 22:42
  • lol it cant be that bad: debian.org/releases/jessie/amd64/ch04s03.html.en Apr 22, 2017 at 23:14
  • Lol, if you switch the parameters of a command and don't notice the fault even for the second check, I can't predict a nice future for you in the command line world.
    – peterh
    Apr 22, 2017 at 23:39
  • ah well that was a typo, it wouldnt even have worked if that was what i actually ran. I thought your objection was straight copying over piping the output like that- does piping it like that do the same thing? Apr 23, 2017 at 0:28
  • 3
    Please edit your question fixing the serious mistake pointed out by peterh. Also, the linked documentation emphasizes that the stick must not be mounted during the copy operation, but you state you mounted it. Please clarify this as well. It isn't clear what your question is, but cp does not do anything special, and neither does dd. Either one would work for this purpose when used correctly. Apr 23, 2017 at 8:10

2 Answers 2

3

Yes , you can create a bootable USB using the command cp.

There is an answer from the official website (Frequently Asked Questions)

How do I write a CD/DVD/BD image to a USB flash drive?

On a Linux machine, simply use the "cp" command, to copy an image to a USB flash drive:

cp <file> <device>

Alternatively you can also use "dd":

dd if=<file> of=<device> bs=4M; sync
1
  • 3
    I don't think this addresses the question. It sounds to me like OP wants to know what's happening under the hood/bonnet, not which steps to follow.
    – Mathieu K.
    Sep 29, 2020 at 4:22
-1

I found most effective sudo usb-creator-gtk

Your question: sync does no do the magic, it just flushes the buffers. As mentioned by GAD3R cp <file> <device> is equivalent to dd.

1
  • Possible caveat: appears to require Ubuntu (and probably a graphical environment). OP's environment isn't specified, but can't be assumed to be graphical Ubuntu. Also, in my opinion, OP is asking how things work behind the scenes, not which steps to follow.
    – Mathieu K.
    Sep 29, 2020 at 4:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .