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


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


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |