Thursday, September 15, 2016

how to make bootable pen drive using dd command in linux?

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.
After unmounting, we need to format our pen drive

mkfs.vfat /dev/sdb –I
The above command will format the pen drive and make it as  FAT filesystem.

After that use dd command:

dd if=~/home/srini/iso/kali.iso of=/dev/sdb bs=1M
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

where bs is block size the optimum block size is hardware dependent the perfect size will depend on your system bus, hard drive controller, the particular drive itself.


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$’

No comments:

Post a Comment