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

    • TP-Link Tri-Band AXE5400 Wi-Fi 6E Gaming Router Archer GXE75 is just $135 by Sayan Sen If you’re juggling gaming consoles, 4K streams and a growing roster of smart devices, the TP-Link Archer GXE75 Tri-Band AXE5400 Wi-Fi 6E Gaming Router is a good option to look at right now, considering the device is currently on sale at just $135 (purchase link under the specs table below). The Archer GXE75 promises up to 5.4 Gbps of throughput across three bands: 574 Mbps on 2.4 GHz, 2402 Mbps on 5 GHz and 2402 Mbps on 6 GHz (HE160 channels enabled). A 2.5 Gbps WAN/LAN port pairs with three 1 Gbps LAN ports and a USB 3.0 port for fast file sharing or printer access (purchase link down below). The quad-core CPU and 512 MB of RAM should help to handle multiple streams without bogging down, while MU-MIMO, OFDMA and 1024-QAM improve efficiency when several devices connect simultaneously. The router’s built-in Game Accelerator engine is said to automatically prioritize gaming packets (both wired and wireless), and TP-Link’s GPN (Gamers Private Network) acceleration can reduce packet loss for supported titles. HomeShield security brings firewall protection, device quarantining and parental controls. The technical specifications of the router are given below: Specification Details Wireless Standards IEEE 802.11ax 6 GHz; IEEE 802.11ax/ac/n/a 5 GHz; IEEE 802.11ax/n/g/b 2.4 GHz Wi-Fi Speeds 6 GHz: 2402 Mbps (802.11ax); 5 GHz: 2402 Mbps (802.11ax); 2.4 GHz: 574 Mbps (802.11ax) Spatial Streams 6 streams (tri-band OFDMA/MU-MIMO) Processor 1.7 GHz 64-bit Quad-Core CPU Memory 512 MB high-speed RAM Ethernet Ports 1× 2.5 Gbps WAN/LAN; 1× 1 Gbps WAN/LAN; 3× 1 Gbps LAN USB 1× USB 3.0 SuperSpeed port (up to 10× faster than USB 2.0) Antennas 4× high-performance external antennas with Beamforming Buttons Power On/Off; Reset; WPS/Wi-Fi; LED On/Off Working Modes Router Mode; Access Point Mode Security WPA, WPA2, WPA3, WPA/WPA2-Enterprise; SPI firewall; Access Control; IP/MAC binding; Application-layer gateway; HomeShield security suite VPN OpenVPN, PPTP, L2TP (server & client); WireGuard (server & client) Software & Services IPv4/IPv6; TP-Link HomeShield; EasyMesh; Parental controls; QoS by device; WAN types (Dynamic IP, Static IP, PPPoE, PPTP, L2TP); DDNS (TP-Link, NO-IP, DynDNS); auto firmware updates Gaming Features Game QoS boost; gaming-port priority; Gamers Private Network acceleration; game-port forwarding; real-time game panel with stats & RGB control Operating Environment 0 °C – 40 °C; 10 %– 90 % non-condensing humidity Get the TP-Link Tri-Band AXE5400 Wi-Fi 6E Gaming Router Archer GXE75 at the link below: TP-Link Tri-Band AXE5400 Wi-Fi 6E Gaming Router Archer GXE75 | EasyMesh, HomeShield: $159.99 + $25 off with coupon => $134.99 (Sold and Shipped by Amazon US This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • Oh no... here we go again. Tha same sh*t that happaned to Mail & Calendar...
    • I too have worked with pro gear for decades and so I found the interface to be unintuitive from both the pro and casual side (a rare "accomplishment" by what are obviously otherwise skilled coders, hehe). I eventually got it to work, thanks for offering, but I found other compatibility issues with my own use case, so I just dropped it entirely. Right now, I just use an analog line out/line in approach which works as expected across all usage scenarios. With both machines on the same power block/outlet, I'm not getting any analog hum or hiss. My next step will be to try the updated Multiplicity 4 when a bug, addressing this very issue unfortunately, is resolved. Knowing Stardock, that could be tomorrow or five years from now, so I check back every few months to see it it's fixed and I want to upgrade. Again, thanks for offering to help.
    • We recognize that performance can use some improvements, and we continue to work on improving it. However, it's worth noting that massive performance improvements don't happen overnight, they take a lot of work and effort, and in most cases, the improvements are more noticeable when you compare across several updates. That said, Files is open-source and everyone is invited to help with these efforts 🙂
    • A lot of effort has gone into improving stability and Files Preview now has a 99% crash free rate. These improvements will make their way to Files Stable when v4 is released later this year. If you're still experiencing issues, please report them on GitHub or Discord so we can track them properly.
  • Recent Achievements

    • Rookie
      Snake Doc went up a rank
      Rookie
    • First Post
      nobody9 earned a badge
      First Post
    • One Month Later
      Ricky Chan earned a badge
      One Month Later
    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      495
    2. 2
      Michael Scrip
      203
    3. 3
      ATLien_0
      197
    4. 4
      Xenon
      137
    5. 5
      +FloatingFatMan
      115
  • Tell a friend

    Love Neowin? Tell a friend!