how to create a bootable Linux USB Drive in Terminal - on Command Line


Recommended Posts

 

dear community, 


i am wanting to create a bootable Linux-USB-Drive on the commmandline. I do not like etcher and the win-tools.  what i am wondering is the question why on earth the USB image maker out there (on any distro) use up all the entire space on a USB stick to make any Live Linux, say MX-Linux, or OpenSuse or Debian, or my beloved Puppy  or the ubuntu or Mint or whatsoever system, etc.

well - that said:  Most other distros create a live-usb with a simple "dd" copy of the iso file. 

 

the advantage here: This copies the iso file byte by byte onto the usb storage device. The iso file (according the documentation) has got a read-only iso9660 files system so the usb device gets a read-only iso9660 file-system. So whats the  fuzz  why do some systems take the whole usb-stick. 


To avoid these downsides i want to create a bootable Linux USB Drive in Terminal - on Command Line This makes the rest of the usb-stick useless for anything else because in order to make use of the remainder of the it you would need to create a partition table at the beginning but this is space is already used up be the iso filesystem and bootloader.

That said: well i guess that we can do the creation of a USB flash installation i think that create a bootable Linux USB stick from the command line the usage of the dd tool could be a good idea.
This tool is available on all Linux systems.


i think the steps are the following: 

 

Insert the USB flash drive into the USB port.

Next step, we ought to find out the name of the USB drive. for this step and job i think we can use  lsblk:

 

lsblk

lsblk

 

The output will look something like this:

 

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 999.8G  0 disk 
└─sda1        8:1    0 565.8G  0 part /data
sdy           8:16   1   7.5G  0 disk 
└─sdy1        8:17   1   7.5G  0 part /run/media/linuxize/Kingston
ndrive1     259:0    0 232.9G  0 disk 
├─ndrive1p1 259:1    0   512M  0 part /boot
├─ndrive1p2 259:2    0    16G  0 part [SWAP]
└─ndrive1p3 259:3    0 216.4G  0 part /

 


In our case the name of the USB device is /dev/sdy but this may vary on your system.  On most Linux distributions the USB flash drive will be automatically mounted when inserted.
Before flashing the image we should see if it is  needed to unmount the USB device.  To do so were able to use the umount command followed by either the mount point or the device name:

 

sudo umount /dev/sdy1

 

and now we re ready to flash the ISO image to the USB drive.  We need to make sure to replace /dev/sdy with our drive and do not append the partition number. 
Also, we need to make sure we are using the correct path to the ISO file.

 

sudo dd bs=4M if=/path/to/debian-10.0.0-amd64-netinst.iso of=/dev/sdx status=progress oflag=sync

 

 
with the use of oflag=sync and yes with the use of the famous dd-command - like so ... but other articles like itsfoss guide me to use sync:

 

sudo dd bs=4M if=/path/to/debian-10.0.0-amd64-netinst.iso of=/dev/sdx status=progress && sync

 

the question is: Which one is the better way: the

oflag=sync option to dd,

 

i think  that dd does not really bypasses kernel disk caches when writing to device. Generally spoken: Both sync command and oflag=sync will do the same job.
that sync command will write to disk all caches from all disks so,  when a machine is pretty busy writing to other disks drives
then i guess it will have a slower response for other commands.

 

well the question is: Which one is the better way: the oflag=sync option to dd ?
 

 

in that context i have the following question: I wonder whether oflag's direct does the syncing automatically or if it is explicitly required:

 

dd bs=10M oflag=direct,sync of=ofile.bin

 

Also what is the difference in saying 

 oflag=sync and conv=sync and conv=fsync?

 

What impact does it have if I change the code to the line below?

 

dd bs=10M conv=fsync oflag=direct of=ofile.bin

 

 

  • 8 months later...

I would suggest Ventoy (ventoy.net) instead (which has a version for Linux) as it's much easier and as a bonus one just has to copy the ISO files to the USB stick and boot to the USB stick in either UEFI or BIOS mode and then select the ISO you want to load and that's that ;)

 

even updating Ventoy is easy to.

Just use:

 

$ sudo dd bs=4M if=input.iso of=pathToYourUsbDrive

 

And be done with it. Don't try being all technical. There's no reason for it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I was thinking, and was going to post, almost exactly what @Brandon Hjust posted!   WARNING: possible spoilers I also love these videos she makes:   
    • The Witcher 4 tech demo shows off the RPG in action on a base PS5 at 60FPS by Pulasthi Ariyasinghe Epic Games' The State of Unreal 2025 keynote happened today, giving a look at its latest improvements to the Unreal Engine, and other developments and partnerships that the Fortnite maker is involved in. The show kicked things off with a bang, giving fans a live on-stage presentation of The Witcher 4 alongside developer CD Projekt RED. Seen below, the tech demo of the hugely anticipated RPG features the new trilogy's protagonist, Ciri, as she explores Kovir, the new mainland that CD Projekt is letting players explore. Following a monster trail, Ciri and her horse Kelpie go through mountains and forests before reaching the town of Valdrest. Surprisingly, the demo is said to be running on a base PlayStation 5, and it even manages to stay at 60 frames per second despite the stunning visuals. The studio said that the technologies it is using will benefit all platforms that it is targeting for the RPG. The Witcher 4 is coming to PC, Xbox Series X|S, and PlayStation 5 consoles, though a release date has not been revealed yet. "We started our partnership with Epic Games to push open-world game technology forward. To show this early look at the work we’ve been doing using Unreal Engine running at 60 FPS on PlayStation 5, is a significant milestone — and a testament of the great cooperation between our teams," said joint CEO of CD Projekt RED Michał Nowakowski. "But we're far from finished. I look forward to seeing more advancements and inspiring technology from this partnership as development of The Witcher 4 on Unreal Engine 5 continues." The demo showcases tech like Unreal Animation Framework, Nanite Foliage rendering, MetaHuman technology with Mass AI crowd scaling, and more from Epic Games' latest engine developments. Unreal Engine 5.6 is said to include many of these improvements, letting any developer use the tools on their games for better visuals and optimizations.
    • The same guy who promised AGI in a year, and later he said: yes, but no really.
    • Microsoft and security. 🤣 One day, I received a big bill from Microsoft. I checked the log, and the log (not Azure Premium) only lasted a few weeks, so I was unable to find any information about what happened. I checked the bill, and it showed me that somebody (no information) created a big virtual machine for many weeks, then finally deleted it. I contacted support, and they told me that I will get my money back. 8 months later, it never happened. However, the invoices show some weird movements. They indeed did the reverse, but only in the system, but my CC never got the money back. I had a fight with my bank, and my bank finally showed me records that Microsoft never tried to return my money. What happened, who hacked it, and how? Microsoft was unable to answer. My account had a DFA. Conclusion: I should have reported it to my CC.
  • Recent Achievements

    • Week One Done
      Adam Todd earned a badge
      Week One Done
    • Contributor
      Ed B went up a rank
      Contributor
    • One Month Later
      moporcho earned a badge
      One Month Later
    • One Month Later
      Parotel earned a badge
      One Month Later
    • Reacting Well
      Cryptecks earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      202
    2. 2
      snowy owl
      144
    3. 3
      ATLien_0
      133
    4. 4
      Xenon
      120
    5. 5
      +FloatingFatMan
      106
  • Tell a friend

    Love Neowin? Tell a friend!