Last Updated on 2021-10-11 by Clay
If we have a USB bootable flash drive when we reinstalling an operating system of computer, it is very convenient.
We just need to make this USB bootable flash drive step by step, reopen the system, enter BIOS to configure USB boot, and we can reinstall all the OS.
In the past, I always used Startup Disk Creator (a GUI application) to make this device, but today, I want to make it via terminal.
In below, I will record how I made the USB bootable flash drive in the terminal
Use dd command to write ISO file to USB flash drive
Step 1: Install the ISO file
Before starting the command, don't forget to make sure that you really have an operating system iso file that can be installed.
Step 2: Check the USB flash drive and uninstall it
First, you can use lsblk
command to check the USB flash drive you need (remember to plug in the computer)
You will the following results:
sde 8:64 1 7.5G 0 disk
├─sde1 8:65 1 2.6G 0 part /media/clay/clay_usb
└─sde2 8:66 1 3.9M 0 part
If it is mounted, remember to use umount
to uninstall.
sudo umount /dev/sde1
Step 3: (Optional) Download pv package
If you want to be able to visualize the progress bar during dd production, you can use the following command to download the pv package.
sudo apt install pv
Step 4: Use dd command to write ISO file into USB device
If you have not installed the pv package (here I use sde as my input device):
sudo dd bs=4096 if=PATH_OF_ISO of=/dev/sde conv=fdatasync status=progress
If you have:
sudo dd bs=4096 if=PATH_OF_ISO | pv | of=/dev/sde conv=fdatasync status=progress
References
- https://askubuntu.com/questions/372607/how-to-create-a-bootable-ubuntu-usb-flash-drive-from-terminal
- https://vitux.com/how-to-create-a-bootable-usb-stick-from-the-ubuntu-terminal/
- https://askubuntu.com/questions/215505/how-do-you-monitor-the-progress-of-dd