Creating a bootable USB drive for Ubuntu using the terminal is a straightforward process. Here are the steps you can follow:
Prerequisites
- USB Drive: Make sure you have a USB drive with enough space to hold the Ubuntu ISO file.
- ISO File: Ensure you have the Ubuntu ISO file downloaded on your system.
Step 1: Plug in the USB Drive
Insert your USB drive into your computer.
Step 2: Identify the USB Drive
You need to identify the device path of your USB drive. You can do this using the lsblk command.
- Open a terminal.
- Run the following command:
lsblk
This will list all block devices. Look for your USB drive in the output. It will usually have a name like /dev/sdb, /dev/sdc, etc. Be careful to identify the correct device to avoid formatting the wrong disk.
Step 3: Unmount the USB Drive
If the USB drive is mounted, you need to unmount it before proceeding. Use the following command, replacing /dev/sdX1 with the actual partition you found in the previous step (you may find it as sdb1, sdc1, etc.):
sudo umount /dev/sdX1
Step 4: Create the Bootable USB
Now, you can use the dd command to create the bootable USB drive. Make sure to replace /path/to/ubuntu.iso with the actual path to your ISO file and /dev/sdX (without the number) with the device name of your USB drive that you identified earlier.
sudo dd if=/path/to/ubuntu.iso of=/dev/sdX bs=4M status=progress oflag=sync
Explanation of the Command:
- if=: Input file (the ISO image)
- of=: Output file (the USB device)
- bs=4M: Sets the block size to 4 MB. This speeds up the writing process.
- status=progress: Displays the progress of the operation.
- oflag=sync: Ensures that data is synchronized correctly.
Step 5: Wait for the Process to Complete
The dd command will take some time, depending on the size of the ISO and the speed of the USB drive. Do not interrupt the process until it is finished.
Step 6: Safely Remove the USB Drive
Once the dd command has completed, ensure that you remove the USB safely. You can run the following command to flush the write cache and make sure all data has been written:
sync
Then, you can safely remove your USB drive.
Step 7: Boot from the USB Drive
Now, you can use the USB drive to boot your computer. Restart your computer and enter the BIOS/UEFI settings (usually by pressing keys like F2, F10, DEL, or ESC, depending on your system) and select the USB drive to boot from.
Additional Notes
- Be very careful when using the
dd command, as it can overwrite any specified drive without warning. Always double-check the device paths before executing the command.
- If you're using a partitioned USB drive, ensure you're writing directly to the device (e.g.,
/dev/sdb) rather than a partition (e.g., /dev/sdb1).
With these steps, you should be able to create a bootable USB drive for Ubuntu successfully! If you have any issues or further questions, feel free to ask.