Tuesday, 10 January 2017

Creating, mounting and burning ISO's with linux

This tutorial simply demonstrates how you can quickly create, mount and burn ISO's with linux.

ISO's can be created using the 'mkisofs' command - as follows (assuming that /tmp/test/ is the data we would like on the ISO file system):

mkisofs -r -J -o cd_image.iso /tmp/test

The '-r' switch ensures that all files and folders are readable to the client - i.e. the entity that mounts the ISO.

We can also use the '-J' (MS Joliet) switch to ensure that compatability with Windows clients is maximized.

Before burning the ISO to our media lets peform a test run by mounting it on the local system:

mount -t iso9660 -o ro,loop cd_image.iso /mnt

On my Fedora 25 box I got the following error:

mount: /tmp/cd_image.iso: failed to setup loop device: Invalid argument

This is likely due to the fact that the 'loop' kernel module is not enabled - to check it's present we can run:

lsmod | grep loop

and to enable we can run:

modprobe loop

and to enable permanently (on Debian based distros):

echo loop >> /etc/modules

or on RHEL based distros:

echo loop > /etc/modules-load.d/loop.conf

and retry mounting:

mount -t iso9660 -o ro,loop cd_image.iso /mnt

Once you are happy - we will unmount the ISO and burn it to disk with:

umount /mnt

To look for available CD / DVD writers we should issue:

wodim -scanbus

I got a 'wodim: No such file or directory. Cannot open SCSI driver!' returned when issuing this - it appears that wodim expects a SCSI device and to support anything else you need a compatability driver!

Initially I thought that the sg module was not enabled - but it turns on it was. After running

wodim dev=/dev/sr0 -checkdrive

It successfully found the drive.

It turns out in Fedora 25 you need to manaully define the block device within the wodim.conf file:

echo 'cdrom= /dev/sr0' >> /etc/wodim.conf

and run the scan again:

wodim -scanbus

Now we can write the image with:

cdrecord -v speed=16 dev=1,0,0 -data cd_image.iso

0 comments:

Post a Comment