Thursday, April 14, 2016

[Quick tips: USB Boot] :How to create bootable USB drive using dd command

How to create bootable USB drive using dd command

Making bootable ISO for all OS using dd command

Usually, We create bootable USB drives and install Linux and other operating systems. Of course there are many GUI applications to make bootable ISO are available for both Linux and Windows platforms such as,
  • Unetbootin ;
  • Win32diskimager ;
  • Linux live usb ;
  • USB image writer ;
  • WinUSB ;
  • USB startup creator ;
  • And many.
But there is an easy command line way too. There is no need for above applications. We can make bootable ISO, for any operating system, by using dd tool in Linux. Most Linux distributions has preinstalled dd tool. We can also use dd in Windows but need to download and install it from internet.
dd is very powerful tool. dd stands for Data Duplicator which is make copy using block by block from one device into another device. So we can also use dd tool for data backup and restore from one device into another device.

Steps to make a bootable USB

First format your pen drive. In order to format our pen drive we need to unmount the device from the operating system. Unmount is nothing but an removing device from directory tree. Which prevents device from data loss.
umount /dev/sdb*
Note: sdb is my pen drive. That is assigned by Linux operating system automatically while inserting pen drive into our system. You can identify it by typing following command
sudo fdisk –l
After unmounting, we need to format our pen drive
mkfs.vfat /dev/sdb –I
The above command will format the pen drive and maked FAT filesystem.
After that use dd command:
dd if=~/home/Buvanesh/iso/Ubuntu32.iso of=/dev/sdb
Here,
  • If stands for input file. It is used to specify the location of the ISO file.
  • Of stands for output file. It specifies where to write the ISO file. In our case, it’s /dev/sdb
It takes some time to copy one disk to another disk. Usually dd tool does not show progressing status. But we can use a simple trick to monitor it.
To monitor dd progress, run:
pgrep –l ‘^dd$’
It will print process number for the dd tool. Note down it and open new terminal session and type:
kill –USR1 6762
Here 6762 is my dd process id. Now it will print copying process statics.

That’s all. You can use the same procedure to make any OS to make bootable USB drive.
Additional tip: While creating bootable USB by using above method, dd tool will make several partition on that pen drive. So after using bootable USB, It is best to format and use the pen drive for making another bootable ISO.
To format the USB drive, run the following command:
sudo mkfs.vfat /dev/sdb –I
That’s all for now. I will be here soon with another article. Until then stay tuned with OSTechNix.
If you find this tutorial useful, please share it on your social networks and support us.
Cheers!

 

No comments: