linux write iso to usb

This question already has an answer here:

I want to burn a Windows ISO to a USB device in Ubuntu. How do I do this?

I know how to burn a Ubuntu ISO into a USB device, but with a Windows ISO it’s not the same.

marked as duplicate by Eric Carvalho, Charles Green, user364819, Dav > Nov 28 ’15 at 11:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

10 Answers 10

Or you could try a bit-by-bit copy:

  1. Insert the USB device and then open Disk Utility (in 10.10 and older, System -> Administration -> Disk Utility).
  2. Select the USB device from the list in the left of the program and detect where it was mounted: /dev/sd[1 letter][optionally 1 number] . For example, /dev/sdc or /dev/sdc1 .

Make sure the USB device is unmounted (not safely removed, but unmounted) If it is mounted you can unmount it:

Assuming the .iso file is in your home folder, open the terminal and write:

And wait for it to finish. (The «bs=4M» — bit is optional, just makes it faster.)

Insert the USB device, then run gparted.

Select the USB device from the list near the upper-right corner of the GParted window and detect where it was mounted: /dev/sd[1 letter] (mine was /dev/sdc ).

  • Make sure the USB device is unmounted (right-click and select unmount).
  • sudo dd if=[PATH TO YOUR .iso FILE] of=/dev/sd[THAT 1 LETTER]

    In my case: sudo dd if=/home/downloads/windows7.iso of=/dev/sdc

    You must run dd as su or sudo. It’s worth mentioning that gparted requires su as well, but will typically use gksudo to prompt for the password.

    This means you can lock gparted to the launcher on a persistent liveboot USB for field diagnostics.

    If you boot with UEFI (not BIOS or UEFI with BIOS compatibility mode (a.k.a. CSM)) all you’ll need is GParted and a file manager.

    The ISO must be configured for UEFI boot for this to work. I’ve successfully done this with both Windows 8.1 and Ubuntu 14.04, but I can’t vouch for any other OS. (Edit: I just tried this with Windows 10 without success. Don’t know why, but WinUSB worked so I didn’t investigate further.)

    This is what I do to create a bootable USB drive for UEFI firmware:

    1. Create a GPT partition table on your USB drive. In GParted, chose «Device» and then «Create partition table. «. Choose gpt in the dropdown.
    2. Format a partition on the USB drive to FAT32 using GParted. All UEFI compliant firmwares must support FAT12, FAT16 and FAT32, so any of these should be fine, but NTFS will not work.
    3. Mount the USB drive like you would any other external storage so you can access the filesystem on the partition you created.
    4. Mount the ISO you wish to add to the USB drive so you can access the files in there.
    5. Now, when you have access to both the ISO and the USB drive as filesystems in your file manager (Nautilus or whatever) just copy and paste all files in the ISO to the USB drive.
    6. Add the ‘boot’ flag to the partition you’ve created and added the files to. In GParted, right click the partition, choose «manage flags» and then check the «boot» option.

    (While testing this I couldn’t mount the USB drive anymore after setting the boot flag. I don’t know why, but GParted could still see it and the end result was still a bootable USB drive, so I guess it doesn’t really matter.)

    1. Restart your computer and choose to boot from the USB drive.

    Once again: Please note that for this to work, your computer’s firmware must be UEFI compliant and the ISO must be ready for UEFI boot.

    If you find an EFI directory in the ISO that’s usually a good sign.

    To see whether you’re currently using UEFI boot, run sudo efibootmgr -v in a terminal. If it lists a number of boot options you’re good to go. If you’re using BIOS compatibility mode you’ll see something like this:

    Also, I don’t think Ubuntu will work with Secure Boot enabled, so you’ll have to disable that to be able to use UEFI boot with Ubuntu.

    For creating a bootable USB drive or writing an ISO file to USB flash drive, the Linux Mint has GUI program “USB Image Formatter“, which works fine but many of us sometimes prefer using command line terminal for the same. Let’s find out how to write an ISO file to a USB flash drive with command line terminal.

    To writen an Image file follow the following steps :

    1. Insert the USB flash drive in the USB port of your system.

    2. Before doing anything , you have to first format the flash drive. So follow the following v >

    3. Next, with USB connected to you system , open the command line terminal (Ctrl+Alt+t) and find the device partition table. Run the command :

    The disk partition of USB flash drive will reflect at the bottom of the command output. It should go something like as shown in the image here. In my case the disk partition is “/dev/sdb1”. Note that down .

    4. Next, unmount the flash drive. Run the following command followed with password if prompted :

    Note : Replace “/dev/sdb1” with your own partition address found in step 2 above.

    5. Finally with “dd” and “sync” command line utility, we are going to write the ISO file to our USB flash drive. Here’s the command to run :

    Give the correct path to your ISO file or else it would return error. In my case the path to Linux Mint ISO file is :

    6. Wait for the process to complete. Writing the ISO file to the flash drive would take few minutes. The final output would reflect the total bytes copied and time taken for completing the process along the speed.

    7. Finally, you can disconnect the USB flash drive from it’s port. The image file is now successfully written to usb stick.

    I’m having trouble figuring out how I would write an ISO disk image to a USB flash memory device from the command line in Ubuntu. I have the Startup Disk Creator utility, but I need to be able to script this job.

    I found the usb-creator package, but there doesn’t seem to be any documentation and python -m usbcreator gives usbcreator is a package and cannot be directly executed .

    I looked at unetbootin, but it seems like another GUI-only utility.

    Is there some obvious solution which I’m overlooking?

    4 Answers 4

    I know you can do this in UNetbootin gui. I haven’t tried it myself, but it looks like you can do it by command-line, as well:

    unetbootin method=diskimage isofile=»my.iso» installtype=USB targetdrive=/dev/sdc1

    Are you sure if the ISO image will work on a USB device? Some ISOs which will boot if they are on a CD/DVD will not actually boot from a USB device.

    Assuming the ISO you want has a bootloader that will work, then it should be as simple as dd if=filename.iso of=/dev/usbdevice but this will replace anything that is currently on the USB disk.

    If you wanted to place the ISO onto an existing filesystem on the USB drive and boot it, then setting it up may be a lot more complicated.

  • Оцените статью
    Добавить комментарий