Bootstrap FreeKB - Linux Commands - How to use the DD and mkisofs commands to create an ISO or IMG file in Linux
Linux Commands - How to use the DD and mkisofs commands to create an ISO or IMG file in Linux

Updated:   |  Linux Commands articles

DD

The DD command is typically used to create a compressed ISO or IMG file that contains one or more files.In this example, the files at /home/user1/Documents/ are at /media/storage/documents.img.gz.

dd if=/home/user1/Documents/* conv=sync,noerror bs=64K | gzip -c  > /media/storage/documents.img.gz

 

Note:The new file can have either the .img or .iso extension.

 


MKISOFS

Mkisofs does the same. In this example, this command creates an .iso file named example.iso. The .iso file contains the contents of the /data directory.

[root@server1 ]# mkisofs -RJ -o example.iso /data

 


After creating the .iso file, let's make sure the .iso file contains the data we expect it to contain. Let's create a directory to mount the .iso file.

[root@server1 ]# mkdir /home/<username>/test

 

Mount the .iso file:

[root@server1 ]# mount -o loop example.iso /home/<username>/test

 

You can now enter the new directory, and the contents of the .iso will be listed.

[root@server1 ]# ls /home/<username>/test

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter ecdd81 in the box below so that we can be sure you are a human.