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

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

   

This post was last updated on August 2nd, 2020 at 02:08 pm

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 others at the byte or block level. When I said clone, I mean dd command copies the whole partitioning information, filesystem 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, and Windows. 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 a 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 to create a bootable USB drive using this tool in Linux or Unix.

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 To Create An ISO Image In Linux Using Terminal?

This post was last updated on August 1st, 2020 at 10:18 pmIso image files are distributed as a single downloadable file for bootable OS, games, etc. It is important to

Linux Topics 0 Comments

[SHELL] How to know in which shell you are working in Linux or FreeBSD

There are several ways to know the current shell on which you are working. We will be using some shell commands to know in which Shell you are working on.

Linux Topics 1Comments

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

This post was last updated on May 1st, 2020 at 01:28 pmSometimes while starting the sshd service you may face some issues like the following: Could not load host key:

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply