How To Use dd command In Linux/Unix To Make USB Bootable?

How To Use dd command In Linux/Unix To Make USB Bootable?

DD command is used to create a bootable disk from an existing image as it clones data from one disk or partition (or a disk image) to other at the byte or block level. When I said clone, I mean dd command copies the whole partitioning information, file system data and every bit of information as well, which is not possible to copy using file system copy.

To make a USB bootable generally, we use GUI applications such as Linux Live USB creator and other applications that are available for Linux, FreeBSD, Windows, and other operating systems. A bootable USB is required whenever there is a need for the installation of a new operating system or if we want to run an operating system live. In Unix and Unix-like operating system, dd is a command-line utility that is used to convert and copy files. It is a powerful tool that can be used for various purposes like backing up and restoring a disk, converting data formats, converting the case of a file, etc. The best thing is that it comes preinstalled with many Linux distributions. In this article, we will discuss how we can create a bootable USB drive using this tool.

List The Disks

There are various tools like fdisk, parted, sfdisk, cfdisk, df, etc are available for listing and partitioning of a disk in Linux. You can use any one of them to list and identify your USB drive. We are going to use the parted command as given below-

sudo parted -l

From the above list, /dev/sdb is the USB drive that we are going to make bootable.

parted is another command used to create, delete and modify partition information. You may have to install the parted command if it is not installed in your system.


Format The USB Drive

Linux system does not allow to format a disk that is already mounted. So before formatting the USB, we will have to unmount it. Use the command that is given below to unmount it-
sudo umount /dev/sdb

Now format the drive with FAT file system by using the given command –
sudo mkfs.vfat /dev/sdb
Similarly to format a drive with NTFS file system you can use the given command –
sudo mkfs.ntfs /dev/sdb


How to Create a Bootable USB using dd command?

Now use the following command to make the USB drive bootable
sudo dd if=~/Desktop/kali-linux-2019.3-amd64.iso of=/dev/sdb

Where, if stand forInput file” which specifies the path of ISO file of an operating system that we are going to install. And of stands for “Output file” which specifies the location where ISO file is to be written.

In our case, the ISO file of the operating system image (Kali Linux) is located on the desktop and it will be written on /dev/sdb which is our pen drive.

Now once you type the above command and press the enter. The process of writing will be started. It does not show the progress of copying the file you should wait until the process is not completed it can take a few minutes to complete it. But we can monitor the progress by using the following method.


How To Monitor Progress?

You can monitor the progress of the copying file by adding the status=progress option to the command that is given above. Use it as given below-
sudo dd if=~/Desktop/kali-linux-2019.3-amd64.iso of=/dev/sdb status=progress

Please note that while creating the USB bootable, the dd tool makes several partitions in it. So it will be best to format it before using it to make another ISO bootable. For other usages of dd tool, you can check its manual page by using the command that is given below-

man dd

Now I hope this article is useful to you. If you have a query or suggestion regarding the topic you can put it in the comments below.

Previous How To Use Telnet In Linux/Unix?
Next How To Use Firewall For Enhancing Network Security In Linux/Unix?

About author

You might also like

Linux Topics 0 Comments

How Systemd Is Different From SysVinit?

What Is init? In Unix or Unix based systems init is the first process that gets started during system boot. It is the parent process of all the processes that

Linux Topics 0 Comments

How to setup a network bridge in Ubuntu Linux

This post will tell you how to setup a network bridge in Ubuntu. I just cannot guarantee that this will work on all Ubuntu versions but this will surely work

Linux Topics 0 Comments

[How to solve] Could not load host key: /etc/ssh/ssh_host_rsa_key issue in FreeBSD or Linux

Sometimes while starting the sshd service you may face some issues like the following: Could not load host key: /etc/ssh/ssh_host_key Could not load host key: /etc/ssh/ssh_host_rsa_key Could not load host

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply